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 5 results of 5

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
______________________________________________________________

Showing 5 results of 5

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