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


Showing 17 results of 17

From: Tony Yu <ts...@gm...> - 2012年05月23日 16:37:24
On Mon, May 21, 2012 at 4:01 PM, Andreas Mueller
<amu...@ai...>wrote:
> **
> Hi everybody.
> I have been trying to turn off xticks and yticks and their labels in
> matplotlibrc.
> Ticks<http://matplotlib.sourceforge.net/api/axis_api.html#matplotlib.axis.Tick>have an argument "tick1On" and "label1On" but it seems I can not use these
> in the config file. Is that correct?
> Is there any other way to turn of ticks by default?
>
> Thanks,
> Andy
>
> Hi Andy,
I don't think there are any rc parameters for controlling this, but you can
call `plt.axis('off')` or `ax.set_axis_off()`. I know that's not what you
were looking for, but I thought I'd mention it.
Best,
-Tony
From: Tony Yu <ts...@gm...> - 2012年05月23日 16:28:33
On Wed, May 23, 2012 at 9:04 AM, Sergi Pons Freixes
<spo...@gm...>wrote:
> On Wed, May 23, 2012 at 11:00 AM, Guillaume Gay
> <gui...@mi...> wrote:
> > Hello
> >
> >
> > What is the size of a single image file? If they are very big, it is
> > better to do everything from processing to ploting at once for each file.
>
> As stated below, each image is single-channel, of 4600x3840 pixels. As
> you can see on the code, there is not much processing, just loading
> the images and plotting them. What it's slow is not the execution of
> the code, is the interactive zooming and panning once the plots "are
> in the screen".
>
> >> It's 15 images, single-channel, of 4600x3840 pixels each.
> > This is a lot of data. 8bit or 16bit ?
>
> They are floating point values (for example, from 0 to 45.xxx). If I
> understood correctly, setting the vmin and vmax, matplotlib should
> normalize the values to an appropriate number of bits.
>
>
I'm not sure what you mean by "normalize the values to an appropriate
number of bits", but I don't think setting `vmin` or `vmax` will change the
data type of the image. So if you have 64-bit floating point images (100+
Mb per image), then that's what you're going to be moving/scaling when you
pan and zoom.
-Tony
From: Waléria A. D. <wal...@gm...> - 2012年05月23日 15:34:24
Hi Mike,
About this question: TypeError: coercing to Unicode: need string or buffer,
dict found
The version of matplotlib that i'm using is matplotlib-0.99.1-py2.6
And how do I remove the font cache in ~ / .matplotlib / fontList.cache
My Operating System is Windows.
Thanks,
On Wed, May 23, 2012 at 11:15 AM, <
mat...@li...> wrote:
> Send Matplotlib-users mailing list submissions to
> mat...@li...
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> or, via email, send a message with subject or body 'help' to
> mat...@li...
>
> You can reach the person managing the list at
> mat...@li...
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Matplotlib-users digest..."
>
>
> Today's Topics:
>
> 1. Re: Difference in show and output file (rajtendulkar)
> 2. TypeError: coercing to Unicode: need string or buffer, dict
> found (Wal?ria Antunes David)
> 3. Re: TypeError: coercing to Unicode: need string or buffer,
> dict found (Michael Droettboom)
> 4. Re: barchart errorbars always in both directions (Benjamin Root)
> 5. Re: Slow imshow when zooming or panning with several synced
> subplots (Sergi Pons Freixes)
> 6. Re: barchart errorbars always in both directions
> (Meesters, Aesku.Kipp Institute)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: 2012年5月23日 02:49:05 -0700 (PDT)
> From: rajtendulkar <pra...@gm...>
> Subject: Re: [Matplotlib-users] Difference in show and output file
> To: mat...@li...
> Message-ID: <338...@ta...>
> Content-Type: text/plain; charset=us-ascii
>
>
> Just in case, if anyone needs the answer, I figured it out.
> I used the transData transform in order to draw the lines correctly.
>
> Here is the code -
>
> # The code below is to add the lines near the tick labels
> fig = barGraph.fig
> xAxisLim=barGraph.ax.xaxis.get_view_interval()
> tickLocArray = barGraph.ax.xaxis.get_majorticklocs()
> yStart=-70
> yEnd=-0.5
> line = Line2D([xAxisLim[0], xAxisLim[0]],
> [yStart,yEnd],linewidth=2, color='black',
> transform=barGraph.ax.transData)
>
> fig.lines.append(line)
>
> for i in xrange(11):
> lnWidth=2
> yStartOffset=0
> if((i+1)%4 != 0):
> lnWidth=1
> yStartOffset=20
> xOffset = tickLocArray[i] + (tickLocArray[i+1] - tickLocArray[i])/2
> line = Line2D([xOffset, xOffset],
> [yStart+yStartOffset,yEnd],linewidth=lnWidth, color='black',
> transform=barGraph.ax.transData)
> fig.lines.append(line)
>
>
> line = Line2D([xAxisLim[1], xAxisLim[1]],
> [yStart,yEnd],linewidth=2, color='black',
> transform=barGraph.ax.transData)
>
> fig.lines.append(line)
>
> plt.figtext(0.247, 0.05, '1')
> plt.figtext(0.523, 0.05, '2')
> plt.figtext(0.797, 0.05, '4')
>
>
> Thank You!
> Raj
>
>
> rajtendulkar wrote:
> >
> > Dear All,
> >
> > I am trying to write a program in matplotlib to generate stacked bar
> > graphs.
> > My problem is that the commands - plt.show() and
> > self.fig.savefig(fileName) generate different outputs.
> > I tried different output formats like PDF, PNG, EPS. But the problem
> > remains the same.
> > This happens for the lines that I am trying to draw outside the plot.
> > I am trying to draw vertical lines between xticklabels.
> > I have uploaded the data file and the code file.
> > http://old.nabble.com/file/p33893817/data.dat data.dat
> > http://old.nabble.com/file/p33893817/matplot1.py matplot1.py
> > Could anyone explain how to resolve this problem?
> >
> > Thank You,
> > Raj
> >
>
> --
> View this message in context:
> http://old.nabble.com/Difference-in-show-and-output-file-tp33893817p33894599.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: 2012年5月23日 09:16:09 -0300
> From: Wal?ria Antunes David <wal...@gm...>
> Subject: [Matplotlib-users] TypeError: coercing to Unicode: need
> string or buffer, dict found
> To: Matplotlib Users <mat...@li...>
> Message-ID:
> <CAEwvc_uK2icxVBzF5Aykka-_Mig4EoCNovgt2jPJHT=XQ...@ma...
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi,
>
> Anyone know how to solve this error?
>
> Exception Type: TypeError Exception Value: coercing to Unicode: need string
> or buffer, dict found
>
> Can you help me??
>
> See mycode: http://dpaste.com/751460/
>
> And see my Traceback: http://dpaste.com/750773/
>
>
> Thanks,
> -------------- next part --------------
> An HTML attachment was scrubbed...
>
> ------------------------------
>
> Message: 3
> Date: 2012年5月23日 08:29:48 -0400
> From: Michael Droettboom <md...@st...>
> Subject: Re: [Matplotlib-users] TypeError: coercing to Unicode: need
> string or buffer, dict found
> To: <mat...@li...>
> Message-ID: <4FB...@st...>
> Content-Type: text/plain; charset="iso-8859-1"
>
> It's a long shot, but have you tried removing the font cache in
> ~/.matplotlib/fontList.cache? What version of matplotlib are you using?
>
> Mike
>
> On 05/23/2012 08:16 AM, Wal?ria Antunes David wrote:
> > Hi,
> >
> > Anyone know how to solve this error?
> >
> > Exception Type: TypeError Exception Value: coercing to Unicode: need
> > string or buffer, dict found
> >
> > Can you help me??
> >
> > See mycode: http://dpaste.com/751460/
> >
> > And see my Traceback: http://dpaste.com/750773/
> >
> >
> > Thanks,
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > 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
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
>
> ------------------------------
>
> Message: 4
> Date: 2012年5月23日 08:55:42 -0400
> From: Benjamin Root <ben...@ou...>
> Subject: Re: [Matplotlib-users] barchart errorbars always in both
> directions
> To: "Meesters, Aesku.Kipp Institute" <mee...@ae...>
> Cc: "mat...@li..."
> <mat...@li...>
> Message-ID:
> <CANNq6F=aDP...@ma...
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> On Wed, May 23, 2012 at 4:03 AM, Meesters, Aesku.Kipp Institute <
> mee...@ae...> wrote:
>
> > Hi,
> >
> > I'm following the example in the gallery to do a barchart plot (see
> > http://matplotlib.sourceforge.net/examples/api/barchart_demo.html ).
> >
> > In contrast to the example I would like to see the error bars only above
> > the bars, so I tried
> >
> > rects2 = ax.bar(ind+width, womenMeans, width, color='y',
> > yerr=stds, error_kw = {'barsabove': True,
> > 'ecolor' : 'k'}
> >
> > While the 'ecolor' argument gets accepted, 'barsabove' apparently has no
> > effect (error bars still point up and downwards) - yet, no warning /
> > error is triggered. Where is my mistake? Or is this a bug (still using
> > version 1.0.1) with a known work-around?
> >
> > TIA
> > Chris
> >
> >
> Chris,
>
> I don't think "barsabove" does what you want. By "above", it means that
> the errorbar is plotted in a layer on top of the plotting symbol rather
> than in the layer under it. Both ends will be plotted.
>
> To get what you want, you might want to try (Note: untested):
>
> rects2 = ax.bar(ind+width, womenMeans, width, color='y',
> yerr=np.vstack([[0]*len(stds), stds]), error_kw = {'ecolor'
> : 'k'})
>
> When yerr is a 2xN numpy array, errorbars are plotted at y-yerr[0, :] and
> y+yerr[1,:]. So, np.vstack creates a 2xN array where the first row is all
> zeros and the second row is the stds values.
>
> I hope that works for you!
> Ben Root
> -------------- next part --------------
> An HTML attachment was scrubbed...
>
> ------------------------------
>
> Message: 5
> Date: 2012年5月23日 15:04:21 +0200
> From: Sergi Pons Freixes <spo...@gm...>
> Subject: Re: [Matplotlib-users] Slow imshow when zooming or panning
> with several synced subplots
> To: mat...@li...
> Message-ID:
> <CAM...@ma...
> >
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Wed, May 23, 2012 at 11:00 AM, Guillaume Gay
> <gui...@mi...> wrote:
> > Hello
> >
> >
> > What is the size of a single image file? If they are very big, it is
> > better to do everything from processing to ploting at once for each file.
>
> As stated below, each image is single-channel, of 4600x3840 pixels. As
> you can see on the code, there is not much processing, just loading
> the images and plotting them. What it's slow is not the execution of
> the code, is the interactive zooming and panning once the plots "are
> in the screen".
>
> >> It's 15 images, single-channel, of 4600x3840 pixels each.
> > This is a lot of data. ?8bit or 16bit ?
>
> They are floating point values (for example, from 0 to 45.xxx). If I
> understood correctly, setting the vmin and vmax, matplotlib should
> normalize the values to an appropriate number of bits.
>
> >> for f in filelist:
> > everything should happen in this loop
> >
> >> ? ? ?dataset = ncdf.Dataset(os.path.join(sys.argv[1],f), 'r')
> >> ? ? ?data.append(dataset.variables[variable][:])
> > instead of creating this big list, use a temporary array (which will be
> > overwritten)
> >> ? ? ?dataset.close()
> >> ? ? ?dates.append((f.split('_')[2][:-3],f.split('_')[1]))
>
> Why? It's true that this way at the beginning it eats a lot of RAM,
> but then it is released after each pop() (and calculating the maximum
> of all the data without plotting is needed to use the same
> normalization level on all the plots). Anyway, the slowness ocurrs
> during the interaction of the plot, not during the execution of the
> code.
>
>
>
> ------------------------------
>
> Message: 6
> Date: 2012年5月23日 14:14:05 +0000
> From: "Meesters, Aesku.Kipp Institute" <mee...@ae...>
> Subject: Re: [Matplotlib-users] barchart errorbars always in both
> directions
> To: "ben...@ou..." <ben...@ou...>
> Cc: "mat...@li..."
> <mat...@li...>
> Message-ID: <1337782494.2773.10.camel@meesters>
> Content-Type: text/plain; charset="utf-8"
>
> Thanks, Ben. This is indeed what I was looking for and gives the desired
> behavior.
>
> Thanks a lot!
> Chris
>
> On Wed, 2012年05月23日 at 08:55 -0400, Benjamin Root wrote:
> >
> > On Wed, May 23, 2012 at 4:03 AM, Meesters, Aesku.Kipp Institute
> > <mee...@ae...> wrote:
> > Hi,
> >
> > I'm following the example in the gallery to do a barchart plot
> > (see
> >
> http://matplotlib.sourceforge.net/examples/api/barchart_demo.html ).
> >
> > In contrast to the example I would like to see the error bars
> > only above
> > the bars, so I tried
> >
> > rects2 = ax.bar(ind+width, womenMeans, width, color='y',
> > yerr=stds, error_kw = {'barsabove': True,
> > 'ecolor' : 'k'}
> >
> > While the 'ecolor' argument gets accepted, 'barsabove'
> > apparently has no
> > effect (error bars still point up and downwards) - yet, no
> > warning /
> > error is triggered. Where is my mistake? Or is this a bug
> > (still using
> > version 1.0.1) with a known work-around?
> >
> > TIA
> > Chris
> >
> >
> > Chris,
> >
> > I don't think "barsabove" does what you want. By "above", it means
> > that the errorbar is plotted in a layer on top of the plotting symbol
> > rather than in the layer under it. Both ends will be plotted.
> >
> > To get what you want, you might want to try (Note: untested):
> >
> > rects2 = ax.bar(ind+width, womenMeans, width, color='y',
> > yerr=np.vstack([[0]*len(stds), stds]), error_kw =
> > {'ecolor' : 'k'})
> >
> > When yerr is a 2xN numpy array, errorbars are plotted at y-yerr[0, :]
> > and y+yerr[1,:]. So, np.vstack creates a 2xN array where the first row
> > is all zeros and the second row is the stds values.
> >
> > I hope that works for you!
> > Ben Root
> >
> >
>
>
> ------------------------------
>
>
> ------------------------------------------------------------------------------
> 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
>
>
> End of Matplotlib-users Digest, Vol 72, Issue 25
> ************************************************
>
From: Gökhan S. <gok...@gm...> - 2012年05月23日 15:33:41
On Wed, May 23, 2012 at 8:32 AM, Chao YUE <cha...@gm...> wrote:
> Dear all,
>
> I have two different monitors. How can I use plot command within terminal
> in this monitor and set the figure to show defaultly in another one?
>
> thanks,
>
> Chao
Hello,
I have a similar question posted on SO ->
http://stackoverflow.com/questions/7802366/matplotlib-window-layout-questions
With few extra commands you can get your figures appearing on your second
monitor. However, SetPosition behavior is somewhat unpredictable. When I
pass a large x value it tendsmove the figure to my second monitor. What
would be nice is to mpl to remember the last window position and size --say
for instance for particular plots I always want to view figures in
maximized window and placed on the second monitor.
-- 
Gökhan
From: Guillaume G. <gui...@mi...> - 2012年05月23日 15:27:30
Le 23/05/2012 15:04, Sergi Pons Freixes a écrit :
> On Wed, May 23, 2012 at 11:00 AM, Guillaume Gay
> <gui...@mi...> wrote:
>> Hello
>>
>>
>> What is the size of a single image file? If they are very big, it is
>> better to do everything from processing to ploting at once for each file.
> As stated below, each image is single-channel, of 4600x3840 pixels. As
> you can see on the code, there is not much processing, just loading
> the images and plotting them. What it's slow is not the execution of
> the code, is the interactive zooming and panning once the plots "are
> in the screen".
>
>>> It's 15 images, single-channel, of 4600x3840 pixels each.
>> This is a lot of data. 8bit or 16bit ?
> They are floating point values (for example, from 0 to 45.xxx). If I
> understood correctly, setting the vmin and vmax, matplotlib should
> normalize the values to an appropriate number of bits.
>
>>> for f in filelist:
>> everything should happen in this loop
>>
>>> dataset = ncdf.Dataset(os.path.join(sys.argv[1],f), 'r')
>>> data.append(dataset.variables[variable][:])
>> instead of creating this big list, use a temporary array (which will be
>> overwritten)
>>> dataset.close()
>>> dates.append((f.split('_')[2][:-3],f.split('_')[1]))
> Why? It's true that this way at the beginning it eats a lot of RAM,
> but then it is released after each pop()
oh I didn't see the pop()...
So now then I don't know...
Do you have to show them full-scale? Maybe you can just use thumbnails 
of sort?
G.
> (and calculating the maximum
> of all the data without plotting is needed to use the same
> normalization level on all the plots). Anyway, the slowness ocurrs
> during the interaction of the plot, not during the execution of the
> code.
>
> ------------------------------------------------------------------------------
> 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: Chao Y. <cha...@gm...> - 2012年05月23日 14:32:46
Dear all,
I have two different monitors. How can I use plot command within terminal
in this monitor and set the figure to show defaultly in another one?
thanks,
Chao
-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
From: Meesters, Aesku.K. I. <mee...@ae...> - 2012年05月23日 14:15:08
Thanks, Ben. This is indeed what I was looking for and gives the desired
behavior.
Thanks a lot!
Chris
On Wed, 2012年05月23日 at 08:55 -0400, Benjamin Root wrote:
> 
> On Wed, May 23, 2012 at 4:03 AM, Meesters, Aesku.Kipp Institute
> <mee...@ae...> wrote:
> Hi,
> 
> I'm following the example in the gallery to do a barchart plot
> (see
> http://matplotlib.sourceforge.net/examples/api/barchart_demo.html ).
> 
> In contrast to the example I would like to see the error bars
> only above
> the bars, so I tried
> 
> rects2 = ax.bar(ind+width, womenMeans, width, color='y',
> yerr=stds, error_kw = {'barsabove': True,
> 'ecolor' : 'k'}
> 
> While the 'ecolor' argument gets accepted, 'barsabove'
> apparently has no
> effect (error bars still point up and downwards) - yet, no
> warning /
> error is triggered. Where is my mistake? Or is this a bug
> (still using
> version 1.0.1) with a known work-around?
> 
> TIA
> Chris
> 
> 
> Chris,
> 
> I don't think "barsabove" does what you want. By "above", it means
> that the errorbar is plotted in a layer on top of the plotting symbol
> rather than in the layer under it. Both ends will be plotted.
> 
> To get what you want, you might want to try (Note: untested):
> 
> rects2 = ax.bar(ind+width, womenMeans, width, color='y',
> yerr=np.vstack([[0]*len(stds), stds]), error_kw =
> {'ecolor' : 'k'})
> 
> When yerr is a 2xN numpy array, errorbars are plotted at y-yerr[0, :]
> and y+yerr[1,:]. So, np.vstack creates a 2xN array where the first row
> is all zeros and the second row is the stds values.
> 
> I hope that works for you!
> Ben Root
> 
> 
From: Sergi P. F. <spo...@gm...> - 2012年05月23日 13:04:32
On Wed, May 23, 2012 at 11:00 AM, Guillaume Gay
<gui...@mi...> wrote:
> Hello
>
>
> What is the size of a single image file? If they are very big, it is
> better to do everything from processing to ploting at once for each file.
As stated below, each image is single-channel, of 4600x3840 pixels. As
you can see on the code, there is not much processing, just loading
the images and plotting them. What it's slow is not the execution of
the code, is the interactive zooming and panning once the plots "are
in the screen".
>> It's 15 images, single-channel, of 4600x3840 pixels each.
> This is a lot of data. 8bit or 16bit ?
They are floating point values (for example, from 0 to 45.xxx). If I
understood correctly, setting the vmin and vmax, matplotlib should
normalize the values to an appropriate number of bits.
>> for f in filelist:
> everything should happen in this loop
>
>>   dataset = ncdf.Dataset(os.path.join(sys.argv[1],f), 'r')
>>   data.append(dataset.variables[variable][:])
> instead of creating this big list, use a temporary array (which will be
> overwritten)
>>   dataset.close()
>>   dates.append((f.split('_')[2][:-3],f.split('_')[1]))
Why? It's true that this way at the beginning it eats a lot of RAM,
but then it is released after each pop() (and calculating the maximum
of all the data without plotting is needed to use the same
normalization level on all the plots). Anyway, the slowness ocurrs
during the interaction of the plot, not during the execution of the
code.
From: Benjamin R. <ben...@ou...> - 2012年05月23日 12:56:14
On Wed, May 23, 2012 at 4:03 AM, Meesters, Aesku.Kipp Institute <
mee...@ae...> wrote:
> Hi,
>
> I'm following the example in the gallery to do a barchart plot (see
> http://matplotlib.sourceforge.net/examples/api/barchart_demo.html ).
>
> In contrast to the example I would like to see the error bars only above
> the bars, so I tried
>
> rects2 = ax.bar(ind+width, womenMeans, width, color='y',
> yerr=stds, error_kw = {'barsabove': True,
> 'ecolor' : 'k'}
>
> While the 'ecolor' argument gets accepted, 'barsabove' apparently has no
> effect (error bars still point up and downwards) - yet, no warning /
> error is triggered. Where is my mistake? Or is this a bug (still using
> version 1.0.1) with a known work-around?
>
> TIA
> Chris
>
>
Chris,
I don't think "barsabove" does what you want. By "above", it means that
the errorbar is plotted in a layer on top of the plotting symbol rather
than in the layer under it. Both ends will be plotted.
To get what you want, you might want to try (Note: untested):
rects2 = ax.bar(ind+width, womenMeans, width, color='y',
 yerr=np.vstack([[0]*len(stds), stds]), error_kw = {'ecolor'
 : 'k'})
When yerr is a 2xN numpy array, errorbars are plotted at y-yerr[0, :] and
y+yerr[1,:]. So, np.vstack creates a 2xN array where the first row is all
zeros and the second row is the stds values.
I hope that works for you!
Ben Root
From: Michael D. <md...@st...> - 2012年05月23日 12:30:01
It's a long shot, but have you tried removing the font cache in 
~/.matplotlib/fontList.cache? What version of matplotlib are you using?
Mike
On 05/23/2012 08:16 AM, Waléria Antunes David wrote:
> Hi,
>
> Anyone know how to solve this error?
>
> Exception Type: TypeError Exception Value: coercing to Unicode: need 
> string or buffer, dict found
>
> Can you help me??
>
> See mycode: http://dpaste.com/751460/
>
> And see my Traceback: http://dpaste.com/750773/
>
>
> Thanks,
>
>
>
>
> ------------------------------------------------------------------------------
> 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: Waléria A. D. <wal...@gm...> - 2012年05月23日 12:16:20
Hi,
Anyone know how to solve this error?
Exception Type: TypeError Exception Value: coercing to Unicode: need string
or buffer, dict found
Can you help me??
See mycode: http://dpaste.com/751460/
And see my Traceback: http://dpaste.com/750773/
Thanks,
From: rajtendulkar <pra...@gm...> - 2012年05月23日 09:49:16
Just in case, if anyone needs the answer, I figured it out.
I used the transData transform in order to draw the lines correctly.
Here is the code - 
# The code below is to add the lines near the tick labels
fig = barGraph.fig
xAxisLim=barGraph.ax.xaxis.get_view_interval()
tickLocArray = barGraph.ax.xaxis.get_majorticklocs()
yStart=-70
yEnd=-0.5
line = Line2D([xAxisLim[0], xAxisLim[0]], 
 [yStart,yEnd],linewidth=2, color='black',
 transform=barGraph.ax.transData)
fig.lines.append(line)
for i in xrange(11):
 lnWidth=2
 yStartOffset=0
 if((i+1)%4 != 0):
 lnWidth=1
 yStartOffset=20 
 xOffset = tickLocArray[i] + (tickLocArray[i+1] - tickLocArray[i])/2
 line = Line2D([xOffset, xOffset], 
 [yStart+yStartOffset,yEnd],linewidth=lnWidth, color='black',
 transform=barGraph.ax.transData) 
 fig.lines.append(line)
 
 
line = Line2D([xAxisLim[1], xAxisLim[1]], 
 [yStart,yEnd],linewidth=2, color='black',
 transform=barGraph.ax.transData)
fig.lines.append(line)
plt.figtext(0.247, 0.05, '1')
plt.figtext(0.523, 0.05, '2')
plt.figtext(0.797, 0.05, '4')
Thank You!
Raj
rajtendulkar wrote:
> 
> Dear All,
> 
> I am trying to write a program in matplotlib to generate stacked bar
> graphs.
> My problem is that the commands - plt.show() and
> self.fig.savefig(fileName) generate different outputs.
> I tried different output formats like PDF, PNG, EPS. But the problem
> remains the same.
> This happens for the lines that I am trying to draw outside the plot.
> I am trying to draw vertical lines between xticklabels.
> I have uploaded the data file and the code file.
> http://old.nabble.com/file/p33893817/data.dat data.dat 
> http://old.nabble.com/file/p33893817/matplot1.py matplot1.py 
> Could anyone explain how to resolve this problem?
> 
> Thank You,
> Raj
> 
-- 
View this message in context: http://old.nabble.com/Difference-in-show-and-output-file-tp33893817p33894599.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Guillaume G. <gui...@mi...> - 2012年05月23日 09:22:32
Hello
What is the size of a single image file? If they are very big, it is 
better to do everything from processing to ploting at once for each file.
Le 23/05/2012 10:11, Sergi Pons Freixes a écrit :
> I'm plotting several images at once, sharing axes, because I use it
> for exploratory purposes. Each image is the same satellite image at
> different dates. I'm experimenting a slow response from matplotlib
> when zooming and panning, and I would like to ask for any tips that
> could speed up the process.
>
> What I am doing now is:
> - Load data from several netcdf files.
> - Calculate maximum value of all the data, for normalization.
> - Create a grid of subplots using ImageGrid. As each subplot is
> generated, I delete the array to free some memory (each array is
> stored in a list, the "deletion" is just a list.pop()). See the code
> below.
>
> It's 15 images, single-channel, of 4600x3840 pixels each.
This is a lot of data. 8bit or 16bit ?
> I've noticed
> that the bottleneck is not the RAM (I have 8 GB), but the processor.
> Python spikes to 100% usage on one of the cores when zooming or
> panning (it's an Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz, 4 cores, 64
> bit).
>
> The code is:
> -------------------------------------------
> import os
> import sys
>
> import numpy as np
> import netCDF4 as ncdf
> import matplotlib.pyplot as plt
> from mpl_toolkits.axes_grid1 import ImageGrid
> from matplotlib.colors import LogNorm
>
> MIN = 0.001 # Hardcoded minimum data value used in normalization
>
> variable = 'conc_chl'
> units = r'$mg/m^3$'
> data = []
> dates = []
>
> # Get a list of only netCDF files
> filelist = os.listdir(sys.argv[1])
> filelist = [f for f in filelist if os.path.splitext(f)[1] == '.nc']
> filelist.sort()
> filelist.reverse()
>
> # Load data and extract dates from filenames
> for f in filelist:
everything should happen in this loop
> dataset = ncdf.Dataset(os.path.join(sys.argv[1],f), 'r')
> data.append(dataset.variables[variable][:])
instead of creating this big list, use a temporary array (which will be 
overwritten)
> dataset.close()
> dates.append((f.split('_')[2][:-3],f.split('_')[1]))
>
> # Get the maximum value of all data. Will be used for normalization
> maxc = np.array(data).max()
>
> # Plot the grid of images + dates
> fig = plt.figure()
> grid = ImageGrid(fig, 111,\
> nrows_ncols = (3, 5),\
> axes_pad = 0.0,\
> share_all=True,\
> aspect = False,\
> cbar_location = "right",\
> cbar_mode = "single",\
> cbar_size = '2.5%',\
> )
> for g in grid:
> v = data.pop()
> d = dates.pop()
> im = g.imshow(v, interpolation='none', norm=LogNorm(), vmin=MIN, vmax=maxc)
> g.text(0.01, 0.01, '-'.join(d), transform = g.transAxes) # Date on a corner
> cticks = np.logspace(np.log10(MIN), np.log10(maxc), 5)
> cbar = grid.cbar_axes[0].colorbar(im)
> cbar.ax.set_yticks(cticks)
> cbar.ax.set_yticklabels([str(np.round(t, 2)) for t in cticks])
> cbar.set_label_text(units)
>
> # Fine-tune figure; make subplots close to each other and hide x ticks for
> # all
> fig.subplots_adjust(left=0.02, bottom=0.02, right=0.95, top=0.98,
> hspace=0, wspace=0)
> grid.axes_llc.set_yticklabels([], visible=False)
> grid.axes_llc.set_xticklabels([], visible=False)
>
> plt.show()
> -------------------------------------------
>
> Any clue about what could be improved to make it more responsive?
>
> PD: This question has been posted previously on Stackoverflow, but it
> hasn't got any answer:
> http://stackoverflow.com/questions/10635901/slow-imshow-when-zooming-or-panning-with-several-synced-subplots
>
> ------------------------------------------------------------------------------
> 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: Mads I. <mad...@gm...> - 2012年05月23日 08:58:57
Attachments: mpl_qt.py
Hi,
I have attached a small example displaying a simple plot in a PyQt based 
widget. If you start resizing the widget manually, the labels of the 
axes as well as the title disappear from the plot window even for 
moderately small window sizes.
Any suggestions on how I can fix this?
Best regards,
Mads
-- 
+-----------------------------------------------------+
| Mads Ipsen |
+----------------------+------------------------------+
| Gåsebæksvej 7, 4. tv | |
| DK-2500 Valby | phone: +45-29716388 |
| Denmark | email: mad...@gm... |
+----------------------+------------------------------+
From: Meesters, Aesku.K. I. <mee...@ae...> - 2012年05月23日 08:23:35
Hi,
I'm following the example in the gallery to do a barchart plot (see
http://matplotlib.sourceforge.net/examples/api/barchart_demo.html ).
In contrast to the example I would like to see the error bars only above
the bars, so I tried
rects2 = ax.bar(ind+width, womenMeans, width, color='y',
 yerr=stds, error_kw = {'barsabove': True,
 'ecolor' : 'k'}
While the 'ecolor' argument gets accepted, 'barsabove' apparently has no
effect (error bars still point up and downwards) - yet, no warning /
error is triggered. Where is my mistake? Or is this a bug (still using
version 1.0.1) with a known work-around?
TIA
Chris
From: Sergi P. F. <spo...@gm...> - 2012年05月23日 08:12:06
I'm plotting several images at once, sharing axes, because I use it
for exploratory purposes. Each image is the same satellite image at
different dates. I'm experimenting a slow response from matplotlib
when zooming and panning, and I would like to ask for any tips that
could speed up the process.
What I am doing now is:
 - Load data from several netcdf files.
 - Calculate maximum value of all the data, for normalization.
 - Create a grid of subplots using ImageGrid. As each subplot is
generated, I delete the array to free some memory (each array is
stored in a list, the "deletion" is just a list.pop()). See the code
below.
It's 15 images, single-channel, of 4600x3840 pixels each. I've noticed
that the bottleneck is not the RAM (I have 8 GB), but the processor.
Python spikes to 100% usage on one of the cores when zooming or
panning (it's an Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz, 4 cores, 64
bit).
The code is:
-------------------------------------------
import os
import sys
import numpy as np
import netCDF4 as ncdf
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
from matplotlib.colors import LogNorm
MIN = 0.001 # Hardcoded minimum data value used in normalization
variable = 'conc_chl'
units = r'$mg/m^3$'
data = []
dates = []
# Get a list of only netCDF files
filelist = os.listdir(sys.argv[1])
filelist = [f for f in filelist if os.path.splitext(f)[1] == '.nc']
filelist.sort()
filelist.reverse()
# Load data and extract dates from filenames
for f in filelist:
 dataset = ncdf.Dataset(os.path.join(sys.argv[1],f), 'r')
 data.append(dataset.variables[variable][:])
 dataset.close()
 dates.append((f.split('_')[2][:-3],f.split('_')[1]))
# Get the maximum value of all data. Will be used for normalization
maxc = np.array(data).max()
# Plot the grid of images + dates
fig = plt.figure()
grid = ImageGrid(fig, 111,\
 nrows_ncols = (3, 5),\
 axes_pad = 0.0,\
 share_all=True,\
 aspect = False,\
 cbar_location = "right",\
 cbar_mode = "single",\
 cbar_size = '2.5%',\
 )
for g in grid:
 v = data.pop()
 d = dates.pop()
 im = g.imshow(v, interpolation='none', norm=LogNorm(), vmin=MIN, vmax=maxc)
 g.text(0.01, 0.01, '-'.join(d), transform = g.transAxes) # Date on a corner
cticks = np.logspace(np.log10(MIN), np.log10(maxc), 5)
cbar = grid.cbar_axes[0].colorbar(im)
cbar.ax.set_yticks(cticks)
cbar.ax.set_yticklabels([str(np.round(t, 2)) for t in cticks])
cbar.set_label_text(units)
# Fine-tune figure; make subplots close to each other and hide x ticks for
# all
fig.subplots_adjust(left=0.02, bottom=0.02, right=0.95, top=0.98,
hspace=0, wspace=0)
grid.axes_llc.set_yticklabels([], visible=False)
grid.axes_llc.set_xticklabels([], visible=False)
plt.show()
-------------------------------------------
Any clue about what could be improved to make it more responsive?
PD: This question has been posted previously on Stackoverflow, but it
hasn't got any answer:
http://stackoverflow.com/questions/10635901/slow-imshow-when-zooming-or-panning-with-several-synced-subplots
From: rajtendulkar <pra...@gm...> - 2012年05月23日 06:57:13
Dear All,
I am trying to write a program in matplotlib to generate stacked bar graphs.
My problem is that the commands - plt.show() and self.fig.savefig(fileName)
generate different outputs.
I tried different output formats like PDF, PNG, EPS. But the problem remains
the same.
This happens for the lines that I am trying to draw outside the plot.
I am trying to draw vertical lines between xticklabels.
I have uploaded the data file and the code file.
http://old.nabble.com/file/p33893817/data.dat data.dat 
http://old.nabble.com/file/p33893817/matplot1.py matplot1.py 
Could anyone explain how to resolve this problem?
Thank You,
Raj
-- 
View this message in context: http://old.nabble.com/Difference-in-show-and-output-file-tp33893817p33893817.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Showing 17 results of 17

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