Re: [Matplotlib-users] Getting started with bar charts

2006-08-25 Thread Derek Hohls
 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 [EMAIL PROTECTED] 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=lnkkid=120709bid=263057dat=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
[EMAIL PROTECTED]


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


-
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=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Getting started with bar charts

2006-08-23 Thread Jouni K Seppänen
[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=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Getting started with bar charts

2006-08-23 Thread Darren Dale
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?

from pylab import *

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

-
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=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Getting started with bar charts

2006-08-22 Thread Jouni K Seppanen
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=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Getting started with bar charts

2006-08-21 Thread Bill Baxter
If you can't find help anywhere else, the matlab documentaiton may be helpful.Most of the matplotlib functions are taken right from there.
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/plot.htmlhttp://www.mathworks.com/access/helpdesk/help/techdoc/ref/subplot.html
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/bar.html--bbOn 8/21/06, 
Derek Hohls [EMAIL PROTECTED] wrote:
The matplotlib philosophy is one of make easy things easy - which Itotally agree with.I am a new user of matplotlib; and a relatively new Python programmer.I am trying to produce some bar charts for a colleague, in an attempt to
show how easy it is to do this with Python/matplotlib (as opposed to theold Excel/cut-n-paste approach!).I think I have got the basics OK (two subplots), but I am strugglingwith what *I* thinkshould be trivial tasks - such as setting line
widths, font sizes, bar colours etc.The examples do not really seem todeal with these issues, and in fact the homepage implies these are for apower user, which I find strange because these are some of the first
things most users want to fiddle with!What I have done as atemporary fix is alter all the settings in the matplotprc file; but thisis not ideal as these settings affect *all* charts.It appears the manual (which I assume might be able to help me) is not
downloadable.The link :http://matplotlib.sourceforge.net/users_guide_0.87.1.pdfresults in a 2.41MB PDF file, which Acrobat Reader reports is
damaged. (I also noticed when runningthe download, that the download manager seemed to be expecting a 4.5MBfile?)The example:
http://www.scipy.org/Cookbook/Matplotlib/BarChartsshows how to setup labels for a bar chart - but it would be great ifthere was a line-by-line explanation of what each step means; its notvery clear!
The last point of mystery to me is that of plot vs subplot vsbar - are these all essentially the same family of object, with somedifferences in their capabilities - or vastly different beasts?
Any help with these newbie issues would be appreciated!ThanksDerek--
-
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=lnkkid=120709bid=263057dat=121642___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users