| |
- get(o, *args, **kwargs)
- Return the value of handle property s
h is an instance of a class, eg a Line2D or an Axes or Text.
if s is 'somename', this function returns
o.get_somename()
get can be used to query all the gettable properties with get(o)
Many properties have aliases for shorter typing, eg 'lw' is an
alias for 'linewidth'. In the output, aliases and full property
names will be listed as
property or alias = value
eg
linewidth or lw = 2
- getp(o, *args)
- Return the value of handle property s
h is an instance of a class, eg a Line2D or an Axes or Text.
if s is 'somename', this function returns
o.get_somename()
get can be used to query all the gettable properties with get(o)
Many properties have aliases for shorter typing, eg 'lw' is an
alias for 'linewidth'. In the output, aliases and full property
names will be listed as
property or alias = value
eg
linewidth or lw = 2
- set(*args, **kwargs)
- setp(h, *args, **kwargs)
- matlab(TM) and pylab allow you to use set and get to set and get
object properties, as well as to do introspection on the object
For example, to set the linestyle of a line to be dashed, you can do
>>> line, = plot([1,2,3])
>>> set(line, linestyle='--')
If you want to know the valid types of arguments, you can provide the
name of the property you want to set without a value
>>> set(line, 'linestyle')
linestyle: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' ]
If you want to see all the properties that can be set, and their
possible values, you can do
>>> set(line)
... long output listing omitted'
set operates on a single instance or a list of instances. If you are
in quey mode introspecting the possible values, only the first
instance in the sequnce is used. When actually setting values, all
the instances will be set. Eg, suppose you have a list of two lines,
the following will make both lines thicker and red
>>> x = arange(0,1.0,0.01)
>>> y1 = sin(2*pi*x)
>>> y2 = sin(4*pi*x)
>>> lines = plot(x, y1, x, y2)
>>> set(lines, linewidth=2, color='r')
Set works with the matlab(TM) style string/value pairs or with python
kwargs. For example, the following are equivalent
>>> set(lines, 'linewidth', 2, 'color', r') # matlab style
>>> set(lines, linewidth=2, color='r') # python style
|