mfabulous | 1 Feb 11:27
Picon

Yaxis labels in plots with no vspacing


Hello,

I apologize if this was asked earlier.

I have following problem: I am creating multi panaled plots with share
xaxis.
It became common in publications to plot such plots without vspacing, so
that
they tough each other ( I attached a pdf 
http://www.nabble.com/file/p21773509/bN3368MJ_zhlnHD72324.pdf
bN3368MJ_zhlnHD72324.pdf 
to clearify the situation.).

In such plots the bottom and uppermost yaxis labels will overlap. I tried a
dirty hack to
overcome this problem, but this does not always produce nice results. Is
there a general solution?

Regards,

Maximilian 
--

-- 
View this message in context: http://www.nabble.com/Yaxis-labels-in-plots-with-no-vspacing-tp21773509p21773509.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
(Continue reading)

Jouni K. Seppänen | 1 Feb 15:58
Face
Picon
Picon
Picon
Favicon
Gravatar

Re: Change Hue-Range in HSV color map

KarlBlau <mailsgetlost@...> writes:

> I would like to change the hue range of the hsv color map to use only hue
> values between 0 and 0.6667. I checked the documentation of matplotlib and
> searched in the internet but couldn't find the answer.

There doesn't seem to be any predefined functionality for this. The
easiest way to achieve this is probably just to take the definition of
hsv from _cm.py and modify it a little:

data = {'red':   ((0., 1., 1.),(0.158730, 1.000000, 1.000000),
                  (0.174603, 0.968750, 0.968750),(0.333333, 0.031250, 0.031250),
                  (0.349206, 0.000000, 0.000000),(0.666667, 0.000000, 0.000000)),
        'green': ((0., 0., 0.),(0.158730, 0.937500, 0.937500),
                  (0.174603, 1.000000, 1.000000),(0.507937, 1.000000, 1.000000),
                  (0.666667, 0.062500, 0.062500)),
        'blue':  ((0., 0., 0.),(0.333333, 0.000000, 0.000000),
                  (0.349206, 0.062500, 0.062500),(0.507937, 1.000000, 1.000000),
                  (0.666667, 1.000000, 1.000000))}
for k,v in data.items():
    data[k] = [(a/0.666667, b, c) for (a,b,c) in v]
myhsv = matplotlib.colors.LinearSegmentedColormap('myhsv', data)

--

-- 
Jouni K. Seppänen
http://www.iki.fi/jks

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
(Continue reading)

Eli Bressert | 1 Feb 18:41
Picon

ticks in Matplotlib

Hi,

I'm looking into customizing the the tick positions on an imshow plot. I 
found that you can do this by doing

img = imshow(data)
img.ax.xaxis.set_ticks([100.,200.])

The problem with this method is that it moves the tick positions on the 
bottom and top x axis. What if I wanted to do have the top axes show 
ticks at slightly different positions than the bottom one? Any ideas or 
suggestions would be greatly appreciated

-Eli

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
Sandro Tosi | 1 Feb 23:59
Picon
Favicon

Re: What would you like to see in a book about Matplotlib?

Hi Chris,
thanks for your reply, helpful as usual :)

On Fri, Jan 30, 2009 at 18:59, Chris Walker
<chrisw@...> wrote:
>       Firstly, good luck with the book.

cheers :)

> The sort of book I'd buy would explain how to use the combination of
> matplotlib/ipython/scipy/numpy to analyse data.

Sadly, that would not the book I'll write :( The editor wanted to
target another audience for the book: experienced python developers,
with no knowledge of matplotlib; so an introductionary book, that will
show even how to integrate mpl on GTK/WX application and on the web.

I pushed to have something about science, and a chapter will be about
that, but I need your (all) inputs, because my science days are long
back in the past ;)

>> - what are the (basic) things that, when you were beginning to use
>> matplotlib, you wanted to see grouped up but couldn't find?
>> - what would you like to see in a book about matplotlib?
>
> Start off by reading data from a file, plotting it and fitting a
> function to that data.

That sounds something that could land in the "science" chapter.

(Continue reading)

Jae-Joon Lee | 2 Feb 05:58
Picon
Gravatar

Re: ticks in Matplotlib

You cannot set different tick positions for bottom and top x-axis in
the same axes.
What you can do is to make another axes at the same location and use
it to draw ticks at top.
Take a look at

http://matplotlib.sourceforge.net/examples/api/two_scales.html

But it may not be an ideal solution for you as this enforces
adjustable="datalim".

You may try to use my custom axes class.

http://dl.getdropbox.com/u/178748/mpl/parasite_axes2.py

import matplotlib.pyplot as plt
import numpy as np

from parasite_axes2 import SubplotHost

