Hi, One thing that I really like about Matlab's handle
> graphics system is that it is self-documenting: if I do
> h=plot(...), I can query the current values of all
> properties with get:
This is a very useful feature in matplotlib. Thanks for your patch.
I ended up implementing this functionality, but using a different
approach than your query methods. Instead, I added formatted strings
to the doc strings of each setter that describe what that function
accepts, eg
def set_linestyle(self, s):
"""
Set the linestyle of the line
ACCEPTS: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' ]
"""
set now parses this information and uses it to display the
properties. In the CVS version of matplotlib, you can get this
information, as in matlab, with
# report accepts info on all properties
set(line)
# report accepts info on linestyle property
set(line, 'linestyle')
# print the value of all properties
get(line)
# print the value of the linestyle property
get(line, 'linestyle')
Very nice! See the files examples/set_and_get.py in CVS. Here is
some sample output
1 >>> lines = plot([1,2,3])
2 >>> set(lines)
alpha: float
antialiased or aa: [True | False]
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
color or c: any matplotlib color - see help(colors)
dashes: sequence of on/off ink in points
data: (array xdata, array ydata)
data_clipping: [True | False]
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' ]
linewidth or lw: float
lod: [True | False]
marker: [ '+' | ',' | '.' | '1' | '2' | '3' | '4' | '<' | '>' |
'D' | 'H' | '^' | '_' | 'd' | 'h' | 'o' | 'p' | 's' | 'v' | 'x' |
'|' ]
markeredgecolor or mec: any matplotlib color - see help(colors)
markeredgewidth or mew: float
markerfacecolor or mfc: any matplotlib color - see help(colors)
markersize or ms: float
transform: a matplotlib.transform transformation instance
vertical_offset: DEPRECATED
visible: [True | False]
xclip: (xmin, xmax)
xdata: array
yclip: (ymin, ymax)
ydata: array
3 >>> .
Thanks for the suggestion!
JDH