Last active
July 23, 2020 12:19
-
-
Save sabopy/2711385d68707c3b2467309381c3e4f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.path as mpath | |
import matplotlib.patches as mpatches | |
import matplotlib.pyplot as plt | |
Path = mpath.Path | |
fig, ax = plt.subplots() | |
pp1 = mpatches.PathPatch( | |
Path([(0, 0), (1, 0), (1, 1)], | |
[Path.MOVETO, Path.CURVE3, Path.CURVE3]), | |
fc="C2", transform=ax.transData,alpha=0.5) | |
ax.add_patch(pp1) | |
ax.plot([0,1], [0,1], "ro") | |
ax.set_title('Quadratic Bézier curve') | |
plt.savefig("quadbc.png",dpi=120) | |
plt.show() | |
fig, ax = plt.subplots() | |
pp1 = mpatches.PathPatch( | |
Path([(0, 0), (1, 0), (1, 1), (0, 1)], | |
[Path.MOVETO, Path.CURVE4, Path.CURVE4, Path.CURVE4]), | |
fc="C6", transform=ax.transData,alpha=0.5) | |
ax.add_patch(pp1) | |
ax.plot([0,0], [0,1], "ro") | |
ax.set_title('Cubic Bézier curve') | |
plt.savefig("cubicbc.png",dpi=120) | |
plt.show() | |
import matplotlib | |
print(matplotlib.__version__) | |
3.2.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment