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




Showing results of 285

<< < 1 .. 4 5 6 7 8 .. 12 > >> (Page 6 of 12)
What size/format do you need and would that be an option to transform/use Tango icons ?
http://tango.freedesktop.org/
http://commons.wikimedia.org/wiki/Tango_icons
Tango (for fullscreen but might suit tight-layout)
From: Brad M. <bra...@gm...> - 2012年07月18日 22:50:57
Hi, I have a collection of 4 plots that I spent some time in constructing.
They themselves include modifications of the axes labels, have rotated
subplots next to them, etc. I need to be able to take these 4 plots and
consolidate them into a single plot (referee suggestion to save space). So
is there an easy way for me to create a 2x2 array of my previous plots in a
single figure, perhaps only with labels (a), (b), (c), and (d) next to them?
The code for all of my plots looks similar to this (just with different
sets of data and labels):
 fig=figure()
>
> gs=matplotlib.gridspec.GridSpec(1,2,width_ratios=[3,1])
>
> gs.update(wspace=0.1)
>
> ax=subplot(gs[0])
>
> ylabel('Frequency (cm'+r'$^{-1}$'+')')
>
> for i in range(0,len(ydata)):
>
> plot(xdata[i],ydata[i],'r-',linewidth=1.5)
>
> plot(xdata[0],[0.0]*len(xdata[0]),'k:')
>
>
>> pos=[0,49.993913693,76.1020154736,136.396868606,188.614415645,240.831514922,
>
> 283.466414973,326.101863594,368.737312215]
>
>
>> locs,labels=xticks(pos,[r'$\Gamma$','P','Z',r'$\Gamma$','Q','Z','L',r'$\Gamm
>
> a$','F'])
>
> for i in range(0,len(pos)):
>
> plt.axvline(x=pos[i],linewidth=0.5,color='k',alpha=0.5)
>
> axis([0,368.738,0,300])
>
> ax2=subplot(gs[1])
>
> plot(dosydata,dosxdata,'r-',linewidth=1.5)
>
> a=gca()
>
> b=a.get_xticks()
>
> a.xaxis.set_ticks([0.0, 0.015, 0.03])
>
> a.set_xticklabels(['0','0.015','0.03'])
>
> a.tick_params(axis='x',labelsize=14)
>
> a.set_xlim([0,0.03])
>
> a.set_ylim([0,300])
>
> ax.label_outer()
>
> ax2.label_outer()
>
>
>> show()
>
>
>
I made an attempt at doing this by keeping much of my code the same (except
for repeating it for the 4 instances in one script) and then adding in
commands like 'subplot(221)', 'subplot(222)', etc., but this did not appear
to work. I suppose I don't really understand how to construct a larger
figure that contains everything with subplots which themselves contain
subplots. Although I feel/hope that this should be easily done by some
means. Thanks a bunch for any suggestions you can give!
Best,
Brad
From: Benjamin R. <ben...@ou...> - 2012年07月18日 22:48:26
Hello all!
I have just about completed a PR that would add a new button to the
navigation toolbar for the tight_layout() action. I am hardly an artist
and have no clue how to graphically represent the tight_layout action in a
tiny icon. I would greatly welcome any graphics artist out there who could
provide such an icon for matplotlib.
Thanks!
Ben Root
From: Matthew T. <mat...@gm...> - 2012年07月18日 19:32:34
Hi there,
After seeing John Hunter's talking this morning at SciPy, where he
showed displaying the results of matplotlib.animation.Animation in the
IPython notebook (and having not seen Animation's "save" function
before) I tested it out myself. It worked quite nicely for local,
scripted jobs. Thanks!
Anyway, one of the most common use cases I have is to distribute data
to workers, where typically each worker does their own analysis,
visualization, and then dumps the resultant Matplotlib figure to disk,
where I assemble them by hand. It would be really awesome to be able
to use the matplotlib animation framework from within this, during the
normal reduction phase.
Is there a simple way to either pass in a list of filenames to the
animation process (looks like the _make_movie function might be a good
candidate) in a forward-compatible way, or a simple way to read in an
image from disk and make the entirety of a figure that image? It
seems like either of these would work -- the former, so that I could
hand assemble, and the latter so that we could write a "func" for
FuncAnimation that would simply stream back the on-disk files.
Thanks for any ideas,
Matt
From: Francesco M. <fra...@gm...> - 2012年07月18日 14:50:55
2012年7月18日 Jonathan Slavin <js...@cf...>:
> Ben,
>
> Yes, you're right, but I doubt any solution that involves mimicking an
> alpha channel will work for one case that I've been using. That is,
> making the legend box partially transparent. I use that to allow the
> box to fit in the plot without blocking the data and without the need to
> make the upper y limit too large.
My solution would probably work if you could, pixel by pixel (or patch
by patch), mimic alpha in each layer using as background the resulting
color of the previous layer.
Do anyone know if it is possible to implement something like this in
matplotlib when saving a eps or in a backend?
>
> I don't notice any problems with blockiness in the text or lines in the
> raster image. I'll find out soon if the editors of the Astrophysical
> Journal are okay with the figures.
I guess that you produce the figures roughly of the right size (about
8 or 16 cms wide for single or double column figures) and then
convert. So probably you see that the figure is a raster if you zoom
in.
Fra
>
> Jon
>
> On Tue, 2012年07月17日 at 15:34 -0500, Benjamin Root wrote:
>>
>>
>> On Tue, Jul 17, 2012 at 3:01 PM, Jonathan Slavin
>> <js...@cf...> wrote:
>> Francesco,
>>
>> While I like your solution, there is an alternative that is
>> simpler and
>> works for me. That is 1) save matplotlib plot as a png, 2)
>> convert to
>> eps using either ImageMagick or GraphicsMagick. You do end up
>> with
>> relatively large files, but they look identical to the
>> original plots.
>>
>> Regards,
>> Jon
>>
>> No, it is not the same thing. Text in a vector-based format such as
>> eps is scalable. ImageMagick and GraphicsMagick are inherently
>> raster-based, and before that, PNGs are raster-based. Therefore, the
>> text is not scaled and anti-aliased according to the display size.
>>
>> I will be looking over the proposed solution this evening.
>>
>> Cheers!
>> Ben Root
>>
>>
> --
> ______________________________________________________________
> Jonathan D. Slavin Harvard-Smithsonian CfA
> js...@cf... 60 Garden Street, MS 83
> phone: (617) 496-7981 Cambridge, MA 02138-1516
> cell: (781) 363-0035 USA
> ______________________________________________________________
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jonathan S. <js...@cf...> - 2012年07月18日 14:34:31
Ben,
Yes, you're right, but I doubt any solution that involves mimicking an
alpha channel will work for one case that I've been using. That is,
making the legend box partially transparent. I use that to allow the
box to fit in the plot without blocking the data and without the need to
make the upper y limit too large.
I don't notice any problems with blockiness in the text or lines in the
raster image. I'll find out soon if the editors of the Astrophysical
Journal are okay with the figures.
Jon
On Tue, 2012年07月17日 at 15:34 -0500, Benjamin Root wrote:
> 
> 
> On Tue, Jul 17, 2012 at 3:01 PM, Jonathan Slavin
> <js...@cf...> wrote:
> Francesco,
> 
> While I like your solution, there is an alternative that is
> simpler and
> works for me. That is 1) save matplotlib plot as a png, 2)
> convert to
> eps using either ImageMagick or GraphicsMagick. You do end up
> with
> relatively large files, but they look identical to the
> original plots.
> 
> Regards,
> Jon
> 
> No, it is not the same thing. Text in a vector-based format such as
> eps is scalable. ImageMagick and GraphicsMagick are inherently
> raster-based, and before that, PNGs are raster-based. Therefore, the
> text is not scaled and anti-aliased according to the display size.
> 
> I will be looking over the proposed solution this evening.
> 
> Cheers!
> Ben Root
> 
> 
-- 
______________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
js...@cf... 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
 cell: (781) 363-0035 USA
