June 2025
Intermediate to advanced
515 pages
17h 5m
English
The matplotlib module can plot geometric figures such as rectangles, circles, and triangles. These figures can then illustrate mathematical, technical, and physical relationships. I’ll now demonstrate the creative options of matplotlib through three examples by illustrating the Pythagorean theorem: a gear representation, a pointer diagram, and a current-carrying conductor in a homogeneous magnetic field.
Rectangle objects r are created using the following method:
r=patches.Rectangle((x1,y1),b,h,fill,edgecolor,angle)
These objects are then inserted into the drawing area via add_patch(r).
The x1,y1 tuple defines the lower-left corner of the rectangle. The b and h parameters determine ...
Read now
Unlock full access