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




Showing results of 39

1 2 > >> (Page 1 of 2)
From: Alan G I. <ala...@gm...> - 2011年05月06日 23:21:59
> On 5/6/2011 7:57 AM, Vikram K wrote:
>> I wish to draw a Venn diagram depicting five events and
>> their intersections.
On 5/6/2011 8:07 AM, Alan G Isaac wrote:
> Can't be done:
> http://www.brynmawr.edu/math/people/anmyers/PAPERS/Venn.pdf
More precisely: it cannot be done with circles.
Cheers,
Alan Isaac
From: Gökhan S. <gok...@gm...> - 2011年05月06日 22:59:23
Hello,
Anyone on the list works with radar and/or lidar data for atmospheric
phenomenon visualisation? I am wondering if there is any 2D specific
analysis and visualisation package out in the web.
Thanks.
-- 
Gökhan
From: Kaushik K. <kal...@il...> - 2011年05月06日 22:01:13
Dear List,
I use Matplotlib bundled with the Enthought Python Distribution (EPD) (both 32-bit and 64-bit versions). After a recent update, I find that my Python code (run either in a iPython shell or in bash shell) crashes while attempting to save figures to pdf files using savefig(). However, saving to other formats (png, ps, eps or svg) works fine. The error message echoed to the terminal are "Bus error" with 32-bit EPD and "Abort trap" with 64-bit EPD. Also, converting to pdf from one of the other four formats using *nix utilities like convert or ps2pdf go through fine (prompting to suspect that savefig has a bug). Unfortunately, in a short time, by looking at pyplot.py, I couldn't determine what could be causing this. Therefore, it would be really helpful if list members can provide any hints to fix this. I need to save a bunch of figures from existing code, and it would be great if I could do so without having to modify all savefig statements; additionally, I would prefer not to write a shell script to perform the conversions to pdf considering the different directories that my figures are saved to.
Also, a few searches using google did not throw up anything useful (although one relevant list archive suggested that if EPD alone is installed on a Mac, this error shouldn't be seen. Since this is the case for me, it didn't help.). The following are my specifications:
Platform: Mac OS X 10.6.7
Python version: 2.7.1
Matplotlib version: 1.0.1
EPD versions: 7.0-2 (both 32-bit and 64-bit)
(Should I also post this to matplotlib-devel ?)
Thanks and Regards,
Kaushik Kalyanaraman
From: Steve K. <ka...@co...> - 2011年05月06日 21:40:18
Hello,
I am trying to embed a dynamic figure within a GUI generated WX 
interface but it only displays the last evaluation. I have tried 
embedding the animated examples as provided by the animated link, 
www.scipy.org/Cookbook/Matplotlib/Animations but it only shows the last 
result in the frame. When calling these example outside the GUI, they 
produce the dynamic visualizations and expected.
Can anyone provide me with guidance in generalizing the animated 
examples within embedded GUIs.
Thanks
Steve
From: C M <cmp...@gm...> - 2011年05月06日 20:19:56
On Fri, May 6, 2011 at 10:33 AM, Benjamin Root <ben...@ou...> wrote:
> On Thu, May 5, 2011 at 10:01 PM, C M <cmp...@gm...> wrote:
>>
>> > Because you have a py2exe'ed program, I suspect that whoever packaged
>> > the
>> > program should be the one to modify that program to choose its axes
>> > limits
>> > more robustly in order to avoid the warning message.
>>
>> Maybe I have been unclear. I am the sole developer of this
>> application, and I occasionally test it as a py2exe'd app in
>> anticipation of delivering it in that form at some point. I would be
>> happy to modify the program to choose its axes limits more
>> robustly--if I only knew how to do that. That is what I am asking.
>> How should I do that?
>>
>> The data to be plotted is a very simple date plot with dates on the x
>> axis and values (formatted as time) on the y axis.
>>
>> Che
>
> Most likely, somewhere in your code, you have a call to set_ylim(), and are
> likely setting it to the minimum and maximum values of the data you are
> plotting. This is where the problem comes in. There are several options to
> go about avoiding the problem here. One is to not call set_ylim() at all if
> you have only one data point, and just let matplotlib figure out the
> y-limits automatically. Another approach is to call set_ylim() with
> parameters that have an explicit amount of padding, like the following:
>
> ax.set_ylim(y.min() - 0.5, y.max() + 0.5)
>
> This way, you are guaranteed that the top and bottom limits will never be
> the same. The best approach is up to you.
>
> I hope that helps!
> Ben Root
Thank you, Ben! That helps a lot. Adding some padding myself seems
to fix it. And it's good to understand what was occurring.
-Che
From: Tony Yu <ts...@gm...> - 2011年05月06日 17:34:08
(Sorry for sending this twice, Pythonified, but I forgot to copy the list)
On Wed, May 4, 2011 at 9:51 PM, Pythonified <net...@gm...>wrote:
> I have been trying to assign different colors for each line I plot, where
> the colors are incrementally darkened (or lightened), or selected from a
> colorbar (e.g. rainbow). Any ideas?
>
I posted some code awhile back to do what you're looking for (see:
http://old.nabble.com/Where-to-post-examples-%28specifically,-one-that-may-be-useful-for-time-evolution-plots%29-td23901837.html
).
I'm copying the code below again because it's evolved a bit (I really need
to start posting code to github). Anyway, if you copy the attached code to a
module, you should be able to call the "cycle_cmap" function to change the
cmap globally, or the "cycle_cmap_axes" function to create an axes with the
specified cmap.
Best,
-Tony
#---- start of code
import matplotlib.pyplot as plt
import numpy as np
# reverse these colormaps so that it goes from light to dark
REVERSE_CMAP = ['summer', 'autumn', 'winter', 'spring', 'copper']
# clip some colormaps so the colors aren't too light
CMAP_RANGE = dict(gray={'start':200, 'stop':0},
 Blues={'start':60, 'stop':255},
 Oranges={'start':100, 'stop':255},
 OrRd={'start':60, 'stop':255},
 BuGn={'start':60, 'stop':255},
 PuRd={'start':60, 'stop':255},
 YlGn={'start':60, 'stop':255},
 YlGnBu={'start':60, 'stop':255},
 YlOrBr={'start':60, 'stop':255},
 YlOrRd={'start':60, 'stop':255},
 hot={'start':230, 'stop':0},
 bone={'start':200, 'stop':0},
 pink={'start':160, 'stop':0})