______________________________________________________________
From: Gökhan S. <gok...@gm...> - 2012年07月17日 22:35:42
There is one issue I spotted in this code. Although hard to notice from the
produced plot, only the latest grid is updated when set_ydata is called. So
a slight modification makes this code running correctly as originally
intended.
L1list = []
L2list = []
for i in range(nums): for j in range(xx*16, xx*16+16): if i == 0:
L1list.append(grid[j%16].plot(dd1, conc1[j], color='r', lw=1.5)[0])
L2list.append(grid[j%16].plot(dd2, conc2[j], color='b', lw=1.5)[0]) grid[j%
16].set_xscale('log') grid[j%16].set_xticks([10, 100, 1000]) grid[j%16].
set_yticks([-25, 0, 25]) grid[j%16].yaxis.set_minor_locator(ticker.
MultipleLocator(5)) grid[j%16].set_xlim(1,2000, auto=False) grid[j%16].
set_ylim(-50,50, auto=False) else: L1list(j%16).set_ydata(conc1[j])
L2list(j%16).set_ydata(conc2[j])
On Thu, Jul 5, 2012 at 11:15 AM, Fabrice Silva <si...@lm...>wrote:
>
>
> > At end of the outer loop, instead of closing the figure, you should
> > call "remove()" for each plot element you made. Essentially, as you
> > loop over the inner loop, save the output of the plot() call to a
> > list, and then when done with those plots, pop each element of that
> > list and call "remove()" to take it out of the subplot. This will let
> > the subplot axes retain the properties you set earlier.
>
> Instead of remove()'ing the graphical elements, you can also reuse them
> if the kind of plots you intend to do is the same along the figure
> for simple plots. See : http://paste.debian.net/177857/
>
> --
> Fabrice Silva
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Gökhan
From: Benjamin R. <ben...@ou...> - 2012年07月17日 20:35:05
On Tue, Jul 17, 2012 at 3:01 PM, Jonathan Slavin <js...@cf...>wrote:
> Francesco,
>
> While I like your solution, there is an alternative that is simpler and
> works for me. That is 1) save matplotlib plot as a png, 2) convert to
> eps using either ImageMagick or GraphicsMagick. You do end up with
> relatively large files, but they look identical to the original plots.
>
> Regards,
> Jon
>
No, it is not the same thing. Text in a vector-based format such as eps is
scalable. ImageMagick and GraphicsMagick are inherently raster-based, and
before that, PNGs are raster-based. Therefore, the text is not scaled and
anti-aliased according to the display size.
I will be looking over the proposed solution this evening.
Cheers!
Ben Root
From: Jonathan S. <js...@cf...> - 2012年07月17日 20:30:26
Francesco,
While I like your solution, there is an alternative that is simpler and
works for me. That is 1) save matplotlib plot as a png, 2) convert to
eps using either ImageMagick or GraphicsMagick. You do end up with
relatively large files, but they look identical to the original plots.
Regards,
Jon
> Dear matplotlibers,
> 
> after spending some more time about my problem on how to
> emulate
> transparency to create nice eps figures with shaded areas,
> I found this web page:
> http://stackoverflow.com/questions/2049230/convert-rgba-color-to-rgb?rq=1
> 
> So I decided to implement the algorithm and it seems that the
> approach
> works (see attached pdf).
> Of course if there are many layers of transparent colors, it
> would be
> very hard to get the exact colors, but so far it's the best
> approach
> that I've found.
> 
> The code can be downloaded from here:
> https://github.com/montefra/mimic_alpha/downloads
> 
> Cheers,
> Francesco
-- 
______________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
js...@cf... 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
 cell: (781) 363-0035 USA
