Jae-Joon Lee | 1 Mar 07:20
Picon
Gravatar

Re: setting font of axes ticklabels and making labels not overlap

On Sat, Feb 28, 2009 at 9:59 PM, per freem <perfreem <at> gmail.com> wrote:
> hi Jae-Joon,
>
> thanks again, that makes sense.
>
> final question on this plot - i am trying to plot what we discussed but am
> getting very strange results.
>
> all i am trying to do is produce a scatter plot like:
>
> http://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/ch923/r_introduction/scatter_plots/scatter.png
>
> where the key feature is that the first x tick and first y tick are not at
> the origin but spaced a bit away from it (and both equally spaced from it)
> and similarly for the last x and last y tick (which should be a bit before
> the end of the x and y axes.)
>
> if i plot on linux, i get the pdf attached as linux.pdf. if i plot on mac os
> x, i get the one attached as mac.pdf. aside from the differences in fonts,
> the linux pdf is lower quality where the ticks and the surrounding box of
> the plot have different thicknesses, which make the graph look strange.
> also, the xaxis labels are correctly spaced out from the ticks in the
> linux.pdf but not in the mac os x. overall, the mac pdf is of higher quality
> but the spacing is messed up.

Linux v.s Mac does not make much sense. What version of maplotlib do
you use in each platform? The rc file in two platform are identical?

They are both pdf files, it does not make much sense that one of them
has a higher quality. Looking at your two pdf files, the ticks in
(Continue reading)

Jae-Joon Lee | 1 Mar 07:35
Picon
Gravatar

Re: Rotate legend ?

I don' think these is a straight forward way to rotate the legend as a whole.
As a matter of fact, it is hardly possible with the current
implementation of the legend class. Could you explain why do you want
to have a rotated legend? An example figure (from other plotting
package) will be very helpful. If a rotated legend is desirable, I'll
work on to support it.

Regards,

-JJ

On Sat, Feb 28, 2009 at 4:10 AM, Naoli <naoli@...> wrote:
> Hi guys,
>
> I was wondering if it's possible to rotate a legend ?
>
> Thanks for your help.
>
> Naoli
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
(Continue reading)

Naoli | 1 Mar 09:34
Favicon

Re: Rotate legend ?

Hi,

thanks for the answer. That's what I thought.
I'm using a bar chart plot to do a Gantt Project planner (please see example). Since it's not possible to draw horizontal bars, I plot a "normal" bar chart (vertical bars) and rotate the whole figure (please see attached file), this is why I need the legend to be 90°-rotated, so that it's in the right position afterall.

Thanks for your time.

Regards.

N.


2009/3/1 Jae-Joon Lee <lee.j.joon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
I don' think these is a straight forward way to rotate the legend as a whole.
As a matter of fact, it is hardly possible with the current
implementation of the legend class. Could you explain why do you want
to have a rotated legend? An example figure (from other plotting
package) will be very helpful. If a rotated legend is desirable, I'll
work on to support it.

Regards,

-JJ


On Sat, Feb 28, 2009 at 4:10 AM, Naoli <naoli-BoOA+NLF7L6xbKUeIHjxjQ@public.gmane.org> wrote:
> Hi guys,
>
> I was wondering if it's possible to rotate a legend ?
>
> Thanks for your help.
>
> Naoli
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
per freem | 1 Mar 17:41
Picon

dynamically creating then plotting arrays

hi all,

i am reading a set of tab-separated data from a file and i want to put it into an array, and then plot some of the columns. i know the number of columns ahead of time but not the number of rows. i load the array from the file as follows, which seems to work:

data = []
for line in myfile:
  field1, field2, field3 = line.strip().split('\t')
  data.append([int(field1), int(field2), int(field3)])

i then convert it into an array as follows:

data = array(data)

i am able to reference the first column as follows:

data[:,0]

but if i try to plot the first column against the second as follows:

bar(data[:,0],data[:,1])

then i get the error:

/usr/lib64/python2.5/site-packages/matplotlib/units.pyc in get_converter(self, x)
    128             converter = self.get(classx)
    129
--> 130         if converter is None and iterable(x):
    131             # if this is anything but an object array, we'll assume
    132             # there are no custom units

[repeated many times]

RuntimeError: maximum recursion depth exceeded
WARNING: Failure executing file: <myfile.py>

how can i fix this? i'd like an n-by-m representation of my data as an array which i can reference like a matrix in matlab. some of the columns are floats, other are ints, and others are strings, so i prefer to load the data into an array as a loop where i can cast the strings appropriately, rather than use some built in io function for reading tab-separated data.

