3D plots with the latest Matplotlib

Installing Python on a new computer, I found I had to downgrade Matplotlib to release 3.5.2 to get my 3D plotting functions to work. Further investigation found that the problem was the Axes3D function.

Changing:

    ax = axes3d.Axes3D(fig)
to:
ax = fig.add_subplot(1,1,1, projection='3d')

the 3D plotting functions worked without further changes to the code. Some additional functionality was also added:

  • The new “roll” angle and focal length attributes were addded.
  • The calculation of the viewpoint coordinates offset and the zoom factor were modified.
  • Scroll bars were added to the spreadsheet to control the zoom factor and viewpoint location.

The new code for the Plot3D function and the new Plot Frame spreadsheet can be downloaded from:

Matplotlib3D.zip.

New spreadsheet:

This entry was posted in Animation, Coordinate Geometry, Drawing, Excel, Link to Python, Newton, NumPy and SciPy, PyXLL, UDFs and tagged , , , , , , . Bookmark the permalink.

2 Responses to 3D plots with the latest Matplotlib

  1. Suelio Josileissu says:

    Wow, very nice drawing sheet.
    Where is located the coordinates to show this draw? Matplotlib creates the file anywhere?

    Like

    • dougaj4 says:

      I have added a link to my previous post on 3D plotting, which has a link to the source of the image data, as well as several other examples. The original data is only available to licenced users of the Strand7 FEA package, but the coordinates are included in the download spreadsheet. The functions require pyxll to run from Excel, but all the python code is included in the download file.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.