______________________________________________________________
From: Eric F. <ef...@ha...> - 2012年07月17日 19:54:42
On 2012年07月09日 7:33 AM, Brendan Barnwell wrote:
> On 2012年07月09日 06:13, Benjamin Root wrote:
>> On Sun, Jul 8, 2012 at 9:04 PM, Brendan Barnwell<bre...@br...>wrote:
>>> cs = pyplot.contourf(x,y,z,levels=np.arange(50, 220, 20),
>>> cmap=pyplot.cm.jet, extend='both')
>>> cs.cmap.set_under('k')
>>> cs.set_clim(50, 210)
>>> cb = pyplot.colorbar(cs)
>>>
>>> But why do I have to do this? The whole reason I passed in my
>>> specified levels was because I wanted THOSE to be the data limits.
>>> Why is matplotlib expanding the data limits, and thus preventing me
>>> from specifying the "out of range" color using the normal set_under
>>> and set_over methods?
>>>
>>>
>> You are right, that behavior is very inconsistent with the documentation.
>> Looking over the QuadContourSet._process_levels() method, I doubt the
>> problem lies there. While testing, I noticed that whatever color I set for
>> set_under() was always being ignored in the colorbar. I suspect the
>> problem lies there.
>
> 	You mean in the colorbar and/or set_under? I don't think so, because
> the problem occurs whether or not you use a colorbar, and, at least
> for me, set_under works as long as the data limits are set correctly.
> If in my code above, I change set_under("k") to set_under("yellow")
> or whatever else I like, that color is correctly used both in the
> contourf plot and on the colorbar (on the lower arrow). The code that
> I pointed to in _process_levels is setting vmin and vmax. It's
> possible this isn't the root of the problem, but the code certainly
> looks strange and unmotivated, and it is what's causing incorrect clim
> to be set.
>
Please check out https://github.com/matplotlib/matplotlib/pull/1022.
Eric
From: Yannick C. <yan...@la...> - 2012年07月17日 19:20:44
On 07/17/2012 03:32 PM, Benjamin Root wrote:
> Short question: is there any (simple) way to generate "spectral" images
> such as the ones in http://astro.u-strasbg.fr/~koppen/discharge/
> <http://astro.u-strasbg.fr/%7Ekoppen/discharge/> ?
I have a 1st version of what I had in mind:
https://gist.github.com/3131381
Any comments on how to do it the proper way (e.g. good use of normalize 
and colormaps) is welcome!
Cheers,
From: Jae-Joon L. <lee...@gm...> - 2012年07月17日 17:17:33
I think it is me who put that code there. But I cannot recall why I did it.
I may have copied that behavior from other code, but cannot find which.
Yes, I agree that the current behavior is not very desirable.
So, anyone who have an idea how this should behave, please go ahead
and fix this.
Regards,
-JJ
On Sun, Jul 15, 2012 at 1:54 AM, John Hunter <jd...@gm...> wrote:
>
>
> On Sat, Jul 14, 2012 at 11:48 AM, John Hunter <jd...@gm...> wrote:
>>
>> I do not understand why in the following example, if I set
>> patch_alpha=1.0, I do not see the shadow effect. I would expect to see it
>> for the the rightmost four bars, where the original bars do not entirely
>> occlude the shadow, so even if alpha is 1.0, there are parts of the shadow
>> that are not behind the original bars and should still be visible.
>>
>>
>
>
> I now see that this line explains the behavior
>
> https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/patheffects.py#L183
>
> gc0.set_alpha(1.-self._patch_alpha)
>
> so maybe I should amend my question: is this desirable that the shadow alpha
> is 1-patch_alpha, since an alpha of 1 on the patch does not imply that there
> is no visible shadow?
>
>
From: Francesco M. <fra...@gm...> - 2012年07月17日 15:10:16
Dear matplotlibers,
after spending some more time about my problem on how to emulate
transparency to create nice eps figures with shaded areas,
I found this web page:
http://stackoverflow.com/questions/2049230/convert-rgba-color-to-rgb?rq=1
So I decided to implement the algorithm and it seems that the approach
works (see attached pdf).
Of course if there are many layers of transparent colors, it would be
very hard to get the exact colors, but so far it's the best approach
that I've found.
The code can be downloaded from here:
https://github.com/montefra/mimic_alpha/downloads
Cheers,
Francesco
From: Damon M. <dam...@gm...> - 2012年07月17日 14:28:40
On Tue, Jul 17, 2012 at 08:21:50AM -0500, Benjamin Root wrote:
> On Tue, Jul 17, 2012 at 6:25 AM, todd rme <tod...@gm...> wrote:
> 
> > On Wed, Jul 11, 2012 at 5:23 PM, John Hunter <jd...@gm...> wrote:
> > >
> > >
> > > On Wed, Jul 11, 2012 at 10:09 AM, Damon McDougall
> > > <dam...@gm...> wrote:
> > >>
> > >> Well, as Ben said, that error fill plot is neato! It doesn't look too
> > >> complicated, either. I'd be more than happy to port it over later today
> > >> when I get bored of typing up my thesis. It'll probably only take me
> > >> about 30 minutes.
> > >>
> > >> If nobody is opposed to this idea, I'll go ahead and submit a PR this
> > >> evening (British Summer (hah!) Time).
> > >
> > >
> > >
> > > While it is a nice graph, I am not sure that the use case is common
> > enough
> > > to justify a new plotting method. One can get the same result with:
> > >
> > >
> > > In [68]: x = np.linspace(0, 2 * np.pi)
> > >
> > > In [69]: y_sin = np.sin(x)
> > >
> > > In [70]: err = np.concatenate([y_sin + 0.2, y_sin[::-1] - 0.2])
> > >
> > > In [71]: plot(x, y_sin)
> > > Out[71]: [<matplotlib.lines.Line2D object at 0x96959ec>]
> > >
> > > In [72]: fill_between(np.concatenate([x, x[::-1]]), err,
> > facecolor='red',
> > > alpha=0.5)
> > > Out[72]: <matplotlib.collections.PolyCollection object at 0x962758c>
> > >
> > > Admittedly the [::-1] thing is a bit counter-intuitive, but rather than
> > > adding a new plotting method, perhaps we would be better off with a
> > helper
> > > method to create the xs and ys for fill_between
> > >
> > > xs, ys = mlab.pad_line(x, y, 0.2)
> > > fill_between(xs, ys)
> > >
> > > JDH
> >
> > What about adding a property to the existing errorbar to let someone
> > change it to the filled version? This could also, potentially, be
> > extended with other types of error bars if the need arises.
> >
> > -Todd
> >
> 
> Intriguing idea. I am actually quite comfortable with that.
> 
I like this idea, too.
> Ben Root
-- 
Damon McDougall
http://damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
From: Benjamin R. <ben...@ou...> - 2012年07月17日 13:32:38
On Tue, Jul 17, 2012 at 8:12 AM, Yannick Copin <yan...@la...>wrote:
> Hi List,
>
> Short question: is there any (simple) way to generate "spectral" images
> such as the ones in http://astro.u-strasbg.fr/~koppen/discharge/ ?
>
> Long version: say I have 1D-array l, which I would like to visualize as
> the L component of an HSL image, where the HS component would e.g. come
> from the standard "spectral" cmap (that's what I think I understood of
> the problem, but maybe what I said is just nonsense...). How should I
> proceed?
>
> Cheers,
>
I would utilize the ColorbarBase object. It has a method "add_lines()"
where you could add black lines at the locations you want.
Cheers!
Ben Root
From: Benjamin R. <ben...@ou...> - 2012年07月17日 13:22:20
On Tue, Jul 17, 2012 at 6:25 AM, todd rme <tod...@gm...> wrote:
> On Wed, Jul 11, 2012 at 5:23 PM, John Hunter <jd...@gm...> wrote:
> >
> >
> > On Wed, Jul 11, 2012 at 10:09 AM, Damon McDougall
> > <dam...@gm...> wrote:
> >>
> >> Well, as Ben said, that error fill plot is neato! It doesn't look too
> >> complicated, either. I'd be more than happy to port it over later today
> >> when I get bored of typing up my thesis. It'll probably only take me
> >> about 30 minutes.
> >>
> >> If nobody is opposed to this idea, I'll go ahead and submit a PR this
> >> evening (British Summer (hah!) Time).
> >
> >
> >
> > While it is a nice graph, I am not sure that the use case is common
> enough
> > to justify a new plotting method. One can get the same result with:
> >
> >
> > In [68]: x = np.linspace(0, 2 * np.pi)
> >
> > In [69]: y_sin = np.sin(x)
> >
> > In [70]: err = np.concatenate([y_sin + 0.2, y_sin[::-1] - 0.2])
> >
> > In [71]: plot(x, y_sin)
> > Out[71]: [<matplotlib.lines.Line2D object at 0x96959ec>]
> >
> > In [72]: fill_between(np.concatenate([x, x[::-1]]), err,
> facecolor='red',
> > alpha=0.5)
> > Out[72]: <matplotlib.collections.PolyCollection object at 0x962758c>
> >
> > Admittedly the [::-1] thing is a bit counter-intuitive, but rather than
> > adding a new plotting method, perhaps we would be better off with a
> helper
> > method to create the xs and ys for fill_between
> >
> > xs, ys = mlab.pad_line(x, y, 0.2)
> > fill_between(xs, ys)
> >
> > JDH
>
> What about adding a property to the existing errorbar to let someone
> change it to the filled version? This could also, potentially, be
> extended with other types of error bars if the need arises.
>
> -Todd
>
Intriguing idea. I am actually quite comfortable with that.
Ben Root
From: todd r. <tod...@gm...> - 2012年07月17日 11:25:46
On Wed, Jul 11, 2012 at 5:23 PM, John Hunter <jd...@gm...> wrote:
>
>
> On Wed, Jul 11, 2012 at 10:09 AM, Damon McDougall
> <dam...@gm...> wrote:
>>
>> Well, as Ben said, that error fill plot is neato! It doesn't look too
>> complicated, either. I'd be more than happy to port it over later today
>> when I get bored of typing up my thesis. It'll probably only take me
>> about 30 minutes.
>>
>> If nobody is opposed to this idea, I'll go ahead and submit a PR this
>> evening (British Summer (hah!) Time).
>
>
>
> While it is a nice graph, I am not sure that the use case is common enough
> to justify a new plotting method. One can get the same result with:
>
>
> In [68]: x = np.linspace(0, 2 * np.pi)
>
> In [69]: y_sin = np.sin(x)
>
> In [70]: err = np.concatenate([y_sin + 0.2, y_sin[::-1] - 0.2])
>
> In [71]: plot(x, y_sin)
> Out[71]: [<matplotlib.lines.Line2D object at 0x96959ec>]
>
> In [72]: fill_between(np.concatenate([x, x[::-1]]), err, facecolor='red',
> alpha=0.5)
> Out[72]: <matplotlib.collections.PolyCollection object at 0x962758c>
>
> Admittedly the [::-1] thing is a bit counter-intuitive, but rather than
> adding a new plotting method, perhaps we would be better off with a helper
> method to create the xs and ys for fill_between
>
> xs, ys = mlab.pad_line(x, y, 0.2)
> fill_between(xs, ys)
>
> JDH
What about adding a property to the existing errorbar to let someone
change it to the filled version? This could also, potentially, be
extended with other types of error bars if the need arises.
-Todd
From: Tony Yu <ts...@gm...> - 2012年07月16日 22:38:15
On Mon, Jul 16, 2012 at 6:06 PM, Tony Yu <ts...@gm...> wrote:
>
>
> On Mon, Jul 16, 2012 at 3:07 PM, John Hunter <jd...@gm...> wrote:
>
>>
>>
>> On Tue, Jul 10, 2012 at 11:58 AM, Tony Yu <ts...@gm...> wrote:
>>
>>> Announcement: mpltools 0.1
>>> ==========================
>>>
>>> mpltools is a package of tools for matplotlib. For the most part, these
>>> tools are only loosely-connected in functionality, but there are two that
>>> may prove particularly useful:
>>>
>>> Styles and plot2rst
>>> -------------------
>>>
>>>
>> Tony, is there a way to "switch" styles rather than chain them. Eg, if
>> I do:
>>
>> import mpltools.style as style
>> style.use('ieee.transaction')
>> ...make_a_plot_...
>> style.use('ggplot')
>> . ..make_a_plot_...
>>
>> I seem to get the chained behavior of the second style updating the
>> first. I'd like to use this in a demo context where I can illustrate the
>> styles separately, so it would be nice to go back to the defaults.
>>
>> Interestingly, I tried to do:
>>
>> import matplotlib
>> matplotlib.rc_file_defaults()
>> plt.close('all')
>> hist(rand(10000), 100)
>>
>> but that simply stopped figures from raising all together (I don't think
>> this is related to mpltools, but to something funny going on on my system).
>>
>> So in summary, it would be nice to be able to do something like:
>>
>> style.use('default')
>>
>> or:
>>
>> style.reset()
>>
>> which would take you back to a clean slate.
>>
>>
> I've been using plt.rcdefaults() for that purpose. Does that work for you?
>
> -Tony
>
Err, maybe I read your question wrong. Were you just suggesting that I wrap
`matplotlib.rc_file_defaults()` in a new function called `style.reset()`,
or were you suggesting a function that does something different than
`rc_file_defaults`?
-Tony
From: Tony Yu <ts...@gm...> - 2012年07月16日 22:07:46
On Mon, Jul 16, 2012 at 3:07 PM, John Hunter <jd...@gm...> wrote:
>
>
> On Tue, Jul 10, 2012 at 11:58 AM, Tony Yu <ts...@gm...> wrote:
>
>> Announcement: mpltools 0.1
>> ==========================
>>
>> mpltools is a package of tools for matplotlib. For the most part, these
>> tools are only loosely-connected in functionality, but there are two that
>> may prove particularly useful:
>>
>> Styles and plot2rst
>> -------------------
>>
>>
> Tony, is there a way to "switch" styles rather than chain them. Eg, if I
> do:
>
> import mpltools.style as style
> style.use('ieee.transaction')
> ...make_a_plot_...
> style.use('ggplot')
> . ..make_a_plot_...
>
> I seem to get the chained behavior of the second style updating the first.
> I'd like to use this in a demo context where I can illustrate the styles
> separately, so it would be nice to go back to the defaults.
>
> Interestingly, I tried to do:
>
> import matplotlib
> matplotlib.rc_file_defaults()
> plt.close('all')
> hist(rand(10000), 100)
>
> but that simply stopped figures from raising all together (I don't think
> this is related to mpltools, but to something funny going on on my system).
>
> So in summary, it would be nice to be able to do something like:
>
> style.use('default')
>
> or:
>
> style.reset()
>
> which would take you back to a clean slate.
>
>
I've been using plt.rcdefaults() for that purpose. Does that work for you?
-Tony
From: Keith J. <K....@ir...> - 2012年07月16日 20:49:55
Thanks Josh this is much appreciated. I will definitely have a look at this approach.
Just for clarification, my code does only create the figures when the frame is initialised. The plots are then updated/cleared as required.
Regards,
Keith
________________________________
From: Joshua Koehler [mailto:jjk...@gm...]
Sent: Tuesday, 17 July 2012 12:12 a.m.
To: mat...@li...
Subject: Re: [Matplotlib-users] wxpython matplotlib figure resize
Yes, my apologies for being a bit vague. Hopefully the following can help you out, but I can't make promises. It did fix the issue for me.
First off, from reading other threads about handling figures, it might be better to use matplotlib.pylab.figure instead of matplotlib.figure. Apparently the former registers the figure with a manager which allows for better cleanup.
Second, it looks to me from your code as if you are creating a figure every time a new plot is created. Is this correct? Or are these functions just called on startup? If you are creating a new figure each time for a plot, (which is what I was originally doing) you should redesign so you keep the same figure and then just update the subplots. Clear the figure and then add the appropriate subplots. Here is a segment from my code:
def plot(figure, rows, cols, graph, title):
 figure.clear()
 plt.figure(figure.number)
 pos_counter = 1
 for g in graph:
 g.axes = figure.add_subplot(rows, cols, pos_counter)
 if title:
 g.axes.set_title(g.plot_title)
 plot_nx(g, plot_options=g.plot_options)
 pos_counter = pos_counter + 1
 figure.canvas.draw()