def cmap_intervals(length=50, cmap='YlOrBr', start=None, stop=None):
 """Return evenly spaced intervals of a given colormap `cmap`.
 Colormaps listed in REVERSE_CMAP will be cycled in reverse order.
Certain
 colormaps have pre-specified color ranges in CMAP_RANGE. These module
 variables ensure that colors cycle from light to dark and light colors
are
 not too close to white.
 Parameters
 ----------
 length : int
 the number of colors used before cycling back to first color. When
 `length` is large (> ~10), it is difficult to distinguish between
 successive lines because successive colors are very similar.
 cmap : str
 name of a matplotlib colormap (see matplotlib.pyplot.cm)
 """
 cm = getattr(plt.cm, cmap)
 crange = CMAP_RANGE.get(cmap, dict(start=0, stop=255))
 if cmap in REVERSE_CMAP:
 crange = dict(start=crange['stop'], stop=crange['start'])
 if start is not None:
 crange['start'] = start
 if stop is not None:
 crange['stop'] = stop
 if length > abs(crange['start'] - crange['stop']):
 print ('Warning: the input length is greater than the number of ' +
 'colors in the colormap; some colors will be repeated')
 idx = np.linspace(crange['start'], crange['stop'], length).astype(np.int
)
 return cm(idx)
def cycle_cmap(length=50, cmap='YlOrBr', start=None, stop=None):
 """Set default color cycle of matplotlib to a given colormap `cmap`.
 The default color cycle of matplotlib is set to evenly distribute colors
in
 color cycle over specified colormap.
 Note: this function must be called before *any* plot commands because it
 changes the default color cycle.
 See ``cmap_intervals`` for input details.
 """
 color_cycle = cmap_intervals(length, cmap, start, stop)
 # set_default_color_cycle doesn't play nice with numpy arrays
 plt.rc('axes', color_cycle=color_cycle.tolist())
