
上QQ阅读APP看书,第一时间看更新
How it works...
- verts1 and verts2 define the points along which the curves have to be drawn. path1 and path2 define the complete path for each of the curves to be drawn.
- Path.MOVETO takes the starting point of the curve to the specified first point in verts.
- Path.LINETO draws a line from the current position to the next point specified.
- Path.CLOSEPOLY closes the polynomial curve loop.
- Path.CURVE3 draws a curve from a given point, along a control point, and then terminates at the third point.
- Path.CURVE4 (not used in this example) does the same, but over two control points instead of one.
- patches.PathPatch is a helper function that draws the curve along the given path.
- The zorder parameter overrides the default order of plotting different patches. In this case, we want the second patch to be plotted first and then the first patch so that both are visible. Otherwise, the smaller patch would be hidden behind the larger one.
- lw specifies the line width and facecolor specifies the color to be filled inside the patch, overriding the default color.
Here is the output from the code: