SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

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
(19)
2
(30)
3
(14)
4
(1)
5
(16)
6
(7)
7
(12)
8
(14)
9
(35)
10
(16)
11
(31)
12
(6)
13
(14)
14
(13)
15
(20)
16
(15)
17
(27)
18
(5)
19
(10)
20
(22)
21
(20)
22
(30)
23
(25)
24
(11)
25
(2)
26
(2)
27
(23)
28
(20)
29
(26)
30
(25)
31
(7)

Showing 19 results of 19

From: Paul R. <pau...@nr...> - 2009年07月28日 22:18:34
Hi,
I see that scatter() has a variety of different symbols that you can 
choose from, and even a way to create your own custom markers. 
However, I can't figure out how to make a crosshair symbol (a plus 
with non-touching lines) as my marker, which I'd like to use to show 
the location of a star on an underlying image without obscuring the 
star itself.
Graphically, I'd like a marker symbol that looks like this...
 |
 |
 |
======= =======
 |
 |
 |
Does anyone know how to pull this off?
Thanks!
-- Paul
From: Tony S Yu <to...@MI...> - 2009年07月28日 21:34:04
On Jul 28, 2009, at 4:53 PM, Josh Hemann wrote:
> One small nit: I
> don't see any code to set the color or alpha level of the grid 
> lines. In my
> example, I set the color to be a light grey because I wanted the 
> grid lines
> to be seen but not be distracting from the data. Just a preference.
Good point. It turns out the grid lines are already pretty faint on my 
computer, so I didn't need to adjust this. The most obvious thing to 
do is replace
 >>> plt.rgrids(radial_grid)
with
 >>> lines, labels = plt.rgrids(radial_grid)
 >>> plt.setp(lines, alpha=0.4)
**However**, this modification doesn't help. In fact, nothing I did to 
the gridlines changed their appearance. Out of frustration, I went to 
the code and found that `rgrids` calls *get_ticklines* instead of 
*get_gridlines*. My guess is that this is a typo, but there may be a 
compelling reason to return the tick lines. If that's not the case, 
here's a ridiculously simple patch:
Index: lib/matplotlib/projections/polar.py
===================================================================
--- lib/matplotlib/projections/polar.py	(revision 7300)
+++ lib/matplotlib/projections/polar.py	(working copy)
@@ -397,7 +397,7 @@
 self._r_label2_position.clear().translate(angle, -self._rpad 
* rmax)
 for t in self.yaxis.get_ticklabels():
 t.update(kwargs)
- return self.yaxis.get_ticklines(), self.yaxis.get_ticklabels()
+ return self.yaxis.get_gridlines(), self.yaxis.get_ticklabels()
 set_rgrids.__doc__ = cbook.dedent(set_rgrids.__doc__) % kwdocd
