"Derek Hohls" <[EMAIL PROTECTED]> writes:

>   In [9]: ax.set_xlim()?
>  I get
>   Object `ax.set_xlim()` not found.

You need to do ax.set_xlim? without the parentheses.

> You suggested:
> "The list you want is precisely the output of the getp command."
> But for the getp? , I get:

I meant the output of the actual getp command, not its help text. E.g.

    In [4]:recs=bar([1,2,3],[4,5,6])

    In [5]:getp(recs)
        alpha = 1.0
        animated = False
          ...
        y = 0.0
        zorder = 1

gives you the list of properties settable with setp. Similarly
getp(gca()) gives you a long list of properties, including xticklines.

> The matplotlabprc file has a clearly labelled line that 
> addresses part of this:
>  
> xtick.major.size     : 2      # major tick size in points
>  
> but of course I would like to do this in code.

I guess it isn't very obvious how to do this with setp. It is the
markersize property (which has the abbreviation ms):

    In [25]:setp(getp(gca(), 'xticklines'), 'ms', 10)

Note that here getp returns a list of objects, and setp sets the
property on every object in the list.

But if you already know what something is called in the matplotlibrc
file, you can set it programmatically:

    In [49]:rc('xtick.major', size=5, pad=20)

The rc settings do not affect existing images, so you have to make a
new plot before you see the effect:

    In [50]:figure(); bar([1,2,3],[4,5,6])

> I guess that, overall, I have been expecting matplotlib to
> have a simple "dot" notation throughout - 
>   xaxis.xtick.major.size = 2

The getp/setp methods are part of matplotlib's pylab interface, which
is designed to reproduce Matlab's "handle graphics". There is also an
OO interface, which looks like this (this is the agg_oo.py example
from the examples subdirectory):

    fig = Figure()
    canvas = FigureCanvas(fig)
    ax = fig.add_subplot(111)
    ax.plot([1,2,3])
    ax.set_title('hi mom')
    ax.grid(True)
    ax.set_xlabel('time')
    ax.set_ylabel('volts')
    canvas.print_figure('test')

I seem to recall some discussion about making it more Pythonic, e.g. 
allowing you to do

    ax.title = 'hi mom'
    ax.xlabel = 'time'

but I don't know whether it is a high priority for any of the
developers.

-- 
Jouni


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to