Hello John I was wondering how to change the size of a
> point marker in legend. I only plot single points like:
> h1 = plot([1],[2],'ro') h2 = plot([3],[4],'go')
> legend((h1,h2),('1','2'), numpoints = 1)
> but the marker 'o' comes out quite small in the legend.
> Is there an easy way to enlarge it ??
See help(legend), specifically the markerscale kwarg
markerscale = 0.6 # the relative size of legend markers vs. original
> By the way, why aren't things like fontsize,
> Frame=True/False etc legend kwargs ?? It would be much
> easier to change them this way compared to what you have
> shown in legend_demo.py. But, I guess there is a sensible
> reason for this.
You can pass in a kwarg
prop = FontProperties(size='smaller') # the font properties
to control the font property. See
http://matplotlib.sf.net/matplotlib.font_manager.html#FontProperties
for more information
As a general answer to your question, there are simply too many things
to customize to make them all kwargs. We would have to add all the
properties of the frame, all the properties of the markers, all the
properties of the text, and these would be ambiguous since they all
derive from the base Artist class and hence properties like "visible"
which apply to all artists would be ambiguous. matplotlib Artists
have a lot of configurable properties (eg for the frame alone)
In [5]: frame = leg.get_frame()
In [6]: get(frame)
alpha = 1.0
antialiased or aa = True
clip_on = False
edgecolor or ec = k
facecolor or fc = w
figure = <matplotlib.figure.Figure instance at 0x41a9ecac>
fill = 1
height = 0.0123998966675
label =
linewidth or lw = 1.0
transform = <Affine object at 0x84b7cec>
verts = ((0.89123573200992556, 0.96760010333247226), (0.89123573200992556, 0.97999999999999998), (0.97999999999999998, 0.97999999999999998), (0.97999999999999998, 0.96760010333247226))
visible = True
width = 0.0887642679901
window_extent = <Bbox object at 0x84316ec>
x = 0.89123573201
y = 0.967600103332
zorder = 1
and it would be tedious and difficult to maintain to expose all of
these in the kwarg interface.
JDH