From: Josh H. <jh...@vn...> - 2009年07月28日 21:00:19
Fernando Perez wrote:
> 
> On Tue, Jul 28, 2009 at 11:26 AM, Josh Hemann<jh...@vn...> wrote:
>> FYI I have some other examples I was thinking would be useful. Here is an
>> enhanced boxplot example
>> that might compliment the simple examples well:
>>
>> http://www.nabble.com/file/p24705282/boxplotExample.png
> 
> Please! That example with the top labels looks great, and it's a very
> useful way of displaying the numerical key parts of the dataset.
> 
> Cheers,
> 
> f
> 
Great! I'll get started on extracting the plotting code from a larger
application I have, and I'll do my best to clean it up. Unless I hear
otherwise, I'll just post the code in this thread and let you guys run with
it if you want to.
Josh
-- 
View this message in context: http://www.nabble.com/Radar---Spider-Chars-tp17876254p24707753.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Josh H. <jh...@vn...> - 2009年07月28日 20:53:49
Tony,
This looks great, and I am enjoying seeing how to accomplish things in a
more Pythonic way. I don't see the radial grid lines, but I am using
0.98.5.3. I am downloading 0.99.3 now and maybe that will be the fix (I have
yet to figure out how to build out of svn on Windows...). One small nit: I
don't see any code to set the color or alpha level of the grid lines. In my
example, I set the color to be a light grey because I wanted the grid lines
to be seen but not be distracting from the data. Just a preference.
Cheers,
Josh
> Josh Hemann wrote:
>> Tony,
>>
>> I know this is a year later but your code was hugely helpful to me 
>> last
>> week, so thank you
I'm glad you found it helpful.
On Jul 28, 2009, at 12:56 PM, Michael Droettboom wrote:
> Would you (Josh and Tony) be amenable to us including this in the 
> set of
> examples? It would make it easier for users to find it. 
> Eventually, it
> might be nice to include this as a core plotting command, but in the
> meantime, I think it would still be useful as-is.
>
> Mike
Hey Mike,
I'm always happy to contribute what little I can to matplotlib. 
However, if it's going to be an official example, it should be cleaned 
up a bit (see attached). Summary of changes.
* My original example (i.e. not Josh's fault) didn't play well with 
namespaces (i.e. from pylab import *). This has been changed to use 
the proper imports (i.e. np and plt).
* Also, there were problems with rgrids when I originally wrote the 
code, which has since been fixed (at least on trunk it is). This 
eliminates the need to manually draw a grid.
* I made a few other clean ups for clarity. (Josh: I hope you don't 
mind, I switched the data for f4_base and f5_base so that I could 
remove the associated comment.)
* Final note. The polygon frame no longer works properly and I 
couldn't really figure out how to fix it.
Best,
-Tony
<\quote>
-- 
View this message in context: http://www.nabble.com/Radar---Spider-Chars-tp17876254p24707635.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: John H. <jd...@gm...> - 2009年07月28日 19:56:25
On Tue, Jul 28, 2009 at 2:27 PM, Tony S Yu<to...@mi...> wrote:
> I'm always happy to contribute what little I can to matplotlib. However, if
> it's going to be an official example, it should be cleaned up a bit (see
> attached). Summary of changes.
Thanks Tony -- I added this to examples/api/radar_chart.py in svn and
it will show up in the examples and gallery next time I update the
website.
JDH
From: Tony S Yu <to...@MI...> - 2009年07月28日 19:27:46
Attachments: radar_chart.py
> Josh Hemann wrote:
>> Tony,
>>
>> I know this is a year later but your code was hugely helpful to me 
>> last
>> week, so thank you
I'm glad you found it helpful.
On Jul 28, 2009, at 12:56 PM, Michael Droettboom wrote:
> Would you (Josh and Tony) be amenable to us including this in the 
> set of
> examples? It would make it easier for users to find it. 
> Eventually, it
> might be nice to include this as a core plotting command, but in the
> meantime, I think it would still be useful as-is.
>
> Mike
Hey Mike,
I'm always happy to contribute what little I can to matplotlib. 
However, if it's going to be an official example, it should be cleaned 
up a bit (see attached). Summary of changes.
* My original example (i.e. not Josh's fault) didn't play well with 
namespaces (i.e. from pylab import *). This has been changed to use 
the proper imports (i.e. np and plt).
* Also, there were problems with rgrids when I originally wrote the 
code, which has since been fixed (at least on trunk it is). This 
eliminates the need to manually draw a grid.
* I made a few other clean ups for clarity. (Josh: I hope you don't 
mind, I switched the data for f4_base and f5_base so that I could 
remove the associated comment.)
* Final note. The polygon frame no longer works properly and I 
couldn't really figure out how to fix it.
Best,
-Tony
From: Fernando P. <fpe...@gm...> - 2009年07月28日 19:00:58
On Tue, Jul 28, 2009 at 11:26 AM, Josh Hemann<jh...@vn...> wrote:
> FYI I have some other examples I was thinking would be useful. Here is an
> enhanced boxplot example
> that might compliment the simple examples well:
>
> http://www.nabble.com/file/p24705282/boxplotExample.png
Please! That example with the top labels looks great, and it's a very
useful way of displaying the numerical key parts of the dataset.
Cheers,
f
From: Gökhan S. <gok...@gm...> - 2009年07月28日 18:57:52
On Tue, Jul 28, 2009 at 1:29 PM, Nils Wagner
<nw...@ia...>wrote:
> Hi all,
>
> is it possible to build wire-frame models with matplotlib
> ?
>
> Any pointer would be appreciated.
>
> Thanks in advance
>
> Nils
>
>
> http://en.wikipedia.org/wiki/Wire-frame_model
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
Nils,
I don't know how would wire-framing be possible in mpl but I know mayavi is
capable of wire-frame representation of the objects.
All is need to be done for this is just going to actor tab for a glyph
object and changing the representation option to wireframe.
-- 
Gökhan
From: Nils W. <nw...@ia...> - 2009年07月28日 18:46:01
Hi all,
is it possible to build wire-frame models with matplotlib 
?
Any pointer would be appreciated.
Thanks in advance
 Nils
http://en.wikipedia.org/wiki/Wire-frame_model
From: Josh H. <jh...@vn...> - 2009年07月28日 18:27:01
Michael Droettboom-3 wrote:
> 
> Would you (Josh and Tony) be amenable to us including this in the set of 
> examples? It would make it easier for users to find it. Eventually, it 
> might be nice to include this as a core plotting command, but in the 
> meantime, I think it would still be useful as-is.
> 
> Mike
> 
Mike, 
I would be all for including it as an example, and agree that it would be
nice to see this routine made more robust for inclusion into matplotlib. I'd
volunteer, but I am still on the steep part of the learning curve. Maybe in
coming months...
FYI I have some other examples I was thinking would be useful. Here is an
enhanced boxplot example 
that might compliment the simple examples well:
http://www.nabble.com/file/p24705282/boxplotExample.png 
Its based on the same data as in the radar charts, just a different
visualization (a more detailed, side by side comparison between the
with-and-without-carbon-monoxide solution variability across hundreds of
simulations). The upper x-axis labels are the box medians, so you can scan
these labels for a faster gleaning of the actual numbers.
Cheers,
Josh
-- 
View this message in context: http://www.nabble.com/Radar---Spider-Chars-tp17876254p24705282.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Gewton J. <gj...@gm...> - 2009年07月28日 18:14:02
Jae-Joon Lee, savefig("file.png", bbox_inches="tight") doesn't work too.
On Mon, Jul 27, 2009 at 7:00 PM, Jae-Joon Lee <lee...@gm...> wrote:
> On Mon, Jul 27, 2009 at 4:06 PM, Gewton Jhames<gj...@gm...> wrote:
> > How to "trim the canvas" of the image generated? It's transparent, but
> still
> > have a "padding", if it would be cropped, I can safe almost 200px!. I
> have
> > attached a file to this email to show it, the background of the graph was
> > set to red only to you see the padding.
>
> As John suggested, you can adjust the subplot params. This adjusts the
> area occupied by the axes, while the figure size (canvas size) is
> fixed.
>
> The subplot params can be automatically adjusted.
>
>
> http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=automatic%20adjust#automatically-make-room-for-tick-labels
>
>
> On the other hand, there is some crude support for trimming, i.e.,
> reducing the figure size while the axes area fixed.
>
> savefig("file.png", bbox_inches="tight")
>
> Note that the figure size of the saved output is only affected. This
> does not change the figure displayed on the screen.
>
> Regards,
>
> -JJ
>
From: Gewton J. <gj...@gm...> - 2009年07月28日 18:09:29
John Hunter,
ax.autoscale_view(tight=True, scaley=False)
didn't work. I put it before and after plot. Didn't work in any case.
the first one, fig.subplots_adjust(left=0.05, bottom=0.05, top=0.05,
right=0.05), didn't work too. It let's the graph crazy.
If you want, I can put the code here.
On Mon, Jul 27, 2009 at 6:32 PM, John Hunter <jd...@gm...> wrote:
> On Mon, Jul 27, 2009 at 3:06 PM, Gewton Jhames<gj...@gm...> wrote:
> > Thanks everyone. Everything works perfectly.
> > Only a few things left:
> >
> > How to "trim the canvas" of the image generated? It's transparent, but
> still
> > have a "padding", if it would be cropped, I can safe almost 200px!. I
> have
> > attached a file to this email to show it, the background of the graph was
> > set to red only to you see the padding.
>
> use
>
> fig.subplots_adjust(left=0.05, bottom=0.05, top=0.05, right=0.05)
>
> etc to trim the excess space
>
> > In the file attached to this email, the graph have a space after the
> > position 23:00, I wish to remove it.
>
> Several ways to do it: one is:
>
> ax.autoscale_view(tight=True, scaley=False)
>
> Use
>
From: Michael D. <md...@st...> - 2009年07月28日 16:57:36
Would you (Josh and Tony) be amenable to us including this in the set of 
examples? It would make it easier for users to find it. Eventually, it 
might be nice to include this as a core plotting command, but in the 
meantime, I think it would still be useful as-is.
Mike
Josh Hemann wrote:
> Tony,
>
> I know this is a year later but your code was hugely helpful to me last
> week, so thank you. I needed to make a few modifications to get exactly what
> I needed, so I thought I'd add to the post for posterity...
>
> First, here is the graphic that the sample code generates (>>
> execfile('radarPlotExample.py'):
>
> http://www.nabble.com/file/p24688050/profileComparisonPub.png
> profileComparisonPub.png 
>
> Suffice it to say, I think this looks way better than what you get out of R
> or MATLAB (e.g.
> http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=123).
>
> Here is the code. I have tried to add comments in places that differ from
> Tony's code. I am a relatively new Python and matplotlib convert, so please
> feel free to comment on better ways to do this. But, like Tony said,
> hopefully this will help someone.
>
> Josh
>
>
> ---------------------------------------------------------------------------------------
> radarPlotExample.py
> ---------------------------------------------------------------------------------------
> from matplotlib.projections.polar import PolarAxes 
> from matplotlib.projections import register_projection 
> from pylab import * 
>
> def radar_factory(num_vars, frame='polygon'): 
> """Create a radar chart with `num_vars` axes. 
> """ 
> # calculate evenly-spaced axis angles 
> theta = 2*pi * linspace(0, 1-1/float(num_vars), num_vars) 
> #print theta
> #print
> # rotate theta such that the first axis is at the top 
> theta += pi/2 
> 
> def draw_poly_frame(self, x0, y0, r): 
> # TODO: should use transforms to convert (x, y) to (r, theta) 
> verts = [(r*cos(t) + x0, r*sin(t) + y0) for t in theta] 
> return Polygon(verts, closed=True) 
> 
> def draw_circle_frame(self, x0, y0, r): 
> return Circle((x0, y0), r) 
> 
> frame_dict = {'polygon': draw_poly_frame, 'circle': draw_circle_frame} 
> if frame not in frame_dict: 
> raise ValueError, 'unknown value for `frame`: %s' % frame 
> 
> class RadarAxes(PolarAxes): 
> """Class for creating a radar chart (a.k.a. a spider or star chart) 
> 
> http://en.wikipedia.org/wiki/Radar_chart 
> """ 
> name = 'radar' 
> # use 1 line segment to connect specified points 
> RESOLUTION = 1 
> # define draw_frame method 
> draw_frame = frame_dict[frame] 
>
> def fill(self, *args, **kwargs): 
> """Override fill so that line is closed by default""" 
> closed = kwargs.pop('closed', True) 
> return super(RadarAxes, self).fill(closed=closed, *args,
> **kwargs) 
> 
> def plot(self, *args, **kwargs): 
> """Override plot so that line is closed by default""" 
> lines = super(RadarAxes, self).plot(*args, **kwargs) 
> for line in lines: 
> self._close_line(line) 
> 
> def _close_line(self, line): 
> x, y = line.get_data() 
> # FIXME: markers at x[0], y[0] get doubled-up 
> if x[0] != x[-1]: 
> x = concatenate((x, [x[0]])) 
> y = concatenate((y, [y[0]])) 
> line.set_data(x, y) 
> 
> def set_varlabels(self, labels, rvals, rlabels): 
> self.set_thetagrids(theta * 180/pi, labels) 
> #Josh says: The rvals and rlabels parameters were added to
> support
> #the call to the set_rgrid method so you can control the
> position
> #and labelling of the circular grid lines. Make the radii labels 
> #smaller than the default size...
> self.set_rgrids(rvals, labels=rlabels, size='small')
> 
> def get_axes_patch(self): 
> x0, y0 = (0.5, 0.5) 
> r = 0.5 
> return self.draw_frame(x0, y0, r)
> 
> register_projection(RadarAxes) 
> return theta 
>
> 
> if __name__ == '__main__': 
> #The following data is from the Denver Aerosol Sources and Health study. 
> #See doi:10.1016/j.atmosenv.2008年12月01日7 
> #
> #The data are pollution source profile estimates for five modeled
> pollution
> #sources (e.g., cars, wood-burning, etc) that emit 7-9 chemical species.
> #The radar charts are experimented with here to see if we can nicely 
> #visualize how the modeled source profiles change across four scenarios:
> # 1) No gas-phase species present, just seven particulate counts on
> # Sulfate
> # Nitrate
> # Elemental Carbon (EC)
> # Organic Carbon fraction 1 (OC)
> # Organic Carbon fraction 2 (OC2)
> # Organic Carbon fraction 3 (OC3)
> # Pyrolized Organic Carbon (OP)
> # 2)Inclusion of gas-phase specie carbon monoxide (CO) 
> # 3)Inclusion of gas-phase specie ozone (O3). 
> # 4)Inclusion of both gas-phase speciesis present...
> 
> N = 9
> theta = radar_factory(N) 
> 
> f1_base = [0.88, 0.01, 0.03, 0.03, 0.00, 0.06, 0.01, 0.00, 0.00]
> f1_CO = [0.88, 0.02, 0.02, 0.02, 0.00, 0.05, 0.00, 0.05, 0.00] 
> f1_O3 = [0.89, 0.01, 0.07, 0.00, 0.00, 0.05, 0.00, 0.00, 0.03] 
> f1_both = [0.87, 0.01, 0.08, 0.00, 0.00, 0.04, 0.00, 0.00, 0.01] 
>
> f2_base = [0.07, 0.95, 0.04, 0.05, 0.00, 0.02, 0.01, 0.00, 0.00]
> f2_CO = [0.08, 0.94, 0.04, 0.02, 0.00, 0.01, 0.12, 0.04, 0.00] 
> f2_O3 = [0.07, 0.95, 0.05, 0.04, 0.00, 0.02, 0.12, 0.00, 0.00] 
> f2_both = [0.09, 0.95, 0.02, 0.03, 0.00, 0.01, 0.13, 0.06, 0.00] 
>
> f3_base = [0.01, 0.02, 0.85, 0.19, 0.05, 0.10, 0.00, 0.00, 0.00]
> f3_CO = [0.01, 0.01, 0.79, 0.10, 0.00, 0.05, 0.00, 0.31, 0.00] 
> f3_O3 = [0.01, 0.02, 0.86, 0.27, 0.16, 0.19, 0.00, 0.00, 0.00] 
> f3_both = [0.01, 0.02, 0.71, 0.24, 0.13, 0.16, 0.00, 0.50, 0.00] 
>
> f4_base = [0.01, 0.01, 0.02, 0.71, 0.74, 0.70, 0.00, 0.00, 0.00]
> f4_CO = [0.00, 0.02, 0.03, 0.38, 0.31, 0.31, 0.00, 0.59, 0.00] 
> f4_O3 = [0.01, 0.03, 0.00, 0.32, 0.29, 0.27, 0.00, 0.00, 0.95] 
> f4_both = [0.01, 0.03, 0.00, 0.28, 0.24, 0.23, 0.00, 0.44, 0.88] 
> 
> f5_base = [0.02, 0.01, 0.07, 0.01, 0.21, 0.12, 0.98, 0.00, 0.00]
> f5_CO = [0.02, 0.02, 0.11, 0.47, 0.69, 0.58, 0.88, 0.00, 0.00] 
> f5_O3 = [0.02, 0.00, 0.03, 0.37, 0.56, 0.47, 0.87, 0.00, 0.00] 
> f5_both = [0.02, 0.00, 0.18, 0.45, 0.64, 0.55, 0.86, 0.00, 0.16] 
>
> fig = figure(figsize=(9,9))
> fig.subplots_adjust(wspace=0.25, hspace=0.20)
> axlist = []
> axisNum = 0
> #The base vs with-gas ordering of the modeled profiles is swapped for 
> #factors 4/5, so we'll swap their ordering in the basecase list just to
> keep 
> #the coloring consistent across the four plots...
> bases = [f1_base, f2_base, f3_base, f5_base, f4_base]
> COs = [f1_CO, f2_CO, f3_CO, f4_CO, f5_CO]
> O3s = [f1_O3, f2_O3, f3_O3, f4_O3, f5_O3]
> boths = [f1_both, f2_both, f3_both, f4_both, f5_both]
> everything = [bases, COs, O3s, boths]
> titles = ['Basecase', 'With CO', 'With O3', 'CO & O3']
> colors = ['b', 'r', 'g', 'm', 'y']
> for row in range(2):
> for col in range(2):
> axisNum += 1
> if axisNum == 2:
> #Unfortunately, it looks like the loc keyword to legend() is 
> #relative to a specific subplot, rather than the figure
> itself. 
> #So, the positioning seen looks good, but if you resize the 
> #figure to be larger the legend becomes obviously bound to a 
> #specific subplot. This is in contrast to how the position
> works
> #in something like figtext(). Had trouble using figlegend(),
> but
> #need to try some more...
> legend(('Factor 1', 'Factor 2', 'Factor 3', 'Factor 4', 
> 'Factor 5'), loc=(0.95, 0.895), borderpad=0.01, 
> shadow=False, prop=matplotlib.font_manager
> .FontProperties(size='smaller'), markerscale=0.4)
> 
> data = everything[axisNum-1]
> ax = fig.add_subplot(2, 2, axisNum, projection='radar')
> ax.set_title(titles[axisNum-1], weight='bold', size='medium', 
> horizontalalignment='center', 
> verticalalignment='center',
> backgroundcolor='white', 
> position=(0.5, 1.1))
> p1 = ax.plot(theta, data[0], color=colors[0]) 
> p2 = ax.plot(theta, data[1], color=colors[1])
> p3 = ax.plot(theta, data[2], color=colors[2])
> p4 = ax.plot(theta, data[3], color=colors[3])
> p5 = ax.plot(theta, data[4], color=colors[4])
> ax.fill(theta, data[0], facecolor=colors[0]) 
> ax.fill(theta, data[1], facecolor=colors[1]) 
> ax.fill(theta, data[2], facecolor=colors[2]) 
> ax.fill(theta, data[3], facecolor=colors[3]) 
> ax.fill(theta, data[4], facecolor=colors[4]) 
> #axlist.extend(ax) #This does not work because ax is a 
> #RadarAxesSubplot object, which is not
> iterable
> axlist.append(ax) #append() works because it simply tacks on to 
> #the list, as opposed to merging items from
> two
> #lists
> for patch in ax.patches: 
> patch.set_alpha(0.25) 
>
> 
> figtext(0.5, 0.965, '5-Factor Solution Profiles Across Four Scenarios
> ', 
> ha='center', color='black', weight='bold', size='large') 
> 
> #Crudely plot the grid lines I want to see: normalized concentrations of
> #chemicals range from 0 to 1...
> radiiGrid = [0.2, 0.4, 0.6, 0.8]
> theta_rgrid = radar_factory(100)
> for ax in axlist:
> for r in radiiGrid:
> radii = repeat(r, 100)
> ax.plot(theta_rgrid, radii, color='lightgrey')
> 
> # FIXME: legend doesn't work when fill is called 
> spokeLabels = ['Sulfate', 'Nitrate', 'EC', 'OC1', 'OC2', 'OC3', 'OP',
> 'CO', 
> 'O3']
> radiiLabels = [str(rg) for rg in radiiGrid]
> for ax in axlist:
> ax.set_varlabels(spokeLabels, radiiGrid, radiiLabels)
>
> show()
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Matthias M. <Mat...@gm...> - 2009年07月28日 14:06:50
Hi,
as nobody answered up to now I may make my (tiny) contribution.
 
On Friday 24 July 2009 22:58:10 per freem wrote:
> Hi all,
>
> i have a simple scatter plot, where the x axis and y axis are on different
> scales starting from 0. the x axis here ranges from 0 to 300 and the y axis
> from 0 to 1. i plot it as follows:
>
> my_fig = plt.figure(figsize=(6,5), dpi=100)
> x = rand(100)*300
> y = rand(100)
> plt.scatter(x, y)
> plt.rcParams['xtick.direction'] = 'out'
> plt.rcParams['ytick.direction'] = 'out'
> plt.xlim([-0.05, 300.05])
> plt.ylim([-0.05, 1.05])
> plt.show()
>
> i'd like to leave a bit of space between the origin and the x-axis 0 and
> between the origin and y-axis 0, which is why i added 0.05 to the end
> points of each axis. however, i'd like the space between 0 and the origin
> on either axis to be the same. since 0.05 on a scale from 0 to 300 is not
> the same amount of space as 0.05 on a scale from 0 to 1, this is not the
> effect i get. the yaxis looks good but the xaxis does not. how can i fix
> this?
plt.xlim([-0.05*300, 300*1.05])
plt.ylim([-0.05, 1.05])
> second, how can i remove the upper x axis ticks and the right y axis ticks?
> these ticks are really not informative to the plot. ideally i would like to
> remove those axes altogether, and just have one x axis and one y axis --
> but i don't want to manually plot the axes. is there a way to do this?
>
> if that is not possible i'd like to at least remove those tick marks from
> the duplicate axes. any thoughts on this will be greatly appreciated.
Unfortunately I have no idea about this. Maybe someone else has an idea, if it 
is possible to remove the upper / right ticks.
best regards Matthias
From: Roland K. <r.k...@ya...> - 2009年07月28日 14:00:21
Hi,
I've got some performance problems with matplotlib, and would like to
ask if you know any way I can make it faster.
If there is no such way, I have to decide to (a) either enhance matplotlib
or (b) write my own plotting-library.
(I'm currently using matplotlib to plot data "live" on the screen, including
animation, scrolling, zoom+pam, custom scales (to zoom out some part of the
plot), and multiple X-/Y-Axes. I therefore already wrote some wrappers around
matplotlib to implement some of these features.)
In detail:
- I have a figure containing some plots (lines).
- About every second I "update" the plot:
 - Add a few points to the lines.
 (=add point to an array and call set_data(array))
 - Scroll the plot, so that the latest point is on the right of the plot.
 Older points disappear on the left side of the plot.
 (=set_xaxis() + draw())
- I'm using GtkAgg, incl. animation, (re)storing the background, drawing
 the artists and blit.
 (canvas.restore_region(...), ax.draw_artist(...), canvas.blit(bbox))
This works as long as the plot only contains a few points,
although 2 figures + 5-10 lines per figure and an update every 0.5 s
already consumes about 10-20% CPU (on a 1.4 GHz Pentium).
By the way: Is this speed normal, or is matplotlib usually faster?
But as soon as the plot contains *many* points (several 10000 up to
several 100000), the plotting becomes terribly slow -- up to 30s
per update and more!
Do you know any way to make this faster?
My ideas are:
- Since I only add points to the *right* of the lines, I could reduce the
 number of points, by first removing all points which are outside of
 the current visible plotting-window from my array, and then calling
 set_data() with the reduced array.
- This unfortunately wouldn't reduce the number of points in very dense
 plots. It would be possible to (a) replace several points which all
 result in the same plotted point by a single point or (b) cache the
 plotted points e.g. on pixel-level. I think (b) would probably require
 to write a new backend.
Any ideas?
regards,
Roland
From: John H. <jd...@gm...> - 2009年07月28日 12:47:38
On Mon, Jul 27, 2009 at 4:39 PM, dek<dr...@ho...> wrote:
>
> is there an on exit event for the matplotlib gui, such as when a user clicks
> the 'x' in the gui window
There is not, but it would not be difficult to add.
From: Paul A. L. <pau...@gm...> - 2009年07月28日 08:23:54
Hi,
thanks a lot Eric! I'm sorry I bothered you with this.
There's obviously an error in how my data generating script works.
cheers,
Paul.
On 27. juli. 2009, at 21.48, Eric Firing wrote:
> Paul Anton Letnes wrote:
>> Hi,
>> I'm having strange problems with contourf plots. The plotting 
>> routine is rather elaborate, so I don't have an easy way to 
>> reproduce the problem (unfortunately). The problem should be 
>> evident from the attachments. As you can see, the contourf routine 
>> doesn't color the whole plot area. Also, after some editing in 
>> Adobe Illustrator, it is also easy to see that some contours are 
>> drawn on top of others. This must surely be a bug?
>
> It is in your data file and/or your handling of it, not in contourf. 
> The problem is that your theta variable is not monotonic--it starts 
> and ends with zero. If you chop off the last line of your data 
> file, or equivalently chop off the last column of each array after 
> you read it, like this:
>
>
> return thetas[:,:-1], freqs[:,:-1], Es[:,:-1]
>
> then the contouring works fine.
>
> Eric
>
>> I would like to note that this happened on the TkAgg (using 
>> show()), Agg (png format), ps (eps format), macosx (using show()) 
>> and pdf backends. Also, for some data sets, the plot turns out just 
>> fine - I get this problem only for some data sets. I have no idea 
>> how to debug this, so I'd appreciate any hints you might provide.
>> The file original.pdf shows the matplotlib result. The file 
>> edited.pdf shows that you have contours on top of each other. The 
>> file gnuplot.png gives an idea of what the end result should be: a 
>> lot of bumps around 3.5 eV, but some of this structure is missing 
>> from the contourf plots. The gnuplot plot was generated from the 
>> same data (ASCII text) file.
>> Best regards,
>> Paul.
>> ------------------------------------------------------------------------
>> ------------------------------------------------------------------------
>> ------------------------------------------------------------------------------
>> ------------------------------------------------------------------------
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Kurt M. <kur...@gm...> - 2009年07月28日 08:15:52
Alexander Bruy schrieb:
> matplotlib have nice and helpfull feature - navigation toolbar. But in
> some cases some default buttons are not needed. Is it possible to
> customize NavigationToolbar (e.g. disable or hide some buttons)? I'm
> use matplotlib with PyQt 4.4.3 and Python 2.5.4 under Windows XP.
Maybe this is what you are looking for:
http://dalelane.co.uk/blog/?p=778
Grüessli
-- 
Kurt Mueller
From: Alexander B. <vo...@ua...> - 2009年07月28日 05:20:35
Hello,
 matplotlib have nice and helpfull feature - navigation toolbar. But in some cases some default buttons are not needed. Is it possible to customize NavigationToolbar (e.g. disable or hide some buttons)? I'm use matplotlib with PyQt 4.4.3 and Python 2.5.4 under Windows XP.
Thanks,
 Alexander Bruy
-- реклама -----------------------------------------------------------
Поторопись зарегистрировать самый короткий почтовый адрес @i.ua
http://mail.i.ua/reg - и получи 1Gb для хранения писем
1 message has been excluded from this view by a project administrator.

Showing 19 results of 19

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /