Borrao 18 03 Matplotlib
Borrao 18 03 Matplotlib
Python 2.7.13 |Anaconda 4.3.1 (64-bit)| (default, Dec 19 2016, 13:29:36) [MSC v.1500 64 bit (AMD64)]
object? -> Details about 'object', use 'object??' for extra details.
plt.axes()
plt.gca().add_patch(circle)
plt.axis('scaled')
Out[5]:
(-0.82499999999999996,
0.82499999999999996,
-0.82499999999999996,
0.82499999999999996)
plt.show()
plt.gca().add_line(line)
plt.show()
plt.gca().add_line(line)
<ipython-input-11-11d1af3f8597> in <module>()
----> 1 plt.gca().add_line(line)
1927 """
1930 line.set_clip_path(self.patch)
C:\Users\adm\Anaconda2\lib\site-packages\matplotlib\axes\_base.pyc in _set_artist_props(self, a)
956 a.set_transform(self.transData)
RuntimeError: Can not put single artist in more than one figure
polygon = plt.Polygon(points)
line = plt.Polygon(points, closed=None, fill=None, edgecolor='r')
line
line.show()
<ipython-input-16-ae7a3858647c> in <module>()
----> 1 line.show()
line
verts = [
<ipython-input-21-fe970f43eeb2> in <module>()
codes = [Path.MOVETO,
Path.LINETO,
Path.LINETO,
Path.LINETO,
Path.CLOSEPOLY,
fig = plt.figure()
ax = fig.add_subplot(111)
patch = patches.PathPatch(path, facecolor='orange', lw=2)
ax.add_patch(patch)
ax.set_xlim(-2,2)
Out[28]: (-2, 2)
ax.set_ylim(-2,2)
Out[29]: (-2, 2)
plt.show()
verts = [
(0., 0.), # P0
(0.2, 1.), # P1
(1., 0.8), # P2
(0.8, 0.), # P3
codes = [Path.MOVETO,
Path.CURVE4,
Path.CURVE4,
Path.CURVE4,
fig = plt.figure()
ax = fig.add_subplot(111)
ax.add_patch(patch)
xs, ys = zip(*verts)
ax.set_xlim(-0.1, 1.1)
ax.set_ylim(-0.1, 1.1)
plt.show()
verts = [
codes = [Path.MOVETO,
Path.LINETO,
Path.LINETO,
Path.LINETO,
Path.CLOSEPOLY,
fig = plt.figure()
ax = fig.add_subplot(111)
ax.add_patch(patch)
ax.set_xlim(-5,5)
ax.set_ylim(-5,5)
plt.show()
verts = [
codes = [Path.MOVETO,
Path.LINETO,
Path.LINETO,
Path.LINETO,
Path.CLOSEPOLY,
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_xlim(-5,5)
ax.set_ylim(-5,5)
plt.show()
verts = [
codes = [Path.MOVETO,
Path.LINETO,
Path.LINETO,
Path.LINETO,
Path.CLOSEPOLY,
ax = fig.add_subplot(111)
ax.add_patch(patch)
ax.set_xlim(-5,5)
ax.set_ylim(-5,5)
plt.show()
verts = [
codes = [Path.MOVETO,
Path.LINETO,
Path.LINETO,
Path.LINETO,
Path.CLOSEPOLY,
]
path = Path(verts, codes)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.add_patch(patch)
ax.set_xlim(-5,5)
ax.set_ylim(-5,5)
plt.show()
verts = [
codes = [Path.MOVETO,
Path.LINETO,
Path.LINETO,
Path.CLOSEPOLY,
]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.add_patch(patch)
ax.set_xlim(-5,5)
ax.set_ylim(-5,5)
plt.show()
vertices = [
]
comandos = [Path.MOVETO,
Path.LINETO,
Path.LINETO,
Path.CLOSEPOLY,
fig = plt.figure()
ax = fig.add_subplot(111)
ax.add_patch(patch)
ax.set_xlim(-8,8)
ax.set_ylim(-8,8)
plt.show()
link
https://matplotlib.org/users/path_tutorial.html