Python Forum
Matplotlib Version - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Matplotlib Version (/thread-40571.html)



Matplotlib Version - Aboutben - Aug-20-2023

I have written a Python code, and it's not working. It's likely due to the Matplotlib version. The following code should work with version 3.5, but it doesn't work with version 3.7. Here's the code. How can I modify it to make it work?


 fig.canvas.set_window_title('Alcubierre Warp Drive')
ax = fig.gca(projection='3d')
ax.view_init(25, -45)



RE: Matplotlib Version - snippsat - Aug-20-2023

(Aug-20-2023, 02:29 PM)Aboutben Wrote: The following code should work with version 3.5, but it doesn't work with version 3.7.
Pin 3.5(pip install matplotlib==3.5.3) version in virtual environment and need a python 3.10 or lesser version for this.
# Make environment for 3.10
G:\div_code                                                                                                                             
λ py -3.10 -m venv mat_env                                                                                                      
                                                                                                                                        
G:\div_code                                                                                                                             
λ cd mat_env\                                                                                                                          
                                                                                                                                        
G:\div_code\mat_env                                                                                                                     
λ G:\div_code\mat_env\Scripts\activate                                                                                                  
                                                                                                                                        
(mat_env) G:\div_code\mat_env                                                                                                           
λ pip install matplotlib==3.5.3                                                                                                         
Collecting matplotlib==3.5.3  
.....                                                                         

# Test that it work                                                                                                                                     
(mat_env) G:\div_code\mat_env                                                                                                           
λ python                                                                                                                                
Python 3.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)] on win32                                        
Type "help", "copyright", "credits" or "license" for more information.                                                                  
>>> import matplotlib                                                                                                                   
>>>                                                                                                                                     
>>> matplotlib.__version__                                                                                                              
'3.5.3' 

The other way try to find out what change in Matplotlib and try to update your code,this can be a difficult way.


RE: Matplotlib Version - Aboutben - Aug-21-2023

I have found a solution. I change the Code to

fig = plt.figure(dpi=96)
fig.canvas.manager.set_window_title('Alcubierre Warp Drive')
ax = fig.add_subplot(projection='3d')
ax.view_init(25, -45)
and it’s work.