You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
| 2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
| 2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
| 2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
| 2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
| 2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
| 2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
| 2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
| 2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
| 2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
| 2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
| 2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
| 2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
| 2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
(8) |
2
(14) |
3
(22) |
4
(13) |
5
(11) |
6
(12) |
7
(4) |
|
8
(6) |
9
(19) |
10
(14) |
11
(16) |
12
(6) |
13
(15) |
14
(6) |
|
15
(8) |
16
(22) |
17
(17) |
18
(8) |
19
(16) |
20
(19) |
21
(3) |
|
22
(6) |
23
(18) |
24
(26) |
25
(17) |
26
(13) |
27
(18) |
28
(8) |
|
29
|
30
(14) |
31
(30) |
|
|
|
|
|
From: Peter S. <pet...@gm...> - 2009-03-02 23:59:25
|
Is there any way to encode 2 variables in a matplotlib colormap? The idea is to replicate this dataspora R scatterplot in matplotlib: http://www.dataspora.com/gameday/pitcher/daisuke-matsuzaka/493137 "The bottom strip of charts encode two dimensions with color -- blue or red hue indicates pitch velocity -- while the lightness or darkness of the hue indicates how many pitches were thrown in a given region. " -- Peter N. Skomoroch 617.285.8348 http://www.datawrangling.com http://delicious.com/pskomoroch http://twitter.com/peteskomoroch |
|
From: hazelnusse <haz...@gm...> - 2009-03-02 22:26:40
|
I am generating level curves numerically with a gradient method of my own recipe. The result is a bunch of 100x2 vectors, each 'row' of which is a point on a level curve in the plane. My goal is to label each plot line analogously to how contour lines are labelled with clabel. Is this possible? If so, does anybody know how or have some example code? Thanks, ~Luke -- View this message in context: http://www.nabble.com/Label-plot-lines-analogously-to-clabel-tp22295292p22295292.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Jeff W. <js...@fa...> - 2009-03-02 21:39:28
|
Jose Gomez-Dans wrote: > Hi! > > [I think the message didn't get through the first time I sent it. > Resending, and apologies if you get it twice] > > I have a rather complex basemap-derived plot that I want to save as > animation. > In essence, it uses the blumarble() to add a nice background, plots some > stuff on top of that, and also has an inset with a map of the world that > shows the area of the main map. > > The problem is that memory usage as I iterate through the frames that will > eventually make up my animation, rises very fast. I read a post some > time ago > on how to store the background, so it didn't have to be recreated > everytime > here: > <http://www.nabble.com/Save-a-plot-background-to20519596.html#a20519596> > > There's an example on how to actually do this for basemaps from J > Whitaker, > but I can't get this to work on my example. Ideally, I would like to store > the inset in a function, and my main background in another function, and > restore each axis directly. My attempt follows (which produces a blank > image) > is at <http://pastebin.com/f4636fd7f> > > Many thanks! > Jose Jose: I think the key is to only create the basemap instance only once (for the main plot and for the inset), then re-use that basemap instance each time you create an animation frame. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: Jeffrey F. <mat...@je...> - 2009-03-02 20:56:06
|
I just upgraded from 0.98.3 to 0.98.5.2 on my Mac (OS X 10.4.11) because I wanted some of the new legend features, and now have two strange errors. 1) When I run a script that creates a plot, the terminal window (either a command prompt or ipython) is now frozen until I have closed the plot window. Previously, this same script would create the plot, but then allow me to access the prompt. 2) I seem to no longer be able to zoom in or out on the plots. Additionally, with 0.98.3 I used to be able to dynamically move the plots (I would see the figure move as I dragged it), but now the plot doesn't move until after I've released the mouse button, making it harder to see how far I've moved it. I've noticed that my old backend was 'TkAgg', while 0.98.5.2 defaults to 'MacOSX'. I've tried running matplotlib.rcParams['backend'] = 'TkAgg' at the top of my script, but that doesn't seem to do anything (I have the same problems). Does anyone have any idea what's happening or how I can fix these problems? If not I may need to go back to 0.98.3 for now. Thanks. -Jeffrey |
|
From: Jose Gomez-D. <jgo...@gm...> - 2009-03-02 20:12:14
|
Hi! [I think the message didn't get through the first time I sent it. Resending, and apologies if you get it twice] I have a rather complex basemap-derived plot that I want to save as animation. In essence, it uses the blumarble() to add a nice background, plots some stuff on top of that, and also has an inset with a map of the world that shows the area of the main map. The problem is that memory usage as I iterate through the frames that will eventually make up my animation, rises very fast. I read a post some time ago on how to store the background, so it didn't have to be recreated everytime here: <http://www.nabble.com/Save-a-plot-background-to20519596.html#a20519596> There's an example on how to actually do this for basemaps from J Whitaker, but I can't get this to work on my example. Ideally, I would like to store the inset in a function, and my main background in another function, and restore each axis directly. My attempt follows (which produces a blank image) is at <http://pastebin.com/f4636fd7f> Many thanks! Jose |
|
From: Jose Gómez-D. <jgo...@gm...> - 2009-03-02 19:57:58
|
Hi! I have a rather complex basemap-derived plot that I want to save as animation. In essence, it uses the blumarble() to add a nice background, plots some stuff on top of that, and also has an inset with a map of the world that shows the area of the main map. The problem is that memory usage as I iterate through the frames that will eventually make up my animation, rises very fast. I read a post some time ago on how to store the background, so it didn't have to be recreated everytime here: <http://www.nabble.com/Save-a-plot-background-to20519596.html#a20519596> There's an example on how to actually do this for basemaps from J Whitaker, but I can't get this to work on my example. Ideally, I would like to store the inset in a function, and my main background in another function, and restore each axis directly. My attempt follows (which produces a blank image) is at <http://pastebin.com/f4636fd7f> Many thanks! Jose |
|
From: Ryan M. <rm...@gm...> - 2009-03-02 19:36:30
|
On Sat, Feb 28, 2009 at 1:23 PM, per freem <per...@gm...> wrote:
> hi all,
>
> two quick questions about plotting: i am trying to very simply reset the
> font family to be 'helvetica' for my figure, in particular for the
> ticklabels. i have tried using the following:
>
> def axes_square(plot_handle):
> plot_handle.axes.set_aspect(1/plot_handle.axes.get_data_ratio())
>
> rcParams['font.family'] = 'Helvetica'
> p = matplotlib.font_manager.FontProperties()
> p.set_family('Helvetica')
> x = rand(20)
> ax = plot(x, x, 'bo', markeredgecolor='blue', mfc='none')
> axes_square(p)
>
Unrelated to your original question, is there a reason you need axes_square
there and can't just use:
ax.set_aspect('equal')
?
Ryan
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from: Norman Oklahoma United States.
|
|
From: Jonathan T. <jon...@ut...> - 2009-03-02 18:50:38
|
Try this: from matplotlib import pyplot as plt from matplotlib.patches import Circle f = plt.figure() ax = f.gca() rad = 1.4 c1 = Circle((-1,0),rad, alpha=.2, fc ='red') c2 = Circle((1,0),rad, alpha=.2, fc ='blue') c3 = Circle((0,1),rad, alpha=.2, fc ='green') ax.add_patch(c1) ax.add_patch(c2) ax.add_patch(c3) ax.set_xlim(-3,3) ax.set_ylim(-3,3) plt.show() J. On Sun, Mar 1, 2009 at 6:32 PM, per freem <per...@gm...> wrote: > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Naoli <na...@tu...> - 2009-03-02 12:50:40
|
Such a shame... Anyway, I'm glad to learn horizontal bars are possible, I'll try it. Thanks for your answers. Naoli 2009/3/1 Jae-Joon Lee <lee...@gm...> > 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 <na...@tu...> 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...@gm...> > >> > >> 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 <na...@tu...> 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 > >> > Mat...@li... > >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >> > > >> > > > > > > |
|
From: Eric F. <ef...@ha...> - 2009-03-02 04:37:34
|
Simson Garfinkel wrote: > 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? Internally, we often do end up using Nx2 ndarrays. I don't think it makes sense to complicate the API by directly supporting other function signatures, however, if this is what you are proposing. For example, we have plot(y) and plot(x,y); to support either of the alternatives you mention above would require either a kwarg or a different function name. Personally, I would rather leave it to the user to take care of this as needed, and keep the additional complexity out of matplotlib. Eric > > -Simson > |
|
From: Eric F. <ef...@ha...> - 2009-03-02 04:28:20
|
Simson Garfinkel wrote: > 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? Yes. To begin, see examples/event_handling/pick_event_demo.py and pick_event_demo2.py. On the web, the code is here: http://matplotlib.sourceforge.net/examples/event_handling/index.html Eric |
|
From: Simson G. <si...@ac...> - 2009-03-02 03:14:04
|
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 |
|
From: Simson G. <si...@ac...> - 2009-03-02 03:12:11
|
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? |
|
From: per f. <per...@gm...> - 2009-03-01 23:32:28
|
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. |
|
From: Eric F. <ef...@ha...> - 2009-03-01 20:20:36
|
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 <per...@gm... > <mailto:per...@gm...>> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Jae-Joon L. <lee...@gm...> - 2009-03-01 18:54:28
|
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 <na...@tu...> 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...@gm...> >> >> 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 <na...@tu...> 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 >> > Mat...@li... >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > >> > > > |
|
From: per f. <per...@gm...> - 2009-03-01 16:42:09
|
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.
|
|
From: Jae-Joon L. <lee...@gm...> - 2009-03-01 06:35:37
|
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 <na...@tu...> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Jae-Joon L. <lee...@gm...> - 2009-03-01 06:21:01
|
On Sat, Feb 28, 2009 at 9:59 PM, per freem <per...@gm...> 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 linux.pdf looks a bit more fuzzy, but as far as I can see, it seems to me as some antialising effect. If you think the tick lines are too fuzzy, you 'd better increase the width of tick lines. rcParams["lines.markeredgewidth"]=1. # default is 0.5 > > how can i make the mac os x version space correctly, and make the linux > version better looking? I don't think there is nothing wrong with the mac version. But see below. Again, if you think the tick lines are too fuzzy, increase the line width. > > the code is simply: > > def axes_square(plot_handle): > plot_handle.axes.set_aspect(1/plot_handle.axes.get_data_ratio()) > > fig = figure() > rcParams['xtick.direction'] = 'out' > rcParams['ytick.direction'] = 'out' > s = subplot(1,3,1) > x = arange(0,1,.01) > y = arange(0,1,.01)+rand(100) > axes_square(s) > > s = subplot(111) > ax = plot(x, y, 'bo', markeredgecolor='blue', mfc='none') > > xlim(-.05,1,1.05) > ylim(-.05,1,1.05) Are the linux.pdf and mac.pdf created with a same script? The linux one seems to have xrange of -0.05~1.05 while the mac one has x-range of -0.05~1. And according to your script, it should be -0.05~1. What do you intend to do by "xlim(-0.05, 1, 1.05)"? Why you a third arguments? (I don't think you mean to set emit=True by this). Maybe you just wanted "xlim(-0.05, 1.05)"? -JJ ps. I'm CC-ing this email to the list. Please CC to the list when you reply so that the conversation stays on the mailing list. > > savefig('filename.pdf') > > (so the only variability is the random vectors plotted) > > thanks again. >> >> >> On Sat, Feb 28, 2009 at 6:22 PM, per freem <per...@gm...> wrote: >> > hi, >> > >> > that code snippet works but it does not change the font. changing it to: >> > >> > def my_hash(self): >> > l = ['Courier', >> > self.get_style(), >> > self.get_variant(), >> > self.get_weight(), >> > self.get_stretch(), >> > self.get_size()] >> > >> > return hash(repr(l)) >> > fp = FontProperties(family="Lucida Sans Typewriter") >> > fp.__hash__ = my_hash >> > >> > runs, but does not change the font either. >> > >> > would be very interested if you have any other ideas? thanks. >> > >> > >> > >> > >> > On Sat, Feb 28, 2009 at 6:04 PM, Jae-Joon Lee <lee...@gm...> >> > wrote: >> >> >> >> On Sat, Feb 28, 2009 at 5:31 PM, per freem <per...@gm...> wrote: >> >> > thank you for your reply. when i try either of the first suggestions >> >> > about >> >> > changing the fonts, i get the error: >> >> > >> >> > AttributeError: 'FontProperties' object has no attribute 'get_slant' >> >> > >> >> > any idea what this means? >> >> >> >> It seems that you're using v0.98.3 or before. See if following code >> >> works. >> >> >> >> from matplotlib.font_manager import FontProperties >> >> >> >> def my_hash(self): >> >> l = [self.get_family(), >> >> self.get_style(), >> >> self.get_variant(), >> >> self.get_weight(), >> >> self.get_stretch(), >> >> self.get_size()] >> >> >> >> return hash(repr(l)) >> >> >> >> FontProperties.__hash__ = my_hash >> >> >> >> >> >> >> >> > >> >> > also, i do not mind setting the position of each tickmark >> >> > individually >> >> > but i >> >> > cannot find a way to do this -- could you please explain how this can >> >> > be >> >> > done? >> >> > >> >> >> >> >> >> >> >> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xticks >> >> >> >> >> >> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.yticks >> >> >> >> -JJ >> >> >> >> >> >> > thanks again. >> >> > >> >> > >> >> > On Sat, Feb 28, 2009 at 5:19 PM, Jae-Joon Lee <lee...@gm...> >> >> > wrote: >> >> >> >> >> >> > but it does not work. i tried similarly setting the font size >> >> >> > (with >> >> >> > set_size() or through rcParams) but it did not work either. how >> >> >> > can i >> >> >> > do >> >> >> > this? i'd like to do this either on per axes basis, or for the >> >> >> > entire >> >> >> > figure. >> >> >> >> >> >> It seems that changing rcParams is not effective because of the way >> >> >> how the font caching is done. Here is a little monkey patching to >> >> >> change this behavior. >> >> >> >> >> >> from matplotlib.font_manager import FontProperties >> >> >> >> >> >> def my_hash(self): >> >> >> l = dict([(k, getattr(self, "get" + k)()) for k in >> >> >> self.__dict__]) >> >> >> return hash(repr(l)) >> >> >> >> >> >> FontProperties.__hash__ = my_hash >> >> >> >> >> >> >> >> >> With this code, changing rcParams will affect (most of) the text in >> >> >> the >> >> >> figure. >> >> >> >> >> >> As far as I know, you cannot have a default font properties on per >> >> >> axes basis. You need to manually change the font properties of Text >> >> >> artists in your interests. >> >> >> >> >> >> For example, to change the font properties of the xtick labels, >> >> >> >> >> >> fp = FontProperties(family="Lucida Sans Typewriter") >> >> >> ax = gca() >> >> >> for t in ax.get_xticklabels(): >> >> >> t.set_fontproperties(fp) >> >> >> >> >> >> >> >> >> > >> >> >> > second, how can i make it so axes labels do not overlap? in many >> >> >> > plots, >> >> >> > including ones in the gallery, you see the labels at the origin of >> >> >> > plots >> >> >> > get >> >> >> > too close to each other. (i.e. the 0.0 of x-axis and 0.0 of >> >> >> > y-axis) - >> >> >> > how >> >> >> > can you prevent this from happening? >> >> >> > >> >> >> >> >> >> I don't think there is a smart way to prevent it other than manually >> >> >> changing the tick positions. Other may have better ideas. >> >> >> >> >> >> -JJ >> >> > >> >> > >> > >> > > > |