下のコードでfill=Falseをしているにもかかわらず「青く塗られた円」が描かれる。
from matplotlib.collections import PatchCollection
from pylab import *
def draw():
clf()
circles = [Circle(random(2), radius=random(), fill=False)]
gca().add_collection(PatchCollection(circles))
matplotlib.pyplot.savefig('test.png')numpy.__version__ == '1.6.1'
matplotlib.__version__ == '1.0.1'
pdbのステップ実行で追いかけて行ったらmatplotlib.backends.backend_agg.RendererAggのbuilt-in method draw_path_collectionに入ってしまったのでそこで面倒になってしまった。
(Pdb) print renderer <matplotlib.backends.backend_agg.RendererAgg instance at 0x103fd0290> (Pdb) print renderer.draw_path_collection <built-in method draw_path_collection of tuple object at 0x103ebfb00>
追記:
結論としてはfillは機能しています。
gca().add_collection(PatchCollection(circles))でfillされてしまっている模様。
gca().add_collection(PatchCollection(circles, facecolor='none'))でfillされなくなります。
このコメントを元に調べてみたところ、PatchCollectionはデフォルトでCircleで指定した色を上書きしてしまうということがわかりました。
Definition:PatchCollection(self, patches, match_original=False, **kwargs)
(snip)
*match_original*
If True, use the colors and linewidths of the original
patches. If False, new colors may be assigned by
providing the standard collection arguments, facecolor,
edgecolor, linewidths, norm or cmap.