Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Bk3_Ch6_01.py #78

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

albertix
Copy link

@albertix albertix commented May 8, 2023

#76

ax = fig.gca(projection='3d')`

提示

TypeError Traceback (most recent call last)
Cell In[141], line 56
54 zz = 2 + xx*0;
55 caption = '$z - 2 = 0$';
---> 56 plot_surf (xx,yy,zz,caption)
58 #%% y - z = 0
59 zz = yy;

Cell In[141], line 13, in plot_surf(xx, yy, zz, caption)
10 colors = cm.RdYlBu_r(norm_plt(zz))
12 fig = plt.figure()
---> 13 ax = fig.gca(projection='3d')
14 surf = ax.plot_surface(xx,yy,zz,
15 facecolors=colors, shade=False)
16 surf.set_facecolor((0,0,0,0))

TypeError: FigureBase.gca() got an unexpected keyword argument 'projection'

改为

ax = fig.add_subplot(projection='3d')

ax = plt.axes(projection='3d')

后正常。

```
ax = fig.gca(projection='3d')`
```
提示
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[141], line 56
     54 zz = 2 + xx*0;
     55 caption = '$z - 2 = 0$';
---> 56 plot_surf (xx,yy,zz,caption)
     58 #%% y - z = 0
     59 zz = yy;

Cell In[141], line 13, in plot_surf(xx, yy, zz, caption)
     10 colors = cm.RdYlBu_r(norm_plt(zz))
     12 fig = plt.figure()
---> 13 ax = fig.gca(projection='3d')
     14 surf = ax.plot_surface(xx,yy,zz,
     15                        facecolors=colors, shade=False)
     16 surf.set_facecolor((0,0,0,0))

TypeError: FigureBase.gca() got an unexpected keyword argument 'projection'


改为
```
ax = fig.add_subplot(projection='3d')
```
或
```
ax = plt.axes(projection='3d')
```
后正常。
@Visualize-ML
Copy link
Owner

Visualize-ML commented May 14, 2023 via email

@njaucjb
Copy link

njaucjb commented Nov 29, 2023

ax = fig.gca(projection='3d')

对这个报错,谢谢!

@Visualize-ML
Copy link
Owner

Visualize-ML commented Nov 29, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants