when i compile the code it does not show any popup window
No popup window show
Hey @yashaswiupmon, I think your file name is 3d.py.py make it contour.py and than try running it.
Hope this resolved your doubt.
Plz mark doubt as resolved in my doubts section.
Hey @yashaswiupmon, in the top of your ipynb notebook, add this line
import matplotlib; matplotlib.use(‘TkAgg’)
And try to run it again.
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use(‘TkAgg’)
x=np.arange(-1,1,0.02)
y=x
x,y=np.meshgrid(x,y)
fig=plt.figure()
axes=fig.gca(projection=‘3d’)
axes.contour(x,y,x2+y2,cmap=‘rainbow’)
plt.show()
i tried but still not work
Hey @yashaswiupmon, you need to add these lines
import matplotlib
matplotlib.use(‘TkAgg’)
At the very beginning of the code.
import matplotlib
matplotlib.use(‘TkAgg’)
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
x=np.arange(-1,1,0.02)
y=x
x,y=np.meshgrid(x,y)
fig=plt.figure()
axes=fig.gca(projection=‘3d’)
axes.contour(x,y,x2+y2,cmap=‘rainbow’)
plt.show()
If still id didn’t worked, than switch to jupyter, ther error is due to the reason that matplotlib is unable to synchronize properly with the terminal.
@S18CRX0120
in jupyter you can see the 3d model type image it shows normal figure.The line of codes does not work aswell.
thanking you
Hey @yashaswiupmon, no in jupyter you can just view in 2D.
Also try one more thing,
import matplotlib
matplotlib.use(‘TkAgg’)
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
x=np.arange(-1,1,0.02)
y=x
x,y=np.meshgrid(x,y)
fig=plt.figure()
axes=fig.gca(projection=‘3d’)
axes.contour(x,y,x2+y2,cmap=‘rainbow’)
plt.show(block = True)
If this also doesn’t work than switch to jupyter only.
Happy Learning
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.