get(handle) and set(handle,'property')


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:

  >> get(h)
          Color = [0 0 1]
          EraseMode = normal
          LineStyle = -
          LineWidth = [0.5]
          UserData = []
          Visible = on

Also, if I'm interested in changing something but don't know the
allowed values, I can use set:

  >> set(h,'linestyle')
  [ {-} | -- | : | -. | none ]
  >> set(h,'erasemode')
  [ {normal} | background | xor | none ]
  >> set(h,'markersize')
  A line's "MarkerSize" property does not have a fixed set of property values.

I'm attaching a patch that adds something like this to Matplotlib. For
get, the changes are quite straightforward, but for set, the correct
design is not obvious. I have added some example documentation to axes
objects, so set(gca()) returns something useful.

But, again, I'm not sure about the design, so please consider this
patch not as something I'd like applied to matplotlib right now, but
as a suggestion of a feature I would like to see added.

getset.patch (7.21 KB)


Jouni K Sepp�nen