Reputation: 353
I'd like to fill markers inside boxes as the following boxplot image.
I don't have idea how to implement this. I searched for it on the web. There are posts about filling colours in the boxes (http://matplotlib.org/examples/pylab_examples/boxplot_demo2.html) but it seems there are no posts about filling markers.
Upvotes: 2
Views: 1514
Reputation: 23510
It should be relatively simple. I took the example and added one line (set_hatch
) immediately after the creation of the polygon:
...
boxPolygon = Polygon(boxCoords, facecolor=boxColors[k])
boxPolygon.set_hatch('*')
ax1.add_patch(boxPolygon)
...
and removed the sample marker plot command. This is what I got:
For more information on patch.set_hatch
, see this example.
Upvotes: 2