S3Dlib is a Python library for visualizing 3D surfaces and lines which is used in conjunction with the Matplotlib library. For example, the figures below were constructed using these libraries.

_images/figure_0.png _images/figure_1.png _images/figure_2.png _images/figure_3.png _images/figure_4.png _images/figure_5.png

S3Dlib takes an object-oriented approach to 3D surface and line construction. With predefined three-dimensional surface grids in native coordinate systems, S3Dlib makes surface object construction easy for more advanced functional relations in 3D. Line objects can be directly constructed or derived from surface objects. Likewise, surface objects can be constructed from line objects. S3Dlib classes are directly derived from Matplotlib classes. As a result, all the object properties provided by that library are available when using S3Dlib. Once created, S3Dlib objects are directly added to the Matplotlib Axes3D.

S3Dlib is used to created the objects. Matplotlib is then used for object rendering and figure annotation.


This is the documentation for S3Dlib version 1.2.0

The basic procedure for quickly seeing how S3Dlib can generate plots is demonstrated in the Hello World tutorial. Get started by going over the Tutorials with more detailed explanation in the Guides pages.

Check out the Examples gallery to see various S3Dlib applications. Numerous examples also provide explanations on usage and various features.

Developer’s Notes

S3Dlib is not a substitute for, but a complement to Matplotlib for rendering 3D surfaces and lines.

The main objective of developing S3Dlib was that, given a function in native coordinates, it should only take one code statement to create a surface or line object, one code statement to create the geometry, and one code statement to color the object. Finally, one code statement to add that object to a Matplotlib 3D axis. Any further annotation would be achieved using Matplotlib.

A secondary objective was that the function used to define the geometry is easily comprehensible by examining the code, and not obscured in the grid creation algorithm. In other words, a functional relationship should look like a function in native coordinates.

As shown in the various examples, these objectives have been reasonably achieved.

Why so many examples? From experience as a student and instructor, examples provide a major learning tool. Examples show the application of concepts. Examples allow a comparison between a problem and a similar problem already solved. Documentation describes what a method does whereas examples describe how a method is used. Also, examples answer ‘So, what is it good for?’.

Any comments regarding computational errors or code improvements, and additional capabilities would be encouraged and appreciated. Comments based on best practices would also be helpful, including documentation improvements (please provide references if available). Any examples using S3Dlib would also be welcome. Click here to send an email for your comments.

Hope this package is helpful.