[Matplotlib-users] move xaxis label on the right

2010-09-28 Thread Ruggero
As in the title: usually axis label on the x axis is plottet in the
middle of the axis. How to move it on the right? (and on the top for y
axis)

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] move xaxis label on the right

2010-09-28 Thread John Hunter
On Tue, Sep 28, 2010 at 10:04 AM, Ruggero giurr...@gmail.com wrote:
 As in the title: usually axis label on the x axis is plottet in the
 middle of the axis. How to move it on the right? (and on the top for y
 axis)

You cannot coerce the xlabel to the top because it's y position is
determined at drawtime to avoid overlapping the tick labels.  But you
can place an arbitrary piece of text up there

 text(1.0, 1.02, 'testing', horizontalalignment='right',
verticalalignment='bottom', fontsize=14)

See also

  http://matplotlib.sourceforge.net/users/index_text.html

and

  http://matplotlib.sourceforge.net/examples/pylab_examples/alignment_test.html

JDH

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] move xaxis label on the right

2010-09-28 Thread John Hunter
On Tue, Sep 28, 2010 at 11:29 AM, John Hunter jdh2...@gmail.com wrote:
 On Tue, Sep 28, 2010 at 10:04 AM, Ruggero giurr...@gmail.com wrote:
 As in the title: usually axis label on the x axis is plottet in the
 middle of the axis. How to move it on the right? (and on the top for y
 axis)

 You cannot coerce the xlabel to the top because it's y position is
 determined at drawtime to avoid overlapping the tick labels.  But you
 can place an arbitrary piece of text up there

  text(1.0, 1.02, 'testing', horizontalalignment='right',
 verticalalignment='bottom', fontsize=14)

Oops, forgot to set the transform.  That should read

text(1.0, 1.02, 'testing', horizontalalignment='right',
verticalalignment='bottom',
  fontsize=14, transform=ax.transAxes)

For more on transforms and the various coordinate systems, see

http://matplotlib.sourceforge.net/users/transforms_tutorial.html

JDH

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] move xaxis label on the right

2010-09-28 Thread Ruggero
2010/9/28 John Hunter jdh2...@gmail.com:
 On Tue, Sep 28, 2010 at 10:04 AM, Ruggero giurr...@gmail.com wrote:
 As in the title: usually axis label on the x axis is plottet in the
 middle of the axis. How to move it on the right? (and on the top for y
 axis)

 You cannot coerce the xlabel to the top because it's y position is
 determined at drawtime to avoid overlapping the tick labels.  But you
 can place an arbitrary piece of text up there

  text(1.0, 1.02, 'testing', horizontalalignment='right',
 verticalalignment='bottom', fontsize=14)

 See also

  http://matplotlib.sourceforge.net/users/index_text.html

 and

  http://matplotlib.sourceforge.net/examples/pylab_examples/alignment_test.html

 JDH


really there is no way to place the xlabel on the right as here:
http://www.cernlove.org/blog/wp-content/uploads/2009/10/root_plot1d.png  ?

I don't want to edit the y position of x label, I want to modify the x
position of x label and the y position of y label

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] move xaxis label on the right

2010-09-28 Thread Benjamin Root
On Tue, Sep 28, 2010 at 2:10 PM, Ruggero giurr...@gmail.com wrote:

 2010/9/28 John Hunter jdh2...@gmail.com:
  On Tue, Sep 28, 2010 at 10:04 AM, Ruggero giurr...@gmail.com wrote:
  As in the title: usually axis label on the x axis is plottet in the
  middle of the axis. How to move it on the right? (and on the top for y
  axis)
 
  You cannot coerce the xlabel to the top because it's y position is
  determined at drawtime to avoid overlapping the tick labels.  But you
  can place an arbitrary piece of text up there
 
   text(1.0, 1.02, 'testing', horizontalalignment='right',
  verticalalignment='bottom', fontsize=14)
 
  See also
 
   http://matplotlib.sourceforge.net/users/index_text.html
 
  and
 
 
 http://matplotlib.sourceforge.net/examples/pylab_examples/alignment_test.html
 
  JDH
 

 really there is no way to place the xlabel on the right as here:
 http://www.cernlove.org/blog/wp-content/uploads/2009/10/root_plot1d.png  ?

 I don't want to edit the y position of x label, I want to modify the x
 position of x label and the y position of y label


Yes, there is...

When calling .set_xlabel(), you can specify the x coordinate of the label
(in units of percentage of the axis width) without naming the y coordinate
(that will be set automatically).   You might have to fiddle with the 'ha'
(horizontalalignment) keyword (choices are 'center', 'left', 'right') in
order to align your text relative to the coordinate you choose.

