Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Matplotlib Version
#1
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)
Reply
#2
(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.
Reply
#3
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need to install an old version of matplotlib Pedroski55 3 3,488 Oct-02-2021, 07:36 AM
Last Post: buran
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,417 Mar-11-2021, 10:52 AM
Last Post: buran
  Can I upload a new version without previously deleting ancient version sylas 6 4,518 Nov-08-2017, 03:26 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020