plt is the pylab module from matplotlib and plot_nx is an internal call to networkx plotting capabiility (same as if you called the pyplot.plot). If you do use pylab, make sure to include the plt.figure(figure.number) call as this seems to be a bug (or perhaps this just is with networkx integration).
This setup works for me rather well. I no longer have to manually resize anything.
I hope that helps. If not, I am at a loss for what would be a good way to proceed. I, probably like you, spent a long time trying to figure this one out and found this to be the best solution. It might be good to go with the clunky mechanism since it works and wait until this is addressed later (if it is indeed a bug)
Regards,
Josh
On Jul 14, 2012, at 4:13 AM, Keith Jones wrote:
Hi Josh,
I am not quite sure what information you need, but I have an application with several wx notebooks, each with pages carrying related but different 2D and 3D plots. I hope this overview covers what you want. In the code below I set up the axes and toolbar in each panel ready to accept plots as required. I use wxFormbuilder to create MyFrame1 and then this code to add graphs and other functionality. The 'tickle' function is called when a notebook is selected for display.
import wx
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
from matplotlib.figure import Figure
from mpl_toolkits.mplot3d import Axes3D
class ProjectFrame(bare_gui.MyFrame1):
 def __init__( self, parent):
 bare_gui.MyFrame1.__init__( self, parent)
