Getting started with bar charts

[Again copying to matplotlib-users; maybe the main developers can comment on whether these shortcomings in the getp/setp interface should be fixed.]

Hi Derek,

It does seem as those these settings affect the top and bottom of the graph - I was wondering if it was possible to show tickmarks along the bottom edge but not the top edge?

I don't think that's directly supported. Here's a hacky way to do it:

     lines = getp(gca(), 'xticklines')
     toplines = [ l for l in lines if getp(l, 'ydata') == (1,) ]
     setp(toplines, visible=False)

How I came up with this: I knew that I wanted to make some of the xticklines invisible, so I looked at the list of line objects for clues as to what differs between them. They seem to have xdata and ydata properties, and ydata is (0,) for half of the lines and (1,) for the other half, so it looks like it is the vertical position in axis coordinates. (xdata seems to be in data coordinates.)

And the other property I do not see on the list is the one that shows whether a tick goes "into" the graph or just "out" - in the prc file, there is a line:
xtick.direction : in # direction: in or out
but there is no "direction' property?

You're right, there is no obvious property to control this. Here's an even hackier way to do this (and one that doesn't look very future-proof):

     for l in getp(gca(), 'xticklines'):
         setp(l, 'marker', 5-getp(l, 'marker'))

The line objects have a marker property, which is 2 for some markers and 3 for the others... so I guessed that one of them means upwards and the other downwards, and checked this guess by flipping the xtick.direction parameter and looking again. So subtracting the marker from 5 flips the direction.

I wonder how this is done in Matlab?

    label: any string

which shows me that the Yaxis has a label - in this case a
string - but I do not see how one can set the font properties
for the Yaxis label as it is not Text object??

I think you cannot do this with setp alone. Use the ylabel command:

     ylabel('foo bar', fontsize=18)

···

--
Jouni

from pylab import *

a=axes()
a.xaxis.tick_bottom()
show()

···

On Wednesday 23 August 2006 2:52 am, Jouni K Seppänen wrote:

[Again copying to matplotlib-users; maybe the main developers can
comment on whether these shortcomings in the getp/setp interface
should be fixed.]

Hi Derek,

> It does seem as those these settings affect the top and bottom of
> the graph - I was wondering if it was possible to show tickmarks
> along the bottom edge but not the top edge?

Jouni

Wow! A guru at work... this solves all my current problems;
your insights and comments are most appreciated!

To return to my first post - matplotlib aims to make simple things
simple - I would argue that the way tickmarks are currently dealt
with is NOT simple & it would be great to see some simplifications
or additions to the interface to deal with the issues raised in this
thread (for example, by aligning their behaviour and properties to
other, similar, chart properties).

Thanks again,
Derek

Jouni K Seppänen <jks@...397...> 2006/08/23 08:52 AM >>>

[Again copying to matplotlib-users; maybe the main developers can
comment on whether these shortcomings in the getp/setp interface
should be fixed.]

Hi Derek,

It does seem as those these settings affect the top and bottom of
the graph - I was wondering if it was possible to show tickmarks
along the bottom edge but not the top edge?

I don't think that's directly supported. Here's a hacky way to do it:

     lines = getp(gca(), 'xticklines')
     toplines = [ l for l in lines if getp(l, 'ydata') == (1,) ]
     setp(toplines, visible=False)

How I came up with this: I knew that I wanted to make some of the
xticklines invisible, so I looked at the list of line objects for
clues as to what differs between them. They seem to have xdata and
ydata properties, and ydata is (0,) for half of the lines and (1,)
for the other half, so it looks like it is the vertical position in
axis coordinates. (xdata seems to be in data coordinates.)

And the other property I do not see on the list is the one that
shows whether a tick goes "into" the graph or just "out" - in the
prc file, there is a line:
xtick.direction : in # direction: in or out
but there is no "direction' property?

You're right, there is no obvious property to control this. Here's an
even hackier way to do this (and one that doesn't look very future-
proof):

     for l in getp(gca(), 'xticklines'):
         setp(l, 'marker', 5-getp(l, 'marker'))

The line objects have a marker property, which is 2 for some markers
and 3 for the others... so I guessed that one of them means upwards
and the other downwards, and checked this guess by flipping the
xtick.direction parameter and looking again. So subtracting the
marker from 5 flips the direction.

I wonder how this is done in Matlab?

    label: any string

which shows me that the Yaxis has a label - in this case a
string - but I do not see how one can set the font properties
for the Yaxis label as it is not Text object??

I think you cannot do this with setp alone. Use the ylabel command:

     ylabel('foo bar', fontsize=18)

···

--
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

--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.

CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html

CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html

For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
CallCentre@...1230...

This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.