thank you very much.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
per freem | 1 Mar 18:25
Picon

Re: dynamically creating then plotting arrays

hi all,

please disregard the previous email - i had a mistake in my file that did not do the casting properly when loading the data.

i managed to plot my data, but this time i am having a problem with the 'bar' function.

when i plot using:

x = data[:, 0]
y = data[:, 1]
bar(x,y)

i get the attached figure. the bar graphs are way too thin and don't look like bar graphs at all. i see in the gallery many examples of bars with greater width, e.g. http://matplotlib.sourceforge.net/examples/api/histogram_demo.html

but all of these seem to be made using the 'hist' function. i just want the bar width to be greater. my setting of the width= does not make a difference, it treats:

bar(x,y,width=1.5)
bar(x,y,width=10)
etc.

as the same, yielding this line plot. if i remove some data points (and plot x and y's that are only, say, 3 in length) then the bars look normal.

how can i make the bar widths greater in this case?

On Sun, Mar 1, 2009 at 11:41 AM, per freem <perfreem <at> gmail.com> wrote:
hi all,

i am reading a set of tab-separated data from a file and i want to put it into an array, and then plot some of the columns. i know the number of columns ahead of time but not the number of rows. i load the array from the file as follows, which seems to work:

data = []
for line in myfile:
  field1, field2, field3 = line.strip().split('\t')
  data.append([int(field1), int(field2), int(field3)])

i then convert it into an array as follows:

data = array(data)

i am able to reference the first column as follows:

data[:,0]

but if i try to plot the first column against the second as follows:

bar(data[:,0],data[:,1])

then i get the error:

/usr/lib64/python2.5/site-packages/matplotlib/units.pyc in get_converter(self, x)
    128             converter = self.get(classx)
    129
--> 130         if converter is None and iterable(x):
    131             # if this is anything but an object array, we'll assume
    132             # there are no custom units

[repeated many times]

RuntimeError: maximum recursion depth exceeded
WARNING: Failure executing file: <myfile.py>

how can i fix this? i'd like an n-by-m representation of my data as an array which i can reference like a matrix in matlab. some of the columns are floats, other are ints, and others are strings, so i prefer to load the data into an array as a loop where i can cast the strings appropriately, rather than use some built in io function for reading tab-separated data.

thank you very much.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Jae-Joon Lee | 1 Mar 19:54
Picon
Gravatar

Re: Rotate legend ?

Horizontal bar is possible, although i'm not sure it fits your need.

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

Anyhow, with the current mpl, I guess it is much easy to make the
horizontal bars with rectangle patches (in case barh does not do what
you want), rather than trying to rotate the legend.

-JJ

On Sun, Mar 1, 2009 at 3:34 AM, Naoli <naoli <at> tuxfamily.org> wrote:
> Hi,
>
> thanks for the answer. That's what I thought.
> I'm using a bar chart plot to do a Gantt Project planner (please see
> example). Since it's not possible to draw horizontal bars, I plot a "normal"
> bar chart (vertical bars) and rotate the whole figure (please see attached
> file), this is why I need the legend to be 90°-rotated, so that it's in the
> right position afterall.
>
> Thanks for your time.
>
> Regards.
>
> N.
>
>
> 2009/3/1 Jae-Joon Lee <lee.j.joon <at> gmail.com>
>>
>> I don' think these is a straight forward way to rotate the legend as a
>> whole.
>> As a matter of fact, it is hardly possible with the current
>> implementation of the legend class. Could you explain why do you want
>> to have a rotated legend? An example figure (from other plotting
>> package) will be very helpful. If a rotated legend is desirable, I'll
>> work on to support it.
>>
>> Regards,
>>
>> -JJ
>>
>>
>> On Sat, Feb 28, 2009 at 4:10 AM, Naoli <naoli <at> tuxfamily.org> wrote:
>> > Hi guys,
>> >
>> > I was wondering if it's possible to rotate a legend ?
>> >
>> > Thanks for your help.
>> >
>> > Naoli
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Open Source Business Conference (OSBC), March 24-25, 2009, San
>> > Francisco, CA
>> > -OSBC tackles the biggest issue in open source: Open Sourcing the
>> > Enterprise
>> > -Strategies to boost innovation and cut costs with open source
>> > participation
>> > -Receive a $600 discount off the registration fee with the source code:
>> > SFAD
>> > http://p.sf.net/sfu/XcvMzF8H
>> > _______________________________________________
>> > Matplotlib-users mailing list
>> > Matplotlib-users <at> lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> >
>> >
>
>

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Eric Firing | 1 Mar 21:20
Favicon
Gravatar