def cycle_cmap_axes(length=50, cmap='YlOrBr', start=None, stop=None):
 """Return axes with color cycle set to a given colormap `cmap`.
 The color cycle of the axes is set to evenly distribute colors in color
 cycle over specified colormap.
 See ``cmap_intervals`` for input details.
 """
 color_cycle = cmap_intervals(length, cmap, start, stop)
 # set_default_color_cycle doesn't play nice with numpy arrays
 ax = plt.gca()
 ax.set_color_cycle(color_cycle)
 return ax
if __name__ == '__main__':
 n_lines = 10
 x = np.linspace(0, n_lines)
 # change the global cmap
 cycle_cmap(n_lines, 'Oranges')
 for shift in np.linspace(0, np.pi, n_lines):
 plt.plot(x, np.sin(x - shift))
 plt.figure()
 # create an axes that is set to desired cmap
 ax = cycle_cmap_axes(n_lines, 'Blues')
 for shift in np.linspace(0, np.pi, n_lines):
 ax.plot(x, np.sin(x - shift))
 plt.show()
From: Daniel M. <dan...@go...> - 2011年05月06日 16:13:15
Very nice, will try this asap!
Many thanks!
2011年5月6日 Tony Yu <ts...@gm...>:
>
> On Fri, May 6, 2011 at 5:55 AM, Chris Rodgers <chr...@be...>
> wrote:
>>
>> The real solution of course is to calculate exactly where every piece
>> of text actually is, detect overlaps, and adjust. That is certainly
>> beyond my ability or inclination to implement. In the mean time, it
>> would be nice to have a simple "idiot-proof" flag that blindly fixes
>> some common problems.
>
> I wrote a helper script awhile back to adjust spacing "automatically".
>
> Code can be found here:
> http://www.mail-archive.com/mat...@li.../msg18107.html
>
> You can simply copy the code into a module (e.g. layout.py) that lives in
> your python path, and then call "layout.tight_layout()" *right before* your
> call to "plt.show()" (or "plt.savefig()").
>
> It's pretty inefficient though because it has to draw the figure 3 different
> times (once to calculate the size of subplots and again to calculate the
> size of the figure, and then the final draw). There are some other issues,
> which prevent inclusion in matplotlib (see discussion in link below), but it
> works well for my purposes.
>
> Best,
> -Tony
>
> Original post, with some discussion, can be found here:
> http://www.mail-archive.com/mat...@li.../msg06896.html
>
> Note the code from the original post didn't work on some backends, so it's
> probably best to use the code from the first link.
From: Tony Yu <ts...@gm...> - 2011年05月06日 15:56:46
On Fri, May 6, 2011 at 5:55 AM, Chris Rodgers <chr...@be...>wrote:
> The real solution of course is to calculate exactly where every piece
> of text actually is, detect overlaps, and adjust. That is certainly
> beyond my ability or inclination to implement. In the mean time, it
> would be nice to have a simple "idiot-proof" flag that blindly fixes
> some common problems.
>
I wrote a helper script awhile back to adjust spacing "automatically".
Code can be found here:
http://www.mail-archive.com/mat...@li.../msg18107.html
You can simply copy the code into a module (e.g. layout.py) that lives in
your python path, and then call "layout.tight_layout()" *right before* your
call to "plt.show()" (or "plt.savefig()").
It's pretty inefficient though because it has to draw the figure 3 different
times (once to calculate the size of subplots and again to calculate the
size of the figure, and then the final draw). There are some other issues,
which prevent inclusion in matplotlib (see discussion in link below), but it
works well for my purposes.
Best,
-Tony
Original post, with some discussion, can be found here:
http://www.mail-archive.com/mat...@li.../msg06896.html
Note the code from the original post didn't work on some backends, so it's
probably best to use the code from the first link.
From: Francesco B. <fra...@bs...> - 2011年05月06日 15:11:01
> Hi all,
> I've noticed that there are some islands missing from the basemap,
> such as Balearic Islands and Canary Islands.
 