...
 self.Create2DGraph(self.CT_graph_1, "Current / %")#CT notebook
 self.Create2DGraph(self.VT_graph_1, "Voltage/ %")#VT notebook
...
 self.Show(True)
 def Create2DGraph(self, panel, xlabel):
 panel.figure = Figure(None)
 panel.canvas = FigureCanvas(panel, -1, panel.figure)
 panel.axes1 = panel.figure.add_subplot(2,1,1)
 panel.axes2 = panel.figure.add_subplot(2,1,2)
 panel.axes1.set_xlabel(xlabel)
 panel.axes1.set_ylabel('Error / %')
 panel.axes2.set_xlabel(xlabel)
 panel.axes2.set_ylabel('Phase / crad')
 panel.sizer = wx.BoxSizer(wx.VERTICAL)
 panel.sizer.Add(panel.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
 panel.SetSizer(panel.sizer)
 panel.Fit()
 self.add_2Dtoolbar(panel)
 def add_2Dtoolbar(self, panel):
 panel.toolbar = NavigationToolbar2WxAgg(panel.canvas)
 panel.toolbar.Realize()
 tw, th = panel.toolbar.GetSizeTuple()
 fw, fh = panel.canvas.GetSizeTuple()
 panel.toolbar.SetSize(wx.Size(fw, th))
 panel.sizer.Add(panel.toolbar, 0, wx.LEFT | wx.EXPAND)
 # update the axes menu on the toolbar
 panel.toolbar.update()
 def Create3DGraph(self, panel):
 panel.figure = Figure(None)
 panel.canvas = FigureCanvas(panel, -1, panel.figure)
 panel.ax = Axes3D(panel.figure)
 #these labels should be selected later for specific components
 panel.ax.set_xlabel('Current / %')
 panel.ax.set_ylabel('Phase / degree')
 panel.ax.set_zlabel('Error / %')
 panel.sizer = wx.BoxSizer(wx.VERTICAL)
 panel.sizer.Add(panel.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
 panel.SetSizer(panel.sizer)
 panel.Fit()
 self.add_2Dtoolbar(panel)
________________________________
From: Joshua Koehler [jjk...@gm...]
Sent: Friday, 13 July 2012 10:45 p.m.
To: mat...@li...<mailto:mat...@li...>
Subject: Re: [Matplotlib-users] wxpython matplotlib figure resize
Hi Keith,
How are you storing the plot in the frame/panel?
Josh
On Jul 12, 2012, at 11:59 PM, Keith Jones wrote:
Hi Josh,
Yes I too am using the wx backend.
Regards,
Keith
________________________________
From: Tony Yu [mailto:ts...@gm...]
Sent: Friday, 13 July 2012 3:16 p.m.
To: Keith Jones
Cc: Joshua Koehler; mat...@li...<mailto:mat...@li...>
Subject: Re: [Matplotlib-users] wxpython matplotlib figure resize
On Thu, Jul 12, 2012 at 9:27 PM, Keith Jones <K....@ir...<mailto:K....@ir...>> wrote:
Hi,
I am interested in a better solution to this problem, but I have used this simple method to force the right size.
 def tickle(self):
 #gets frame to redraw and resize, not elegant.
 if self.IsMaximized(): #then needs a kick
 self.Restore()
 self.Maximize()
 else:
 x,y = self.GetSize()
 self.SetSize((x-1, y-1))
 self.SetSize((x, y))
Regards,
Keith
________________________________
From: Joshua Koehler [mailto:jjk...@gm...<mailto:jjk...@gm...>]
Sent: Saturday, 7 July 2012 1:51 a.m.
To: mat...@li...<mailto:mat...@li...>
Subject: [Matplotlib-users] wxpython matplotlib figure resize
Hi all,
I am currently trying to use matplotlib with wxPython and all is going well except for one annoying issue that I can't figure out.
I initialize a wxcanvas object with a figure and then throughout the life of the program I want the canvas' figure to change and display the corresponding plot. I can get the change of figure, but when the program goes to plot, the figure isn't the right size. It changes to the right size only when I manually resize the figure (see attached images). Is there some command that I am missing? This is the update sequence I am using:
self.figure = figure
 self.canvas.figure.clear()
 self.canvas.figure = self.figure
 self.canvas.draw()
 self.color_background()
 #self.GetParent().Layout()
 #self.SetSizer(self.main_sizer)
 #self.Fit()
 self.SendSizeEvent()
As you can tell from the comments (there are more in my code), I have tried a variety of ways to update the figure off the bat.
Thanks!
Josh
This may be similar to a Qt-backend bug, which didn't take the toolbar into account when resizing the figure:
https://github.com/matplotlib/matplotlib/pull/756
It doesn't quite fit, though, because Josh's original example shows a figure that's the correct size (but the axes doesn't fill the figure). The toolbar issue tended to squish the axes in the vertical direction (at least in the GUI window), whereas Josh's example is squished in the horizontal direction.
Keith: Are you also using the Wx-backend? I don't have Wx installed so I can't provide much help. I've been planning to take a look at a similar issue in the Tk backend, but haven't had time.
Best,
-Tony
________________________________
This electronic transmission and any documents accompanying this electronic transmission contain confidential information belonging to the sender. This information may be legally privileged. The information is intended only for the use of the individual or entity named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on or regarding the contents of this electronically transmitted information is strictly prohibited.
From: <la...@fr...> - 2012年07月16日 19:48:52
Hello,
I am trying to install basemap from debian packages, but I am not able
to have it run properly.
Here are my tests:
import matplotlib as mpl
import mpl_toolkits.basemap as bm
import numpy as np
print "GEOS version: ", bm._geoslib.__geos_version__
print "basemap version: ", bm.__version__
print "numpy version: ", np.__version__
print "matplotlib version: ", mpl.__version__
map = bm.Basemap(projection='ortho', lat_0 = 50, lon_0 = -100,
 resolution = 'l', area_thresh = 1000.)
map.drawcountries()
map.fillcontinents(color = 'coral')
map.drawmapboundary()
map.drawmeridians(np.arange(0, 360, 30))
map.drawparallels(np.arange(-90, 90, 30))
plt.show()
gives:
/usr/lib/pymodules/python2.7/mpl_toolkits/__init__.py:2: UserWarning:
Module dap was already imported from None, but
/usr/lib/python2.7/dist-packages is being added to sys.path
 __import__('pkg_resources').declare_namespace(__name__)
GEOS version: 3.3.1-CAPI-1.7.1
basemap version: 1.0.2
numpy version: 1.5.1
matplotlib version: 1.1.0
GEOS_ERROR: TopologyException: found non-noded intersection between
LINESTRING (170.007 -0.00578472, 170.021 -0.0173561) and LINESTRING
(349.986 -0.0115701, -10 0) at 170.007 -0.00578549
Erreur de segmentation
Thanks for your help,
Lazlo
<<<
From: John H. <jd...@gm...> - 2012年07月16日 19:07:37
On Tue, Jul 10, 2012 at 11:58 AM, Tony Yu <ts...@gm...> wrote:
> Announcement: mpltools 0.1
> ==========================
>
> mpltools is a package of tools for matplotlib. For the most part, these
> tools are only loosely-connected in functionality, but there are two that
> may prove particularly useful:
>
> Styles and plot2rst
> -------------------
>
>
Tony, is there a way to "switch" styles rather than chain them. Eg, if I
do:
 import mpltools.style as style
 style.use('ieee.transaction')
 ...make_a_plot_...
 style.use('ggplot')
. ..make_a_plot_...
I seem to get the chained behavior of the second style updating the first.
 I'd like to use this in a demo context where I can illustrate the styles
separately, so it would be nice to go back to the defaults.
Interestingly, I tried to do:
 import matplotlib
 matplotlib.rc_file_defaults()
 plt.close('all')
 hist(rand(10000), 100)
but that simply stopped figures from raising all together (I don't think
this is related to mpltools, but to something funny going on on my system).
So in summary, it would be nice to be able to do something like:
 style.use('default')
or:
 style.reset()
which would take you back to a clean slate.
From: Nicolas R. <Nic...@in...> - 2012年07月16日 12:12:10
Here is a quick example that might help you:
http://www.loria.fr/~rougier/coding/gallery/showcase/showcase-10-large.png
http://www.loria.fr/~rougier/coding/gallery/showcase/showcase-10.py
Nicolas
On Jul 16, 2012, at 11:27 , Daπid wrote:
> On Mon, Jul 16, 2012 at 11:09 AM, Benjamin Jonen <bj...@gm...> wrote:
>> 2) The coloring and the way the lines curve around looks very nice to
>> me. I remember that the Excel charts did not have this nice look
>> before Excel 2007. Can I achieve similar effects with matplotlib? I'm
>> not really sure what creates this nice look, so this question is of
>> course a little fuzzy.
> 
> Maybe you are thinking about the smoothness of the curves. Even you
> have spaced points, they don't do sharp edges. In my opinion, for
> scientific research, they shouldn't be concealed in the general case,
> and this is, I think, the main target of MPL.
> 
> Nevertheless, if in your case it makes sense and you want them to be
> smooth, you can do it through SciPy, applying a interpolation scheme.
> 
> tck=scipy.interpolate(datax, datay)
> datax_n=np.arange(datax.min(), datax.max(), len(datax)*20)
> datay_n=sicpy.interpolate(splev(datax_n,tck,der=0)
> 
> And then you plot datax_n and datay_n.
> 
> http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#spline-interpolation-in-1-d-procedural-interpolate-splxxx
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Joshua K. <jjk...@gm...> - 2012年07月16日 12:10:17
Yes, my apologies for being a bit vague. Hopefully the following can help you out, but I can't make promises. It did fix the issue for me.
First off, from reading other threads about handling figures, it might be better to use matplotlib.pylab.figure instead of matplotlib.figure. Apparently the former registers the figure with a manager which allows for better cleanup. 
Second, it looks to me from your code as if you are creating a figure every time a new plot is created. Is this correct? Or are these functions just called on startup? If you are creating a new figure each time for a plot, (which is what I was originally doing) you should redesign so you keep the same figure and then just update the subplots. Clear the figure and then add the appropriate subplots. Here is a segment from my code:
def plot(figure, rows, cols, graph, title):
 figure.clear()
 plt.figure(figure.number)
 pos_counter = 1
 for g in graph:
 g.axes = figure.add_subplot(rows, cols, pos_counter)
 if title:
 g.axes.set_title(g.plot_title)
 plot_nx(g, plot_options=g.plot_options)
 pos_counter = pos_counter + 1
 figure.canvas.draw()
plt is the pylab module from matplotlib and plot_nx is an internal call to networkx plotting capabiility (same as if you called the pyplot.plot). If you do use pylab, make sure to include the plt.figure(figure.number) call as this seems to be a bug (or perhaps this just is with networkx integration). 
This setup works for me rather well. I no longer have to manually resize anything. 
I hope that helps. If not, I am at a loss for what would be a good way to proceed. I, probably like you, spent a long time trying to figure this one out and found this to be the best solution. It might be good to go with the clunky mechanism since it works and wait until this is addressed later (if it is indeed a bug)
Regards,
Josh
On Jul 14, 2012, at 4:13 AM, Keith Jones wrote:
> Hi Josh,
> I am not quite sure what information you need, but I have an application with several wx notebooks, each with pages carrying related but different 2D and 3D plots. I hope this overview covers what you want. In the code below I set up the axes and toolbar in each panel ready to accept plots as required. I use wxFormbuilder to create MyFrame1 and then this code to add graphs and other functionality. The 'tickle' function is called when a notebook is selected for display.
> 
> import wx
> from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
> from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
> from matplotlib.figure import Figure
> from mpl_toolkits.mplot3d import Axes3D
> 
> class ProjectFrame(bare_gui.MyFrame1):
> def __init__( self, parent):
> bare_gui.MyFrame1.__init__( self, parent)
> ...
> self.Create2DGraph(self.CT_graph_1, "Current / %")#CT notebook
> self.Create2DGraph(self.VT_graph_1, "Voltage/ %")#VT notebook
> ...
> self.Show(True)
> 
> def Create2DGraph(self, panel, xlabel):
> panel.figure = Figure(None)
> panel.canvas = FigureCanvas(panel, -1, panel.figure)
> panel.axes1 = panel.figure.add_subplot(2,1,1)
> panel.axes2 = panel.figure.add_subplot(2,1,2)
> panel.axes1.set_xlabel(xlabel)
> panel.axes1.set_ylabel('Error / %')
> panel.axes2.set_xlabel(xlabel)
> panel.axes2.set_ylabel('Phase / crad')
> panel.sizer = wx.BoxSizer(wx.VERTICAL)
> panel.sizer.Add(panel.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
> panel.SetSizer(panel.sizer)
> panel.Fit()
> self.add_2Dtoolbar(panel)
> 
> def add_2Dtoolbar(self, panel):
> panel.toolbar = NavigationToolbar2WxAgg(panel.canvas)
> panel.toolbar.Realize()
> tw, th = panel.toolbar.GetSizeTuple()
> fw, fh = panel.canvas.GetSizeTuple()
> panel.toolbar.SetSize(wx.Size(fw, th))
> panel.sizer.Add(panel.toolbar, 0, wx.LEFT | wx.EXPAND)
> # update the axes menu on the toolbar
> panel.toolbar.update()
> 
> def Create3DGraph(self, panel):
> panel.figure = Figure(None)
> panel.canvas = FigureCanvas(panel, -1, panel.figure)
> panel.ax = Axes3D(panel.figure)
> #these labels should be selected later for specific components
> panel.ax.set_xlabel('Current / %')
> panel.ax.set_ylabel('Phase / degree')
> panel.ax.set_zlabel('Error / %')
> panel.sizer = wx.BoxSizer(wx.VERTICAL)
> panel.sizer.Add(panel.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
> panel.SetSizer(panel.sizer)
> panel.Fit()
> self.add_2Dtoolbar(panel)
> From: Joshua Koehler [jjk...@gm...]
> Sent: Friday, 13 July 2012 10:45 p.m.
> To: mat...@li...
> Subject: Re: [Matplotlib-users] wxpython matplotlib figure resize
> 
> Hi Keith,
> 
> How are you storing the plot in the frame/panel?
> 
> Josh
> On Jul 12, 2012, at 11:59 PM, Keith Jones wrote:
> 
>> Hi Josh,
>> Yes I too am using the wx backend.
>> 
>> Regards,
>> Keith
>> 
>> From: Tony Yu [mailto:ts...@gm...] 
>> Sent: Friday, 13 July 2012 3:16 p.m.
>> To: Keith Jones
>> Cc: Joshua Koehler; mat...@li...
>> Subject: Re: [Matplotlib-users] wxpython matplotlib figure resize
>> 
>> 
>> On Thu, Jul 12, 2012 at 9:27 PM, Keith Jones <K....@ir...> wrote:
>> Hi,
>> I am interested in a better solution to this problem, but I have used this simple method to force the right size.
>> 
>> def tickle(self):
>> #gets frame to redraw and resize, not elegant.
>> if self.IsMaximized(): #then needs a kick
>> self.Restore()
>> self.Maximize()
>> else:
>> x,y = self.GetSize()
>> self.SetSize((x-1, y-1))
>> self.SetSize((x, y))
>> 
>> Regards,
>> Keith
>> 
>> From: Joshua Koehler [mailto:jjk...@gm...] 
>> Sent: Saturday, 7 July 2012 1:51 a.m.
>> To: mat...@li...
>> Subject: [Matplotlib-users] wxpython matplotlib figure resize
>> 
>> Hi all,
>> 
>> I am currently trying to use matplotlib with wxPython and all is going well except for one annoying issue that I can't figure out. 
>> 
>> I initialize a wxcanvas object with a figure and then throughout the life of the program I want the canvas' figure to change and display the corresponding plot. I can get the change of figure, but when the program goes to plot, the figure isn't the right size. It changes to the right size only when I manually resize the figure (see attached images). Is there some command that I am missing? This is the update sequence I am using:
>> 
>> self.figure = figure
>> 
>> self.canvas.figure.clear()
>> self.canvas.figure = self.figure
>> self.canvas.draw()
>> self.color_background()
>> 
>> #self.GetParent().Layout()
>> #self.SetSizer(self.main_sizer)
>> #self.Fit()
>> self.SendSizeEvent()
>> 
>> As you can tell from the comments (there are more in my code), I have tried a variety of ways to update the figure off the bat.
>> 
>> Thanks!
>> 
>> Josh
>> 
>> 
>> This may be similar to a Qt-backend bug, which didn't take the toolbar into account when resizing the figure:
>> https://github.com/matplotlib/matplotlib/pull/756
>> It doesn't quite fit, though, because Josh's original example shows a figure that's the correct size (but the axes doesn't fill the figure). The toolbar issue tended to squish the axes in the vertical direction (at least in the GUI window), whereas Josh's example is squished in the horizontal direction.
>> 
>> Keith: Are you also using the Wx-backend? I don't have Wx installed so I can't provide much help. I've been planning to take a look at a similar issue in the Tk backend, but haven't had time.
>> 
>> Best,
>> -Tony
>> 
>> 
>> 
>> 
>> This electronic transmission and any documents accompanying this electronic transmission contain confidential information belonging to the sender. This information may be legally privileged. The information is intended only for the use of the individual or entity named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on or regarding the contents of this electronically transmitted information is strictly prohibited.
> 
> 
From: Andreas H. <li...@hi...> - 2012年07月16日 11:32:52
> Hi all,
>
> I've to draw a plot in a very small area (about 1 degree of height/width)
> with
> a map image.
> I've tried with the warpimage method and with the Nasa visible Earth
> images
> (http://visibleearth.nasa.gov/view_cat.php?categoryID=1484), but I've some
> problems:
> - with the resolution 21600x10800 the image is still too bad
> - with the resolution 21600x21600 the image is distributed in panels and
> warpimage method required a whole world image
>
> Merging the 6 panels maybe it can works, but I think my laptop can't
> process a
> so big image.
>
> Any suggestion for cutting the image area before passing it to Basemap?
> Or another kind of images to use?
>
> Thank you very much,
>
I recommend using GDAL (http://gdal.org/) for geospatial stuff. There's
Python bindings, but it'd be easier to just select the area you need from
the input file (using gdal_translate or gdalwarp), and then load the newly
created file for Basemap processing.
A.
10 messages has been excluded from this view by a project administrator.

Showing results of 285

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