ex:
ax.set_xlabel('Time (s)', x=0.95, ha='right')

You can do the same thing with the 'y' keyword in .set_ylabel().  Instead of
'ha', you use 'va' (verticalalignment) in that case (choices: 'top',
'bottom', 'center', 'baseline').

Maybe we should add an example into the documentation for set_xlabel() and
set_ylabel()?  I can see this as a reasonable enough feature for some to
want to seek out.

Ben Root

P.S. - I just noticed that the axis label 'remembers' the keyword properties
that were used in previous calls to set_?label() on that axis.  In other
words, if at one point I specify that the ylabel should be at y=0.25 and
then in a subsequent call to set_ylabel(), I don't specify anything at all,
the previous value is used rather than the default.

Don't know if that is a feature or a bug, but this kind of thing would be
more obvious as matplotlib becomes more interactive.  At the least, it
probably should be documented in some way.
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] move xaxis label on the right

2010-09-28 Thread John Hunter
On Tue, Sep 28, 2010 at 2:10 PM, Ruggero giurr...@gmail.com wrote:

 really there is no way to place the xlabel on the right as here:
 http://www.cernlove.org/blog/wp-content/uploads/2009/10/root_plot1d.png  ?


Sorry, I misread the meaning of and on the top for y axis.  As Ben
noted, if all you want to do is move the x-alignment, you can pass
horizontalalignment to the xlabel command.

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] move xaxis label on the right

2010-09-28 Thread Benjamin Root
On Tue, Sep 28, 2010 at 3:05 PM, John Hunter jdh2...@gmail.com wrote:

 On Tue, Sep 28, 2010 at 2:10 PM, Ruggero giurr...@gmail.com wrote:

  really there is no way to place the xlabel on the right as here:
  http://www.cernlove.org/blog/wp-content/uploads/2009/10/root_plot1d.png ?


 Sorry, I misread the meaning of and on the top for y axis.  As Ben
 noted, if all you want to do is move the x-alignment, you can pass
 horizontalalignment to the xlabel command.


Just to make it clear for anyone coming across this thread,
horizontalalignment alone won't do it.  'ha' only specifies the alignment
relative to the text coordinate point, which is 0.5 by default for axis
labels.  It is by specifying the x (for xlabel) or the y (for ylabel) that
will actually move the axis label in any usable fashion.

Ben Root
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fwd: Bar chart with color map

2010-09-28 Thread Sylvain Archenault
Hello,

I am generating a bar chart following the code in this example:
http://matplotlib.sourceforge.net/examples/pylab_examples/barh_demo.html.

I am wondering if it is possible to have bar with a colormap (using
http://matplotlib.sourceforge.net/examples/pylab_examples/show_colormaps.html).
The only piece of code I found close to this is this example:
http://matplotlib.sourceforge.net/examples/api/colorbar_only.html.

Thanks for your help,
Sylvain.

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Bar chart with color map

2010-09-28 Thread Sylvain Archenault
Hello,

I am generating a bar chart following the code in this example:
http://matplotlib.sourceforge.net/examples/pylab_examples/barh_demo.html.

I am wondering if it is possible to have bar with a colormap (using
http://matplotlib.sourceforge.net/examples/pylab_examples/show_colormaps.html).
The only piece of code I found close to this is this example:
http://matplotlib.sourceforge.net/examples/api/colorbar_only.html.

Thanks for your help,
Sylvain.

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] colorbar uncentered plots

2010-09-28 Thread Philip Vetter
Hello! see below for sample code.

(1) I find that the second subplot is shifted to the right.
This seems to happen generally with colorbar. How do I fix it?

(2) is there a way to clear/remove selected parts of the figure?
I am using ipython for interactive figure drawing
I find clf() will erase everything, cla() will empty the square plot,
   but I can't see how to clear the first subfigure or the colorbar.
This would be useful as any changes to the colorbar create a new one.
(uncomment the second cbar line to see this)

(3) is it possible to modify the orientation of cbar once drawn?
cbar.orientation ='horizontal'
plt.draw()
plt.show()
leaves it unchanged.

Thank you for your help!

 Here is my code: ==

#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
from time import sleep
x = np.arange(0, 10, 0.2)
y = np.sin(x)
fig = plt.figure()
ax1 = fig.add_subplot(211)
cax1 = ax1.plot(x, y)
ax2 = fig.add_subplot(212)
A = np.random.random_integers(0, 10, 100).reshape(10, 10)
cax2 = ax2.imshow(A, interpolation=nearest,vmin=-1,vmax=11 )
cbar = fig.colorbar(cax2)
#cbar = fig.colorbar(cax2, ticks=[0, 5, 10])
plt.savefig('colorbartest.pdf')

==
-- 

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users