PolygonGlyph¶
PolygonGlyph wraps PolyCollection. A per-polygon values array fills and colour-maps the polygons (with a colorbar); with no values or outline_only=True, only the outlines are drawn.
In [1]:
Copied!
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from cleopatra.polygon_glyph import PolygonGlyph
polygons = [
np.array([[0., 0.], [1., 0.], [1., 1.], [0., 1.]]),
np.array([[1., 0.], [2., 0.], [2., 1.], [1., 1.]]),
np.array([[0., 1.], [1., 1.], [0.5, 2.]]),
]
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from cleopatra.polygon_glyph import PolygonGlyph
polygons = [
np.array([[0., 0.], [1., 0.], [1., 1.], [0., 1.]]),
np.array([[1., 0.], [2., 0.], [2., 1.], [1., 1.]]),
np.array([[0., 1.], [1., 1.], [0.5, 2.]]),
]
1. Value-filled polygons¶
In [2]:
Copied!
values = np.array([10., 20., 30.])
pg = PolygonGlyph(polygons, values=values, cmap='YlGnBu')
fig, ax, pc = pg.plot(title='Filled by value')
ax.autoscale()
values = np.array([10., 20., 30.])
pg = PolygonGlyph(polygons, values=values, cmap='YlGnBu')
fig, ax, pc = pg.plot(title='Filled by value')
ax.autoscale()
2. Outlines only¶
In [3]:
Copied!
pg = PolygonGlyph(polygons)
fig, ax, pc = pg.plot(outline_only=True, title='Outlines')
ax.autoscale()
pg = PolygonGlyph(polygons)
fig, ax, pc = pg.plot(outline_only=True, title='Outlines')
ax.autoscale()