fig = plt.gcf()
ax = SubplotHost(fig, 1, 1, 1)
fig.add_subplot(ax)
Z = np.arange(100).reshape(10,10)
im = ax.imshow(Z)

ax2 = ax.twin()

ax2.set_xticks([0, 3, 6, 9])
ax2.set_yticks([1,3,5,7,9])
(Continue reading)

Lionel Roubeyrie | 2 Feb 09:26
Picon
Favicon

Re: contour coordinates

Hi all,
just a little question : how matplotlib computes contours? Is it based
on an internal library? Is it possible to access it from outside?
Thanks

Le vendredi 30 janvier 2009 à 10:22 -0500, Eli Brosh a écrit :
> Hello again,
> I finally found the command I was looking for. It is the
> to_polygons().
> Here is what worked :
> 
> # make a LineCollection of contours
> col=contour(X,Y,Z,LevelsNumber).collections
> 
> 
> for i in np.arange(0,LevelsNumber,1):
>     polygoni=col[i].get_paths()[0].to_polygons()[0]
>     print polygoni
> 
> All the vertices in each collections are extracted to the "polygoni".
> 
> Thanks again to Jeff and Patrick !
> 
> By the way, I found out that I do not actually need this procedure to
> achieve may goal 
> which was to make a contour plot in ternary coordinates.
> 
> Eli
> 
> 
(Continue reading)

Ramashish Baranwal | 2 Feb 13:33
Picon

x-axis line in bar plots

Hi,

I am creating a bar graph which contains negative values on y-axis.
Everything is fine, but there is no line corresponding to y=0, so the
bars seem a bit weird. Here is a short example-

x = range(10)
y = [random.randint(-10, 10) for i in x]
bar(x, y)

What I want is a line to be drawn at y=0. Any idea how to get it done?
Apologies if this has been asked before. I searched but couldn't find
a way.

Thanks,
Ram

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
Michael Droettboom | 2 Feb 14:28

Re: contour coordinates

matplotlib uses some C-based contouring code that began life in GIST.  
You can see it here:

http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/src/cntr.c?revision=5781&view=markup

It has some limitations, notably around certain donut-shaped contours, 
and a number of us have made attempts to improve it or replace it with 
something else suitably licensed, but that's the best we've been able to 
do for now.

Mike

Lionel Roubeyrie wrote:
> Hi all,
> just a little question : how matplotlib computes contours? Is it based
> on an internal library? Is it possible to access it from outside?
> Thanks
>
> Le vendredi 30 janvier 2009 à 10:22 -0500, Eli Brosh a écrit :
>   
>> Hello again,
>> I finally found the command I was looking for. It is the
>> to_polygons().
>> Here is what worked :
>>
>> # make a LineCollection of contours
>> col=contour(X,Y,Z,LevelsNumber).collections
>>
>>
>> for i in np.arange(0,LevelsNumber,1):
(Continue reading)

Jouni K. Seppänen | 2 Feb 14:38
Face
Picon
Picon
Picon
Favicon
Gravatar

Re: x-axis line in bar plots

Ramashish Baranwal <ramashish.lists@...> writes:

> x = range(10)
> y = [random.randint(-10, 10) for i in x]
> bar(x, y)
>
> What I want is a line to be drawn at y=0. Any idea how to get it done?

How about axhline:

  axhline(color='k', lw=1)

See the documentation of axhline (and hlines) for more.

--

-- 
Jouni K. Seppänen
http://www.iki.fi/jks

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
Chris Walker | 2 Feb 16:47
Picon

Re: What would you like to see in a book about Matplotlib?

On Sun, Feb 01, 2009 at 11:59:06PM +0100, Sandro Tosi wrote:
> Hi Chris,
> thanks for your reply, helpful as usual :)
> 
> On Fri, Jan 30, 2009 at 18:59, Chris Walker
> <chrisw@...> wrote:
> >       Firstly, good luck with the book.
> 
> cheers :)
> 
> > The sort of book I'd buy would explain how to use the combination of
> > matplotlib/ipython/scipy/numpy to analyse data.
> 
> Sadly, that would not the book I'll write :( The editor wanted to
> target another audience for the book: experienced python developers,
> with no knowledge of matplotlib; so an introductionary book, that will
> show even how to integrate mpl on GTK/WX application and on the web.
> 
> I pushed to have something about science, and a chapter will be about
> that, but I need your (all) inputs, because my science days are long
> back in the past ;)

Sure - though anyone wanting to use matplotlib is likely to be
acquiring, manipulating and then plotting data. 

> 
> >> - what are the (basic) things that, when you were beginning to use
> >> matplotlib, you wanted to see grouped up but couldn't find?
> >> - what would you like to see in a book about matplotlib?
> >
(Continue reading)


Gmane