I've fixed,
the problem was that I'm using the python wrapper for grads, that set the
default area threshold to 10000 km ...
I hope this can help someone else,
bye.
-- 
----------------------------------------------------------------------
Francesco Benincasa
Research Support Engineer - Earth Sciences Department
Barcelona Supercomputing Center - Centro Nacional de Supercomputación
Edificio Nexus II
c/ Jordi Girona 29, 08034 Barcelona, Spain
phone +34 934137612
fax +34 934137721
mailto: fra...@bs...
BSC web page: http://www.bsc.es/
----------------------------------------------------------------------
WARNING / LEGAL TEXT: This message is intended only for the use of the
individual or entity to which it is addressed and may contain
information which is privileged, confidential, proprietary, or exempt
from disclosure under applicable law. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, you are strictly prohibited from disclosing,
distributing, copying, or in any way using this message. If you have
received this communication in error, please notify the sender and
destroy and delete any copies you may have received.
http://www.bsc.es/disclaimer.htm
From: Utopian <ika...@ya...> - 2011年05月06日 15:10:03
Hello everyone!
I want to extract colors from the colormap
example:
 import matplotlib.cm as cm
 color1=cm.jet(20)
Now I need to get colors from the discrete colorbar
there is a working code how to create discrete colormap: 
http://www.scipy.org/Cookbook/Matplotlib/ColormapTransformations Discrete
colormap 
I make same thing with:
 newcbar=cmap_discretize(cm.jet,100) # jet is devided by 100 parts
 color2=newcbar(20)