Re: dynamically creating then plotting arrays

per freem wrote:
> hi all,
> 
> please disregard the previous email - i had a mistake in my file that 
> did not do the casting properly when loading the data.
> 
> i managed to plot my data, but this time i am having a problem with the 
> 'bar' function.
> 
> when i plot using:
> 
> x = data[:, 0]
> y = data[:, 1]
> bar(x,y)
> 
> i get the attached figure. the bar graphs are way too thin and don't 
> look like bar graphs at all. i see in the gallery many examples of bars 
> with greater width, e.g. 
> http://matplotlib.sourceforge.net/examples/api/histogram_demo.html
> 
> but all of these seem to be made using the 'hist' function. i just want 
> the bar width to be greater. my setting of the width= does not make a 
> difference, it treats:
> 
> bar(x,y,width=1.5)
> bar(x,y,width=10)
> etc.

Width is in the same units as x, and it looks like your range of x 
values is 1e8, so maybe your width needs to be something like 1e7, not 10.

Eric
> 
> as the same, yielding this line plot. if i remove some data points (and 
> plot x and y's that are only, say, 3 in length) then the bars look normal.
> 
> how can i make the bar widths greater in this case?
> 
> On Sun, Mar 1, 2009 at 11:41 AM, per freem <perfreem@... 
> <mailto:perfreem@...>> wrote:
> 
>     hi all,
> 
>     i am reading a set of tab-separated data from a file and i want to
>     put it into an array, and then plot some of the columns. i know the
>     number of columns ahead of time but not the number of rows. i load
>     the array from the file as follows, which seems to work:
> 
>     data = []
>     for line in myfile:
>       field1, field2, field3 = line.strip().split('\t')
>       data.append([int(field1), int(field2), int(field3)])
> 
>     i then convert it into an array as follows:
> 
>     data = array(data)
> 
>     i am able to reference the first column as follows:
> 
>     data[:,0]
> 
>     but if i try to plot the first column against the second as follows:
> 
>     bar(data[:,0],data[:,1])
> 
>     then i get the error:
> 
>     /usr/lib64/python2.5/site-packages/matplotlib/units.pyc in
>     get_converter(self, x)
>         128             converter = self.get(classx)
>         129
>     --> 130         if converter is None and iterable(x):
>         131             # if this is anything but an object array, we'll
>     assume
>         132             # there are no custom units
> 
>     [repeated many times]
> 
>     RuntimeError: maximum recursion depth exceeded
>     WARNING: Failure executing file: <myfile.py>
> 
>     how can i fix this? i'd like an n-by-m representation of my data as
>     an array which i can reference like a matrix in matlab. some of the
>     columns are floats, other are ints, and others are strings, so i
>     prefer to load the data into an array as a loop where i can cast the
>     strings appropriately, rather than use some built in io function for
>     reading tab-separated data.
> 
>     thank you very much.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
per freem | 2 Mar 00:32
Picon

making (very simple) Venn diagrams?

hi all,

can someone advise on how to make simple venn diagrams, like the one here:

http://en.wikipedia.org/wiki/File:Venn_diagram_cmyk.svg

simply three (or more) intersecting circles, such that one can label every point of their intersection, and maybe make the circles in size proportion to the number of elements they are supposed to represent.  i know some people use Sage for this but i prefer to use matplotlib directly.

any help / info on how to get started on this or some example code would be greatly appreciated.

thank you.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Simson Garfinkel | 2 Mar 04:12
Picon
Favicon

interactive graphs

Greetings.

I have a colleague who I have worked hard to convert from matlab to  
matplotlib.

One issue that has come up is clickable graphs. He would like to be  
able to click on the graphs that matplotlib produces and actually have  
things happen. For example:

* Display information about a histogram, like the values that went  
into the bin.
* Have a callback called with information about where the click took  
place.

Is there any way to do this?

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
Simson Garfinkel | 2 Mar 04:13
Picon
Favicon

to zip or not to zip - that is the question

In working on code for matplotlib, I would generally find it easier to  
provide an array of objects than to provide an array of X values and a  
second array of Y values. I understand that X[] and Y[] is the way  
that matlab does it, but we would find it easier to provide an array  
of either tuples  [(x1,y1), (x2,y2), ...]  or else an array of objects  
with .x and .y properties.

Other than doing our own cover, is there any other way to do this? Any  
thoughts of adding this functionality?

-Simson

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H

Gmane