surprisingly color2 is different than color1. I dont understand why. 
Could you please give me an idea how to create a discrete colorbar and
extract color?
-- 
View this message in context: http://old.nabble.com/getting-colors-from-the-discrete-color-bar-tp31559720p31559720.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Benjamin R. <ben...@ou...> - 2011年05月06日 14:34:00
On Thu, May 5, 2011 at 10:01 PM, C M <cmp...@gm...> wrote:
> > Because you have a py2exe'ed program, I suspect that whoever packaged the
> > program should be the one to modify that program to choose its axes
> limits
> > more robustly in order to avoid the warning message.
>
> Maybe I have been unclear. I am the sole developer of this
> application, and I occasionally test it as a py2exe'd app in
> anticipation of delivering it in that form at some point. I would be
> happy to modify the program to choose its axes limits more
> robustly--if I only knew how to do that. That is what I am asking.
> How should I do that?
>
> The data to be plotted is a very simple date plot with dates on the x
> axis and values (formatted as time) on the y axis.
>
> Che
>
Most likely, somewhere in your code, you have a call to set_ylim(), and are
likely setting it to the minimum and maximum values of the data you are
plotting. This is where the problem comes in. There are several options to
go about avoiding the problem here. One is to not call set_ylim() at all if
you have only one data point, and just let matplotlib figure out the
y-limits automatically. Another approach is to call set_ylim() with
parameters that have an explicit amount of padding, like the following:
ax.set_ylim(y.min() - 0.5, y.max() + 0.5)
This way, you are guaranteed that the top and bottom limits will never be
the same. The best approach is up to you.
I hope that helps!
Ben Root
From: Johann G. <jg...@uc...> - 2011年05月06日 12:11:09
> Hi Michael,
>
> I use fill_between() and log axis without problems in the following way (it's by memory, I hope the sintax is correct)
>
> fig = plt.figure()
> spl = fig.add_subplot(111)
>
> spl.fill_between(x,y1,y2)
>
> spl.set_yscale("log")
>
> plt.show()
>
> Cheers,
>
> Fra
>
> Il giorno 06/mag/2011, alle ore 01.34, Benjamin Root ha scritto:
>
> >
> >
> > On Tue, May 3, 2011 at 3:40 AM, K.-Michael Aye <kmi...@gm...> wrote:
> > A colleague posed an interesting challenge:
> > How to do a filled plot having the y-axis in logarithm?
> > I think I can do it with creating patches myself an adding it to the
> > axis, but isn't there anything built-in?
> >
> > Best regards,
> > Michael
> >
> >
> >
> > Does fill_between() not work for you? Note, I have never tried it on a log scale plot.
> >
> > Ben Root
> >
>
Another couple things you may find useful as I did:
fig = pyplot.figure()
spl = fig.add_subplot(111)
to properly "clip" the plot in case you are using polygons or similar,
you can use the nonposy option:
spl.set_yscale('log', nonposy='clip')
Here is my hand made formula for setting reasonable limits on the
y-axis, given a numpy.array "yarr" as the list of y-values. The ymin
gets the minimum value that's not zero since you can't plot zero on a
log scale (negative numbers may cause a whole other problem):
spl.set_ylim(
 ymin = 10**(int(math.log(min(yarr[numpy.where(yarr>0)]), 10))-1),
 ymax = 10**(int(math.log(max(yarr), 10)+0.2)+1) )
--Johann
From: Alan G I. <ala...@gm...> - 2011年05月06日 12:08:01
On 5/6/2011 7:57 AM, Vikram K wrote:
>
> I wish to draw a Venn diagram depicting five events and their intersections.
Can't be done:
http://www.brynmawr.edu/math/people/anmyers/PAPERS/Venn.pdf
hth,
Alan Isaac
From: Vikram K <kpg...@gm...> - 2011年05月06日 11:57:26
This works for four events and their intersections but how do i add the
fifth event along with all intersections?
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')
c4 = Circle((0,-1),rad, alpha=.2, fc ='yellow')
ax.add_patch(c1)
ax.add_patch(c2)
ax.add_patch(c3)
ax.add_patch(c4)
ax.set_xlim(-3,3)
ax.set_ylim(-3,3)
plt.show()
---------- Forwarded message ----------
From: Vikram K <kpg...@gm...>
Date: Fri, May 6, 2011 at 7:43 AM
Subject: Venn diagram for five events
To: mat...@li...
I wish to draw a Venn diagram depicting five events and their intersections.
I came across some code for three events--could someone please direct me
about how i could modify it for five events.
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()
From: Vikram K <kpg...@gm...> - 2011年05月06日 11:43:45
I wish to draw a Venn diagram depicting five events and their intersections.
I came across some code for three events--could someone please direct me
about how i could modify it for five events.
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()
From: Francesco B. <fra...@bs...> - 2011年05月06日 09:56:41
Hi all,
I've noticed that there are some islands missing from the basemap,
such as Balearic Islands and Canary Islands.
Any suggestion to fix it?
Thank you very much in advance.
-- 
----------------------------------------------------------------------
Francesco Benincasa
Research Support Engineer - Earth Sciences Department
Barcelona Supercomputing Center - Centro Nacional de Supercomputación
Edificio Nexus II
c/ Jordi Girona 29, 08034 Barcelona, Spain
phone +34 934137612
fax +34 934137721
mailto: fra...@bs...
BSC web page: http://www.bsc.es/
----------------------------------------------------------------------
WARNING / LEGAL TEXT: This message is intended only for the use of the
individual or entity to which it is addressed and may contain
information which is privileged, confidential, proprietary, or exempt
from disclosure under applicable law. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, you are strictly prohibited from disclosing,
distributing, copying, or in any way using this message. If you have
received this communication in error, please notify the sender and
destroy and delete any copies you may have received.
http://www.bsc.es/disclaimer.htm
From: Chris R. <chr...@be...> - 2011年05月06日 09:55:42
Since I just posted an almost-identical question, it's no surprise
that I agree this would be a useful feature.
Reason #1) I create hundreds of quick throwaway figures every day,
often in an automated way, and don't have time to fine-tune them.
Reason #2) a newbie to matplotlib might be turned off by one "ugly"
figure, when in fact matplotlib is capable of producing beautiful
figures.
The previous suggestion I received was to create a convenience wrapper
for the subplot function with some idiot-proof defaults. Can you
propose a set of rcParams that satisfies this criterion? This one
fixes the specific issue you raise:
matplotlib.rcParams['figure.subplot.hspace'] = .5
Although it will rear its ugly head again once the number of subplots
reaches 5 or 6. Personally I rarely use more than 4x4, and if I did I
would certainly increase the figsize.
I find that setting all text sizes to be as small as possible also
helps. My most commonly encountered issue is overlapping x-tick
labels, because most of my plots have "samples" on the x-axis and
therefore hundreds of thousands of points.
The real solution of course is to calculate exactly where every piece
of text actually is, detect overlaps, and adjust. That is certainly
beyond my ability or inclination to implement. In the mean time, it
would be nice to have a simple "idiot-proof" flag that blindly fixes
some common problems.
On Fri, May 6, 2011 at 1:20 AM, Daniel Mader
<dan...@go...> wrote:
> Hi,
>
> almost every time I create a somewhat more complex figure I have to
> fight with the not too smart positioning of the plots and the size of
> margins around the axes. From many postings here I have learned that
> this is the absolute intention, i.e. it is broken by design unless the
> programmer takes care about this.
>
> I have to admin that I do not really get this idea. I am aware that
> the defaults will not change anytime soon and so I'd like to ask for
> an "idiot-proof" mode: this could be enabled by an rcParam and take
> care of proper dimensions, scale axis labels, titles, margins etc so
> that they don't cover.
>
> Here's an example for a matplotlib script which is a simple as it can
> get and demonstrates the broken layout which a user gets by default.
>
> import scipy
> import pylab
>
> x = scipy.linspace(-50,50, 100)
> y1 = scipy.rand(100)
> y2 = scipy.sin(x)
> y3 = y1 + y2
>
> fig = pylab.figure()
> ax1 = fig.add_subplot(311)
> ax2 = fig.add_subplot(312)
> ax3 = fig.add_subplot(313)
>
> ax1.plot(x, y1)
> ax2.plot(x, y2)
> ax3.plot(x, y3)
>
> ax1.set_title('some title')
> ax2.set_title('some title')
> ax3.set_title('some title')
>
> pylab.show()
>
> Of course, one can adjust the figsize but the results are still far
> from being adorable. The spacing around the sublplots increases for no
> apparent reason while the spacing between the subplot remains the same
> so that everything looks cramped...
>
>
> Thank you many times in advance,
> best regards,
>
> Daniel
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today. Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Daniel M. <dan...@go...> - 2011年05月06日 08:20:51
Hi,
almost every time I create a somewhat more complex figure I have to
fight with the not too smart positioning of the plots and the size of
margins around the axes. From many postings here I have learned that
this is the absolute intention, i.e. it is broken by design unless the
programmer takes care about this.
I have to admin that I do not really get this idea. I am aware that
the defaults will not change anytime soon and so I'd like to ask for
an "idiot-proof" mode: this could be enabled by an rcParam and take
care of proper dimensions, scale axis labels, titles, margins etc so
that they don't cover.
Here's an example for a matplotlib script which is a simple as it can
get and demonstrates the broken layout which a user gets by default.
import scipy
import pylab
x = scipy.linspace(-50,50, 100)
y1 = scipy.rand(100)
y2 = scipy.sin(x)
y3 = y1 + y2
fig = pylab.figure()
ax1 = fig.add_subplot(311)
ax2 = fig.add_subplot(312)
ax3 = fig.add_subplot(313)
ax1.plot(x, y1)
ax2.plot(x, y2)
ax3.plot(x, y3)
ax1.set_title('some title')
ax2.set_title('some title')
ax3.set_title('some title')
pylab.show()
Of course, one can adjust the figsize but the results are still far
from being adorable. The spacing around the sublplots increases for no
apparent reason while the spacing between the subplot remains the same
so that everything looks cramped...
Thank you many times in advance,
best regards,
Daniel
From: Andreas R. <and...@tu...> - 2011年05月06日 08:04:06
Hi Ben,
Thanks anyway for your answer!
Aki
Benjamin Root wrote:
> 
> 
> On Tue, Mar 29, 2011 at 8:35 AM, Andreas Reisinger
> <and...@tu... <mailto:and...@tu...>>
> wrote:
> 
> Hi!
> 
> I would like to save a pyplot object as it is, including axes, lines,
> text, etc. into a file.
> When opening it again, I want to be able to add additional axes, lines
> and so on.
> 
> Unfortunately pickle does not handle the pyplot object and gives me an
> error.
> 
> Anyone knows a solution?
> 
> All the best
> Aki
> 
> 
> This has been an often requested feature, but much harder to implement
> than expected. There is currently no known solution to this problem,
> but I certainly would hope that it becomes possible.
> 
> Sorry I could not be of more help.
> Ben Root
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network 
> management toolset available today. Delivers lowest initial 
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Alexander D. <ale...@go...> - 2011年05月06日 07:25:57
Hi Benjamin,
thanks for your answer - I feared you would reply as you did. I will have a
look at mayavi then.
Thanks
 Alex
On Fri, May 6, 2011 at 00:24, Benjamin Root <ben...@ou...> wrote:
> On Thursday, May 5, 2011, Alexander Dietz
> <ale...@go...> wrote:
> > Hi,
> >
> > I have the following situation. I have been following the example to
> create a 3d surface, as explained here:
> >
> > http://matplotlib.sourceforge.net/examples/mplot3d/surface3d_demo2.html
> >
> > and I have altered the code slightly to plot a straight red line from the
> center outside of the sphere (see code at the end of this email). As one can
> see, the whole line is visible always, no matter how the sphere is turned.
> Is there a way to 'hide' those parts of the red line, which are 'behind' the
> blue surface? Like you stick a pencil into an apple and turn the apple, so
> you can see parts of the pencil, depending on how the apple is rotated
> (except the part of the pencil inside the apple)?
> >
> > If someone can help me with that problem that would be great.
> >
> >
> > Thanks
> > Alex
> >
> >
> >
> >
> >
> >
> > from mpl_toolkits.mplot3d import Axes3D
> > import matplotlib.pyplot as plt
> > import numpy as np
> >
> > fig = plt.figure()
> > #ax = fig.add_subplot(111, projection='3d')
> > ax = Axes3D(fig)
> >
> > u = np.linspace(0, 2 * np.pi, 100)
> > v = np.linspace(0, np.pi, 100)
> >
> > x = 10 * np.outer(np.cos(u), np.sin(v))
> > y = 10 * np.outer(np.sin(u), np.sin(v))
> > z = 10 * np.outer(np.ones(np.size(u)), np.cos(v))
> >
> > ax.plot([0,15],[0.0,0.0],'r', lw=4)
> >
> > ax.plot_surface(x, y, z, rstride=4, cstride=4, color='b')
> >
> > plt.show()
> >
>
> Mplot3d is not a true 3d plotting system. I would recommend mayavi
> for that. Because mplot3d is a hack to render 3d objects with a 2d
> rendering system, matplotlib can't get the the layering right. Maybe
> in the far future this will be changed, but for now, it is a design
> limitation.
>
> Ben
>
From: Francesco M. <fra...@go...> - 2011年05月06日 07:25:46
Hi Michael,
I use fill_between() and log axis without problems in the following way (it's by memory, I hope the sintax is correct)
fig = plt.figure()
spl = fig.add_subplot(111)
spl.fill_between(x,y1,y2)
spl.set_yscale("log")
plt.show()
Cheers,
Fra
Il giorno 06/mag/2011, alle ore 01.34, Benjamin Root ha scritto:
> 
> 
> On Tue, May 3, 2011 at 3:40 AM, K.-Michael Aye <kmi...@gm...> wrote:
> A colleague posed an interesting challenge:
> How to do a filled plot having the y-axis in logarithm?
> I think I can do it with creating patches myself an adding it to the
> axis, but isn't there anything built-in?
> 
> Best regards,
> Michael
> 
> 
> 
> Does fill_between() not work for you? Note, I have never tried it on a log scale plot.
> 
> Ben Root
> 
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network 
> management toolset available today. Delivers lowest initial 
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Benjamin R. <ben...@ou...> - 2011年05月06日 04:33:51
On Thursday, May 5, 2011, Nate Gallagher <nat...@ya...> wrote:
> Is there a list archive I can search to see if a question has been asked before?
> Thanks,
> Nate
>
http://old.nabble.com/matplotlib---users-f2906.html
There are others as well. These are good formviewing the archives.
But for searches, I just use google with matplotlib as the first term.
 Most results usually point to a thread archived on nabble anyway.
I hope that helps!
Ben Root
From: Nate G. <nat...@ya...> - 2011年05月06日 04:17:47
Is there a list archive I can search to see if a question has been asked before?
Thanks,
Nate
From: C M <cmp...@gm...> - 2011年05月06日 03:01:30
> Because you have a py2exe'ed program, I suspect that whoever packaged the
> program should be the one to modify that program to choose its axes limits
> more robustly in order to avoid the warning message.
Maybe I have been unclear. I am the sole developer of this
application, and I occasionally test it as a py2exe'd app in
anticipation of delivering it in that form at some point. I would be
happy to modify the program to choose its axes limits more
robustly--if I only knew how to do that. That is what I am asking.
How should I do that?
The data to be plotted is a very simple date plot with dates on the x
axis and values (formatted as time) on the y axis.
Che
From: Benjamin R. <ben...@ou...> - 2011年05月06日 02:21:12
On Thu, May 5, 2011 at 9:04 PM, C M <cmp...@gm...> wrote:
> On Thu, May 5, 2011 at 10:03 PM, C M <cmp...@gm...> wrote:
> > On Thu, May 5, 2011 at 7:58 PM, Benjamin Root <ben...@ou...> wrote:
> >>
> >>
> >> On Sun, May 1, 2011 at 4:35 PM, C M <cmp...@gm...> wrote:
> >>>
> >>> I get this error and would like to know what to do to eliminate it and
> >>> also what it means:
> >>>
> >>> C:\Python25\lib\site-packages\matplotlib\axes.py:2571:
> >>> UserWarning: Attempting to set identical bottom==top results
> >>> in singular transformations; automatically expanding.
> >>> bottom=0, top=0 + 'bottom=%s, top=%s') % (bottom, top))
> >>>
> >>> This is with Matplotlib 1.0.0.
> >>>
> >>> Thank you,
> >>> Che
> >>>
> >>
> > I have seen this happen when the plot is set to use the limits of the
> data
> > to guide the axes limits, but the data being displayed is either vertical
> or
> > horizontal.
>
> What do you mean by the data being vertical or horizontal? I can get
> this error with a single point that is plotted on a time vs. values
> plot.
>
>
Or even a single point. In other words, if the bounding box encompassing
the data being plotted can be reduced to a 1 or 0 dimensional
representation, then matplotlib will auto-pad this so that the rest of
matplotlib won't crash.
> > It isn't a huge issue as the code is automatically padding the
> > axes to make take the plot out of "flat world".
>
> The problem is, when I use a py2exe'd app this error occurs and the
> user sees a message to see the log file for the error. I don't want
> that at all. It's a bad user experience.
>
The warning message is important because it is usually an indication that
the program is doing something wrong. If you (and by "you", I mean the
program) might be plotting a single point or something that can be reduced
to 1 or 0 dimensions, then you should not have the axes automatically set
its limits from the data without pads.
Because you have a py2exe'ed program, I suspect that whoever packaged the
program should be the one to modify that program to choose its axes limits
more robustly in order to avoid the warning message.
Unless the other developers feel differently, I am against suppressing this
warning message.
I hope that makes things clearer.
Ben Root

Showing results of 39

1 2 > >> (Page 1 of 2)
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 によって変換されたページ (->オリジナル) /