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




Showing results of 98

<< < 1 2 3 4 (Page 4 of 4)
From: partha <gho...@gm...> - 2014年09月09日 15:47:09
Dear All,
I am using Python 3.4.1 on Debian. Matplotlib works fine for me, but when I
try to save the animation using moviewriter I get error.
My program file:
************************** short test
program**************************************
#!/usr/bin/env python3
from matplotlib import animation as anim
from matplotlib import pyplot as plt
import numpy as np
fig = plt.figure() # the basic canvas
plt.axis([-1,1,-1,1]) # set the x-axis
abcissa, = plt.plot([],[], color='black')
 # initialise the x-axis
graph, = plt.plot([], [], color='blue')
 # initialise the graph
t, = plt.plot([],[], color='red')
def init():
 x = np.arange(-1,1,0.01)# the x-values
 y = np.sin(np.pi/2 * x)
 abcissa.set_data(x, 0) # draw the x-axis
 graph.set_data(x, y) # draw the graph
 return abcissa, graph
def animate(i):
 p = -1 + i*0.02 # the pt p where the tangent is to be drawn
 tx = [p-1,p+1]
 ty = [np.sin(np.pi/2 * p) - np.pi/2 * np.cos(np.pi/2 *p),
 np.sin(np.pi/2 * p) + np.pi/2 * np.cos(np.pi/2 *p)]
 t.set_data(tx, ty)
 return t,
 
ani = anim.FuncAnimation(fig, animate, init_func=init,
 frames=100, interval=30, blit=True)
##plt.show()
Writer = anim.writers['ffmpeg']
writer = Writer(fps=15, bitrate=1800)
ani.save('test.mp4', writer=writer)
********************end of
program*************************************************
plt.show() shows correctly; on trying to save as above I get the following
error:
**************error from python
******************************************************
Traceback (most recent call last):
 File "/home/partha/নথিপত্র/স্বরচিত/আমারপ্রোগ্রাম/test.py", line 48, in
<module>
 ani.save('test.mp4', writer=writer)
 File "/usr/lib/python3/dist-packages/matplotlib/animation.py", line 719,
in save
 writer.grab_frame(**savefig_kwargs)
 File "/usr/lib/python3/dist-packages/matplotlib/animation.py", line 205,
in grab_frame
 dpi=self.dpi, **savefig_kwargs)
 File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1422, in
savefig
 self.canvas.print_figure(*args, **kwargs)
 File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line
2225, in print_figure
 self.figure.dpi = origDPI
 File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 385, in
_set_dpi
 self.dpi_scale_trans.clear().scale(dpi, dpi)
 File "/usr/lib/python3/dist-packages/matplotlib/transforms.py", line 1786,
in clear
 self._mtx = np.identity(3)
 File "/usr/lib/python3/dist-packages/numpy/core/numeric.py", line 2053, in
identity
 from numpy import eye
 File "<frozen importlib._bootstrap>", line 2280, in _handle_fromlist
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0:
invalid start byte
*************end of
error****************************************************
As you can see from the first line of the error, my locale is set to bn_IN
(Bengali, India).
Any help in trying to resolve this problem would be highly appreciated.
With my thanks and regards,
partha
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlib-error-on-trying-to-use-moviewriter-tp43916.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Raffaele Q. <raf...@li...> - 2014年09月09日 13:59:51
Hi Ben and Ryan,
I will try to figure out as it works. 
Thank you.
Regards, 
Raf
-----Original Message-----
From: ben...@gm... on behalf of Benjamin Root
Sent: Tue 9/9/2014 3:25 PM
To: Ryan Nelson
Cc: Raffaele Quarta; Matplotlib Users
Subject: Re: [Matplotlib-users] Plotting large file (NetCDF)
 
Most of the time, you will not need to use meshgrid. Take advantage of
numpy's broadcasting feature:
http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
It saves *significantly* on memory and processing time. Most of
Matplotlib's plotting functions work well with broadcastable inputs, so
that is a great way to save on memory. NumPy's ogrid is also a neat tool
for generating broadcastable grids.
When I get a chance, I'll look through the script for any other obvious
savers.
Cheers!
Ben Root
On Tue, Sep 9, 2014 at 9:02 AM, Ryan Nelson <rne...@gm...> wrote:
> Raffaele,
>
> As Ben pointed out, you might be creating a lot of in memory Numpy arrays
> that you probably don't need/want.
>
> For example, I think (?) slicing all of the variable below:
> lons = fh.variables['lon'][:]
> is making a copy of all that (mmap'ed) data as a Numpy array in memory.
> Get rid of the slice ([:]). Of course, these variables are not Numpy
> arrays, so you'll have to change some of your code. For example:
> lon_0 = lons.mean()
> Will have to become:
> lon_0 = np.mean( lons )
>
> If lats and lons are very large sets of data, then meshgrid will make two
> very, very large arrays in memory.
> For example, try this:
> np.meshgrid(np.arange(5), np.arange(5))
> The output is two much larger arrays:
> [array([[0, 1, 2, 3, 4],
> [0, 1, 2, 3, 4],
> [0, 1, 2, 3, 4],
> [0, 1, 2, 3, 4],
> [0, 1, 2, 3, 4]]),
> array([[0, 0, 0, 0, 0],
> [1, 1, 1, 1, 1],
> [2, 2, 2, 2, 2],
> [3, 3, 3, 3, 3],
> [4, 4, 4, 4, 4]])]
> I don't know Basemap at all, so I don't know if this is necessary. You
> might be able to force the meshgrid output into a memmap file, but I don't
> know how to do that right now. Perhaps someone else has some suggestions.
>
> Hope that helps.
>
> Ryan
>
>
>
>
> On Tue, Sep 9, 2014 at 4:07 AM, Raffaele Quarta <
> raf...@li...> wrote:
>
>> Hi Jody and Ben,
>>
>> thanks for your answers.
>> I tried to use pcolormesh instead of pcolor and the result is very good!
>> For what concern with the memory system problem, I wasn't able to solve it.
>> When I tried to use the bigger file, I got the same problem. Attached you
>> will find the script that I'm using to make the plot. May be, I didn't
>> understand very well how can I use the mmap function.
>>
>> Regards,
>>
>> Raffaele.
>>
>>
>> -----Original Message-----
>> From: Jody Klymak [mailto:jk...@uv... <jk...@uv...>]
>> Sent: Mon 9/8/2014 5:46 PM
>> To: Benjamin Root
>> Cc: Raffaele Quarta; Matplotlib Users
>> Subject: Re: [Matplotlib-users] Plotting large file (NetCDF)
>>
>> It looks like you are calling `pcolor`. Can I suggest you try
>> `pcolormesh`? ii
>>
>> 75 Mb is not a big file!
>>
>> Cheers, Jody
>>
>>
>> On Sep 8, 2014, at 7:38 AM, Benjamin Root <ben...@ou...> wrote:
>>
>> > (Keeping this on the mailing list so that others can benefit)
>> >
>> > What might be happening is that you are keeping around too many numpy
>> arrays in memory than you actually need. Take advantage of memmapping,
>> which most netcdf tools provide by default. This keeps the data on disk
>> rather than in RAM. Second, for very large images, I would suggest either
>> pcolormesh() or just simply imshow() instead of pcolor() as they are more
>> way more efficient than pcolor(). In addition, it sounds like you are
>> dealing with re-sampled data ("at different zoom levels"). Does this mean
>> that you are re-running contour on re-sampled data? I am not sure what the
>> benefit of doing that is if one could just simply do the contour once at
>> the highest resolution.
>> >
>> > Without seeing any code, though, I can only provide generic suggestions.
>> >
>> > Cheers!
>> > Ben Root
>> >
>> >
>> > On Mon, Sep 8, 2014 at 10:12 AM, Raffaele Quarta <
>> raf...@li...> wrote:
>> > Hi Ben,
>> >
>> > sorry for the few details that I gave to you. I'm trying to make a
>> contour plot of a variable at different zoom levels by using high
>> resolution data. The aim is to obtain .PNG output images. Actually, I'm
>> working with big data (NetCDF file, dimension is about 75Mb). The current
>> Matplotlib version on my UBUNTU 14.04 machine is the 1.3.1 one. My system
>> has a RAM capacity of 8Gb.
>> > Actually, I'm dealing with memory system problems when I try to make a
>> plot. I got the error message as follow:
>> >
>> > --------------------------------------------
>> > cs = m.pcolor(xi,yi,np.squeeze(t))
>> > File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py",
>> line 521, in with_transform
>> > return plotfunc(self,x,y,data,*args,**kwargs)
>> > File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py",
>> line 3375, in pcolor
>> > x = ma.masked_values(np.where(x > 1.e20,1.e20,x), 1.e20)
>> > File "/usr/lib/python2.7/dist-packages/numpy/ma/core.py", line 2195,
>> in masked_values
>> > condition = umath.less_equal(mabs(xnew - value), atol + rtol *
>> mabs(value))
>> > MemoryError
>> > --------------------------------------------
>> >
>> > Otherwise, when I try to make a plot of smaller file (such as 5Mb), it
>> works very well. I believe that it's not something of wrong in the script.
>> It might be a memory system problem.
>> > I hope that my message is more clear now.
>> >
>> > Thanks for the help.
>> >
>> > Regards,
>> >
>> > Raffaele
>> >
>> > -----------------------------------------
>> >
>> > Sent: Mon 9/8/2014 3:19 PM
>> > To: Raffaele Quarta
>> > Cc: Matplotlib Users
>> > Subject: Re: [Matplotlib-users] Plotting large file (NetCDF)
>> >
>> >
>> >
>> > You will need to be more specific... much more specific. What kind of
>> plot
>> > are you making? How big is your data? What version of matplotlib are you
>> > using? How much RAM do you have available compared to the amount of data
>> > (most slowdowns are actually due to swap-thrashing issues). Matplotlib
>> can
>> > be used for large data, but there exists some speciality tools for the
>> > truly large datasets. The solution depends on the situation.
>> >
>> > Ben Root
>> >
>> > On Mon, Sep 8, 2014 at 7:45 AM, Raffaele Quarta <
>> raf...@li...>
>> > wrote:
>> >
>> > > Hi,
>> > >
>> > > I'm working with NetCDF format. When I try to make a plot of very
>> large
>> > > file, I have to wait for a long time for plotting. How can I solve
>> this?
>> > > Isn't there a solution for this problem?
>> > >
>> > > Raffaele
>> > >
>> > > --
>> > > This email was Virus checked by Astaro Security Gateway.
>> http://www.sophos.com
>> > >
>> > >
>> > >
>> > >
>> ------------------------------------------------------------------------------
>> > > Want excitement?
>> > > Manually upgrade your production database.
>> > > When you want reliability, choose Perforce
>> > > Perforce version control. Predictably reliable.
>> > >
>> > >
>> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
>> > > _______________________________________________
>> > > Matplotlib-users mailing list
>> > > Mat...@li...
>> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> > >
>> > >
>> >
>> > --
>> > This email was Virus checked by Astaro Security Gateway.
>> http://www.sophos.com
>> >
>> >
>> >
>> >
>> ------------------------------------------------------------------------------
>> > Want excitement?
>> > Manually upgrade your production database.
>> > When you want reliability, choose Perforce
>> > Perforce version control. Predictably reliable.
>> >
>> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk_______________________________________________
>> > Matplotlib-users mailing list
>> > Mat...@li...
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>> --
>> Jody Klymak
>> http://web.uvic.ca/~jklymak/
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Want excitement?
>> Manually upgrade your production database.
>> When you want reliability, choose Perforce.
>> Perforce version control. Predictably reliable.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce.
> Perforce version control. Predictably reliable.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Benjamin R. <ben...@ou...> - 2014年09月09日 13:26:03
Most of the time, you will not need to use meshgrid. Take advantage of
numpy's broadcasting feature:
http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
It saves *significantly* on memory and processing time. Most of
Matplotlib's plotting functions work well with broadcastable inputs, so
that is a great way to save on memory. NumPy's ogrid is also a neat tool
for generating broadcastable grids.
When I get a chance, I'll look through the script for any other obvious
savers.
Cheers!
Ben Root
On Tue, Sep 9, 2014 at 9:02 AM, Ryan Nelson <rne...@gm...> wrote:
> Raffaele,
>
> As Ben pointed out, you might be creating a lot of in memory Numpy arrays
> that you probably don't need/want.
>
> For example, I think (?) slicing all of the variable below:
> lons = fh.variables['lon'][:]
> is making a copy of all that (mmap'ed) data as a Numpy array in memory.
> Get rid of the slice ([:]). Of course, these variables are not Numpy
> arrays, so you'll have to change some of your code. For example:
> lon_0 = lons.mean()
> Will have to become:
> lon_0 = np.mean( lons )
>
> If lats and lons are very large sets of data, then meshgrid will make two
> very, very large arrays in memory.
> For example, try this:
> np.meshgrid(np.arange(5), np.arange(5))
> The output is two much larger arrays:
> [array([[0, 1, 2, 3, 4],
> [0, 1, 2, 3, 4],
> [0, 1, 2, 3, 4],
> [0, 1, 2, 3, 4],
> [0, 1, 2, 3, 4]]),
> array([[0, 0, 0, 0, 0],
> [1, 1, 1, 1, 1],
> [2, 2, 2, 2, 2],
> [3, 3, 3, 3, 3],
> [4, 4, 4, 4, 4]])]
> I don't know Basemap at all, so I don't know if this is necessary. You
> might be able to force the meshgrid output into a memmap file, but I don't
> know how to do that right now. Perhaps someone else has some suggestions.
>
> Hope that helps.
>
> Ryan
>
>
>
>
> On Tue, Sep 9, 2014 at 4:07 AM, Raffaele Quarta <
> raf...@li...> wrote:
>
>> Hi Jody and Ben,
>>
>> thanks for your answers.
>> I tried to use pcolormesh instead of pcolor and the result is very good!
>> For what concern with the memory system problem, I wasn't able to solve it.
>> When I tried to use the bigger file, I got the same problem. Attached you
>> will find the script that I'm using to make the plot. May be, I didn't
>> understand very well how can I use the mmap function.
>>
>> Regards,
>>
>> Raffaele.
>>
>>
>> -----Original Message-----
>> From: Jody Klymak [mailto:jk...@uv... <jk...@uv...>]
>> Sent: Mon 9/8/2014 5:46 PM
>> To: Benjamin Root
>> Cc: Raffaele Quarta; Matplotlib Users
>> Subject: Re: [Matplotlib-users] Plotting large file (NetCDF)
>>
>> It looks like you are calling `pcolor`. Can I suggest you try
>> `pcolormesh`? ii
>>
>> 75 Mb is not a big file!
>>
>> Cheers, Jody
>>
>>
>> On Sep 8, 2014, at 7:38 AM, Benjamin Root <ben...@ou...> wrote:
>>
>> > (Keeping this on the mailing list so that others can benefit)
>> >
>> > What might be happening is that you are keeping around too many numpy
>> arrays in memory than you actually need. Take advantage of memmapping,
>> which most netcdf tools provide by default. This keeps the data on disk
>> rather than in RAM. Second, for very large images, I would suggest either
>> pcolormesh() or just simply imshow() instead of pcolor() as they are more
>> way more efficient than pcolor(). In addition, it sounds like you are
>> dealing with re-sampled data ("at different zoom levels"). Does this mean
>> that you are re-running contour on re-sampled data? I am not sure what the
>> benefit of doing that is if one could just simply do the contour once at
>> the highest resolution.
>> >
>> > Without seeing any code, though, I can only provide generic suggestions.
>> >
>> > Cheers!
>> > Ben Root
>> >
>> >
>> > On Mon, Sep 8, 2014 at 10:12 AM, Raffaele Quarta <
>> raf...@li...> wrote:
>> > Hi Ben,
>> >
>> > sorry for the few details that I gave to you. I'm trying to make a
>> contour plot of a variable at different zoom levels by using high
>> resolution data. The aim is to obtain .PNG output images. Actually, I'm
>> working with big data (NetCDF file, dimension is about 75Mb). The current
>> Matplotlib version on my UBUNTU 14.04 machine is the 1.3.1 one. My system
>> has a RAM capacity of 8Gb.
>> > Actually, I'm dealing with memory system problems when I try to make a
>> plot. I got the error message as follow:
>> >
>> > --------------------------------------------
>> > cs = m.pcolor(xi,yi,np.squeeze(t))
>> > File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py",
>> line 521, in with_transform
>> > return plotfunc(self,x,y,data,*args,**kwargs)
>> > File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py",
>> line 3375, in pcolor
>> > x = ma.masked_values(np.where(x > 1.e20,1.e20,x), 1.e20)
>> > File "/usr/lib/python2.7/dist-packages/numpy/ma/core.py", line 2195,
>> in masked_values
>> > condition = umath.less_equal(mabs(xnew - value), atol + rtol *
>> mabs(value))
>> > MemoryError
>> > --------------------------------------------
>> >
>> > Otherwise, when I try to make a plot of smaller file (such as 5Mb), it
>> works very well. I believe that it's not something of wrong in the script.
>> It might be a memory system problem.
>> > I hope that my message is more clear now.
>> >
>> > Thanks for the help.
>> >
>> > Regards,
>> >
>> > Raffaele
>> >
>> > -----------------------------------------
>> >
>> > Sent: Mon 9/8/2014 3:19 PM
>> > To: Raffaele Quarta
>> > Cc: Matplotlib Users
>> > Subject: Re: [Matplotlib-users] Plotting large file (NetCDF)
>> >
>> >
>> >
>> > You will need to be more specific... much more specific. What kind of
>> plot
>> > are you making? How big is your data? What version of matplotlib are you
>> > using? How much RAM do you have available compared to the amount of data
>> > (most slowdowns are actually due to swap-thrashing issues). Matplotlib
>> can
>> > be used for large data, but there exists some speciality tools for the
>> > truly large datasets. The solution depends on the situation.
>> >
>> > Ben Root
>> >
>> > On Mon, Sep 8, 2014 at 7:45 AM, Raffaele Quarta <
>> raf...@li...>
>> > wrote:
>> >
>> > > Hi,
>> > >
>> > > I'm working with NetCDF format. When I try to make a plot of very
>> large
>> > > file, I have to wait for a long time for plotting. How can I solve
>> this?
>> > > Isn't there a solution for this problem?
>> > >
>> > > Raffaele
>> > >
>> > > --
>> > > This email was Virus checked by Astaro Security Gateway.
>> http://www.sophos.com
>> > >
>> > >
>> > >
>> > >
>> ------------------------------------------------------------------------------
>> > > Want excitement?
>> > > Manually upgrade your production database.
>> > > When you want reliability, choose Perforce
>> > > Perforce version control. Predictably reliable.
>> > >
>> > >
>> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
>> > > _______________________________________________
>> > > Matplotlib-users mailing list
>> > > Mat...@li...
>> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> > >
>> > >
>> >
>> > --
>> > This email was Virus checked by Astaro Security Gateway.
>> http://www.sophos.com
>> >
>> >
>> >
>> >
>> ------------------------------------------------------------------------------
>> > Want excitement?
>> > Manually upgrade your production database.
>> > When you want reliability, choose Perforce
>> > Perforce version control. Predictably reliable.
>> >
>> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk_______________________________________________
>> > Matplotlib-users mailing list
>> > Mat...@li...
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>> --
>> Jody Klymak
>> http://web.uvic.ca/~jklymak/
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Want excitement?
>> Manually upgrade your production database.
>> When you want reliability, choose Perforce.
>> Perforce version control. Predictably reliable.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce.
> Perforce version control. Predictably reliable.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Ryan N. <rne...@gm...> - 2014年09月09日 13:02:55
Raffaele,
As Ben pointed out, you might be creating a lot of in memory Numpy arrays
that you probably don't need/want.
For example, I think (?) slicing all of the variable below:
lons = fh.variables['lon'][:]
is making a copy of all that (mmap'ed) data as a Numpy array in memory. Get
rid of the slice ([:]). Of course, these variables are not Numpy arrays, so
you'll have to change some of your code. For example:
lon_0 = lons.mean()
Will have to become:
lon_0 = np.mean( lons )
If lats and lons are very large sets of data, then meshgrid will make two
very, very large arrays in memory.
For example, try this:
np.meshgrid(np.arange(5), np.arange(5))
The output is two much larger arrays:
[array([[0, 1, 2, 3, 4],
 [0, 1, 2, 3, 4],
 [0, 1, 2, 3, 4],
 [0, 1, 2, 3, 4],
 [0, 1, 2, 3, 4]]),
array([[0, 0, 0, 0, 0],
 [1, 1, 1, 1, 1],
 [2, 2, 2, 2, 2],
 [3, 3, 3, 3, 3],
 [4, 4, 4, 4, 4]])]
I don't know Basemap at all, so I don't know if this is necessary. You
might be able to force the meshgrid output into a memmap file, but I don't
know how to do that right now. Perhaps someone else has some suggestions.
Hope that helps.
Ryan
On Tue, Sep 9, 2014 at 4:07 AM, Raffaele Quarta <raf...@li...>
wrote:
> Hi Jody and Ben,
>
> thanks for your answers.
> I tried to use pcolormesh instead of pcolor and the result is very good!
> For what concern with the memory system problem, I wasn't able to solve it.
> When I tried to use the bigger file, I got the same problem. Attached you
> will find the script that I'm using to make the plot. May be, I didn't
> understand very well how can I use the mmap function.
>
> Regards,
>
> Raffaele.
>
>
> -----Original Message-----
> From: Jody Klymak [mailto:jk...@uv... <jk...@uv...>]
> Sent: Mon 9/8/2014 5:46 PM
> To: Benjamin Root
> Cc: Raffaele Quarta; Matplotlib Users
> Subject: Re: [Matplotlib-users] Plotting large file (NetCDF)
>
> It looks like you are calling `pcolor`. Can I suggest you try
> `pcolormesh`? ii
>
> 75 Mb is not a big file!
>
> Cheers, Jody
>
>
> On Sep 8, 2014, at 7:38 AM, Benjamin Root <ben...@ou...> wrote:
>
> > (Keeping this on the mailing list so that others can benefit)
> >
> > What might be happening is that you are keeping around too many numpy
> arrays in memory than you actually need. Take advantage of memmapping,
> which most netcdf tools provide by default. This keeps the data on disk
> rather than in RAM. Second, for very large images, I would suggest either
> pcolormesh() or just simply imshow() instead of pcolor() as they are more
> way more efficient than pcolor(). In addition, it sounds like you are
> dealing with re-sampled data ("at different zoom levels"). Does this mean
> that you are re-running contour on re-sampled data? I am not sure what the
> benefit of doing that is if one could just simply do the contour once at
> the highest resolution.
> >
> > Without seeing any code, though, I can only provide generic suggestions.
> >
> > Cheers!
> > Ben Root
> >
> >
> > On Mon, Sep 8, 2014 at 10:12 AM, Raffaele Quarta <
> raf...@li...> wrote:
> > Hi Ben,
> >
> > sorry for the few details that I gave to you. I'm trying to make a
> contour plot of a variable at different zoom levels by using high
> resolution data. The aim is to obtain .PNG output images. Actually, I'm
> working with big data (NetCDF file, dimension is about 75Mb). The current
> Matplotlib version on my UBUNTU 14.04 machine is the 1.3.1 one. My system
> has a RAM capacity of 8Gb.
> > Actually, I'm dealing with memory system problems when I try to make a
> plot. I got the error message as follow:
> >
> > --------------------------------------------
> > cs = m.pcolor(xi,yi,np.squeeze(t))
> > File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py",
> line 521, in with_transform
> > return plotfunc(self,x,y,data,*args,**kwargs)
> > File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py",
> line 3375, in pcolor
> > x = ma.masked_values(np.where(x > 1.e20,1.e20,x), 1.e20)
> > File "/usr/lib/python2.7/dist-packages/numpy/ma/core.py", line 2195,
> in masked_values
> > condition = umath.less_equal(mabs(xnew - value), atol + rtol *
> mabs(value))
> > MemoryError
> > --------------------------------------------
> >
> > Otherwise, when I try to make a plot of smaller file (such as 5Mb), it
> works very well. I believe that it's not something of wrong in the script.
> It might be a memory system problem.
> > I hope that my message is more clear now.
> >
> > Thanks for the help.
> >
> > Regards,
> >
> > Raffaele
> >
> > -----------------------------------------
> >
> > Sent: Mon 9/8/2014 3:19 PM
> > To: Raffaele Quarta
> > Cc: Matplotlib Users
> > Subject: Re: [Matplotlib-users] Plotting large file (NetCDF)
> >
> >
> >
> > You will need to be more specific... much more specific. What kind of
> plot
> > are you making? How big is your data? What version of matplotlib are you
> > using? How much RAM do you have available compared to the amount of data
> > (most slowdowns are actually due to swap-thrashing issues). Matplotlib
> can
> > be used for large data, but there exists some speciality tools for the
> > truly large datasets. The solution depends on the situation.
> >
> > Ben Root
> >
> > On Mon, Sep 8, 2014 at 7:45 AM, Raffaele Quarta <
> raf...@li...>
> > wrote:
> >
> > > Hi,
> > >
> > > I'm working with NetCDF format. When I try to make a plot of very large
> > > file, I have to wait for a long time for plotting. How can I solve
> this?
> > > Isn't there a solution for this problem?
> > >
> > > Raffaele
> > >
> > > --
> > > This email was Virus checked by Astaro Security Gateway.
> http://www.sophos.com
> > >
> > >
> > >
> > >
> ------------------------------------------------------------------------------
> > > Want excitement?
> > > Manually upgrade your production database.
> > > When you want reliability, choose Perforce
> > > Perforce version control. Predictably reliable.
> > >
> > >
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> > > _______________________________________________
> > > Matplotlib-users mailing list
> > > Mat...@li...
> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > >
> > >
> >
> > --
> > This email was Virus checked by Astaro Security Gateway.
> http://www.sophos.com
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Want excitement?
> > Manually upgrade your production database.
> > When you want reliability, choose Perforce
> > Perforce version control. Predictably reliable.
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk_______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> --
> Jody Klymak
> http://web.uvic.ca/~jklymak/
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce.
> Perforce version control. Predictably reliable.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Raffaele Q. <raf...@li...> - 2014年09月09日 08:07:59
Attachments: prova3_256_5x.py
Hi Jody and Ben,
thanks for your answers. 
I tried to use pcolormesh instead of pcolor and the result is very good! For what concern with the memory system problem, I wasn't able to solve it. When I tried to use the bigger file, I got the same problem. Attached you will find the script that I'm using to make the plot. May be, I didn't understand very well how can I use the mmap function. 
Regards,
Raffaele.
-----Original Message-----
From: Jody Klymak [mailto:jk...@uv...]
Sent: Mon 9/8/2014 5:46 PM
To: Benjamin Root
Cc: Raffaele Quarta; Matplotlib Users
Subject: Re: [Matplotlib-users] Plotting large file (NetCDF)
 
It looks like you are calling `pcolor`. Can I suggest you try `pcolormesh`? ii
75 Mb is not a big file!
Cheers, Jody
On Sep 8, 2014, at 7:38 AM, Benjamin Root <ben...@ou...> wrote:
> (Keeping this on the mailing list so that others can benefit)
> 
> What might be happening is that you are keeping around too many numpy arrays in memory than you actually need. Take advantage of memmapping, which most netcdf tools provide by default. This keeps the data on disk rather than in RAM. Second, for very large images, I would suggest either pcolormesh() or just simply imshow() instead of pcolor() as they are more way more efficient than pcolor(). In addition, it sounds like you are dealing with re-sampled data ("at different zoom levels"). Does this mean that you are re-running contour on re-sampled data? I am not sure what the benefit of doing that is if one could just simply do the contour once at the highest resolution.
> 
> Without seeing any code, though, I can only provide generic suggestions.
> 
> Cheers!
> Ben Root
> 
> 
> On Mon, Sep 8, 2014 at 10:12 AM, Raffaele Quarta <raf...@li...> wrote:
> Hi Ben,
> 
> sorry for the few details that I gave to you. I'm trying to make a contour plot of a variable at different zoom levels by using high resolution data. The aim is to obtain .PNG output images. Actually, I'm working with big data (NetCDF file, dimension is about 75Mb). The current Matplotlib version on my UBUNTU 14.04 machine is the 1.3.1 one. My system has a RAM capacity of 8Gb.
> Actually, I'm dealing with memory system problems when I try to make a plot. I got the error message as follow:
> 
> --------------------------------------------
> cs = m.pcolor(xi,yi,np.squeeze(t))
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py", line 521, in with_transform
> return plotfunc(self,x,y,data,*args,**kwargs)
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py", line 3375, in pcolor
> x = ma.masked_values(np.where(x > 1.e20,1.e20,x), 1.e20)
> File "/usr/lib/python2.7/dist-packages/numpy/ma/core.py", line 2195, in masked_values
> condition = umath.less_equal(mabs(xnew - value), atol + rtol * mabs(value))
> MemoryError 
> --------------------------------------------
> 
> Otherwise, when I try to make a plot of smaller file (such as 5Mb), it works very well. I believe that it's not something of wrong in the script. It might be a memory system problem.
> I hope that my message is more clear now.
> 
> Thanks for the help.
> 
> Regards,
> 
> Raffaele
> 
> -----------------------------------------
> 
> Sent: Mon 9/8/2014 3:19 PM
> To: Raffaele Quarta
> Cc: Matplotlib Users
> Subject: Re: [Matplotlib-users] Plotting large file (NetCDF)
> 
> 
> 
> You will need to be more specific... much more specific. What kind of plot
> are you making? How big is your data? What version of matplotlib are you
> using? How much RAM do you have available compared to the amount of data
> (most slowdowns are actually due to swap-thrashing issues). Matplotlib can
> be used for large data, but there exists some speciality tools for the
> truly large datasets. The solution depends on the situation.
> 
> Ben Root
> 
> On Mon, Sep 8, 2014 at 7:45 AM, Raffaele Quarta <raf...@li...>
> wrote:
> 
> > Hi,
> >
> > I'm working with NetCDF format. When I try to make a plot of very large
> > file, I have to wait for a long time for plotting. How can I solve this?
> > Isn't there a solution for this problem?
> >
> > Raffaele
> >
> > --
> > This email was Virus checked by Astaro Security Gateway. http://www.sophos.com
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Want excitement?
> > Manually upgrade your production database.
> > When you want reliability, choose Perforce
> > Perforce version control. Predictably reliable.
> >
> > http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
> 
> --
> This email was Virus checked by Astaro Security Gateway. http://www.sophos.com
> 
> 
> 
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Jody Klymak 
http://web.uvic.ca/~jklymak/
From: Jody K. <jk...@uv...> - 2014年09月08日 15:59:33
It looks like you are calling `pcolor`. Can I suggest you try `pcolormesh`? 
75 Mb is not a big file!
Cheers, Jody
On Sep 8, 2014, at 7:38 AM, Benjamin Root <ben...@ou...> wrote:
> (Keeping this on the mailing list so that others can benefit)
> 
> What might be happening is that you are keeping around too many numpy arrays in memory than you actually need. Take advantage of memmapping, which most netcdf tools provide by default. This keeps the data on disk rather than in RAM. Second, for very large images, I would suggest either pcolormesh() or just simply imshow() instead of pcolor() as they are more way more efficient than pcolor(). In addition, it sounds like you are dealing with re-sampled data ("at different zoom levels"). Does this mean that you are re-running contour on re-sampled data? I am not sure what the benefit of doing that is if one could just simply do the contour once at the highest resolution.
> 
> Without seeing any code, though, I can only provide generic suggestions.
> 
> Cheers!
> Ben Root
> 
> 
> On Mon, Sep 8, 2014 at 10:12 AM, Raffaele Quarta <raf...@li...> wrote:
> Hi Ben,
> 
> sorry for the few details that I gave to you. I'm trying to make a contour plot of a variable at different zoom levels by using high resolution data. The aim is to obtain .PNG output images. Actually, I'm working with big data (NetCDF file, dimension is about 75Mb). The current Matplotlib version on my UBUNTU 14.04 machine is the 1.3.1 one. My system has a RAM capacity of 8Gb.
> Actually, I'm dealing with memory system problems when I try to make a plot. I got the error message as follow:
> 
> --------------------------------------------
> cs = m.pcolor(xi,yi,np.squeeze(t))
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py", line 521, in with_transform
> return plotfunc(self,x,y,data,*args,**kwargs)
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py", line 3375, in pcolor
> x = ma.masked_values(np.where(x > 1.e20,1.e20,x), 1.e20)
> File "/usr/lib/python2.7/dist-packages/numpy/ma/core.py", line 2195, in masked_values
> condition = umath.less_equal(mabs(xnew - value), atol + rtol * mabs(value))
> MemoryError 
> --------------------------------------------
> 
> Otherwise, when I try to make a plot of smaller file (such as 5Mb), it works very well. I believe that it's not something of wrong in the script. It might be a memory system problem.
> I hope that my message is more clear now.
> 
> Thanks for the help.
> 
> Regards,
> 
> Raffaele
> 
> -----------------------------------------
> 
> Sent: Mon 9/8/2014 3:19 PM
> To: Raffaele Quarta
> Cc: Matplotlib Users
> Subject: Re: [Matplotlib-users] Plotting large file (NetCDF)
> 
> 
> 
> You will need to be more specific... much more specific. What kind of plot
> are you making? How big is your data? What version of matplotlib are you
> using? How much RAM do you have available compared to the amount of data
> (most slowdowns are actually due to swap-thrashing issues). Matplotlib can
> be used for large data, but there exists some speciality tools for the
> truly large datasets. The solution depends on the situation.
> 
> Ben Root
> 
> On Mon, Sep 8, 2014 at 7:45 AM, Raffaele Quarta <raf...@li...>
> wrote:
> 
> > Hi,
> >
> > I'm working with NetCDF format. When I try to make a plot of very large
> > file, I have to wait for a long time for plotting. How can I solve this?
> > Isn't there a solution for this problem?
> >
> > Raffaele
> >
> > --
> > This email was Virus checked by Astaro Security Gateway. http://www.sophos.com
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Want excitement?
> > Manually upgrade your production database.
> > When you want reliability, choose Perforce
> > Perforce version control. Predictably reliable.
> >
> > http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
> 
> --
> This email was Virus checked by Astaro Security Gateway. http://www.sophos.com
> 
> 
> 
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Jody Klymak 
http://web.uvic.ca/~jklymak/
From: Benjamin R. <ben...@ou...> - 2014年09月08日 14:38:32
(Keeping this on the mailing list so that others can benefit)
What might be happening is that you are keeping around too many numpy
arrays in memory than you actually need. Take advantage of memmapping,
which most netcdf tools provide by default. This keeps the data on disk
rather than in RAM. Second, for very large images, I would suggest either
pcolormesh() or just simply imshow() instead of pcolor() as they are more
way more efficient than pcolor(). In addition, it sounds like you are
dealing with re-sampled data ("at different zoom levels"). Does this mean
that you are re-running contour on re-sampled data? I am not sure what the
benefit of doing that is if one could just simply do the contour once at
the highest resolution.
Without seeing any code, though, I can only provide generic suggestions.
Cheers!
Ben Root
On Mon, Sep 8, 2014 at 10:12 AM, Raffaele Quarta <raf...@li...
> wrote:
> Hi Ben,
>
> sorry for the few details that I gave to you. I'm trying to make a contour
> plot of a variable at different zoom levels by using high resolution data.
> The aim is to obtain .PNG output images. Actually, I'm working with big
> data (NetCDF file, dimension is about 75Mb). The current Matplotlib version
> on my UBUNTU 14.04 machine is the 1.3.1 one. My system has a RAM capacity
> of 8Gb.
> Actually, I'm dealing with memory system problems when I try to make a
> plot. I got the error message as follow:
>
> --------------------------------------------
> cs = m.pcolor(xi,yi,np.squeeze(t))
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py",
> line 521, in with_transform
> return plotfunc(self,x,y,data,*args,**kwargs)
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py",
> line 3375, in pcolor
> x = ma.masked_values(np.where(x > 1.e20,1.e20,x), 1.e20)
> File "/usr/lib/python2.7/dist-packages/numpy/ma/core.py", line 2195, in
> masked_values
> condition = umath.less_equal(mabs(xnew - value), atol + rtol *
> mabs(value))
> MemoryError
> --------------------------------------------
>
> Otherwise, when I try to make a plot of smaller file (such as 5Mb), it
> works very well. I believe that it's not something of wrong in the script.
> It might be a memory system problem.
> I hope that my message is more clear now.
>
> Thanks for the help.
>
> Regards,
>
> Raffaele
>
> -----------------------------------------
>
> Sent: Mon 9/8/2014 3:19 PM
> To: Raffaele Quarta
> Cc: Matplotlib Users
> Subject: Re: [Matplotlib-users] Plotting large file (NetCDF)
>
>
> You will need to be more specific... much more specific. What kind of plot
> are you making? How big is your data? What version of matplotlib are you
> using? How much RAM do you have available compared to the amount of data
> (most slowdowns are actually due to swap-thrashing issues). Matplotlib can
> be used for large data, but there exists some speciality tools for the
> truly large datasets. The solution depends on the situation.
>
> Ben Root
>
> On Mon, Sep 8, 2014 at 7:45 AM, Raffaele Quarta <
> raf...@li...>
> wrote:
>
> > Hi,
> >
> > I'm working with NetCDF format. When I try to make a plot of very large
> > file, I have to wait for a long time for plotting. How can I solve this?
> > Isn't there a solution for this problem?
> >
> > Raffaele
> >
> > --
> > This email was Virus checked by Astaro Security Gateway.
> http://www.sophos.com
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Want excitement?
> > Manually upgrade your production database.
> > When you want reliability, choose Perforce
> > Perforce version control. Predictably reliable.
> >
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
>
> --
> This email was Virus checked by Astaro Security Gateway.
> http://www.sophos.com
>
>
From: Benjamin R. <ben...@ou...> - 2014年09月08日 13:20:06
You will need to be more specific... much more specific. What kind of plot
are you making? How big is your data? What version of matplotlib are you
using? How much RAM do you have available compared to the amount of data
(most slowdowns are actually due to swap-thrashing issues). Matplotlib can
be used for large data, but there exists some speciality tools for the
truly large datasets. The solution depends on the situation.
Ben Root
On Mon, Sep 8, 2014 at 7:45 AM, Raffaele Quarta <raf...@li...>
wrote:
> Hi,
>
> I'm working with NetCDF format. When I try to make a plot of very large
> file, I have to wait for a long time for plotting. How can I solve this?
> Isn't there a solution for this problem?
>
> Raffaele
>
> --
> This email was Virus checked by Astaro Security Gateway. http://www.sophos.com
>
>
>
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Raffaele Q. <raf...@li...> - 2014年09月08日 11:46:20
Hi,
I'm working with NetCDF format. When I try to make a plot of very large file, I have to wait for a long time for plotting. How can I solve this? Isn't there a solution for this problem? 
Raffaele 
-- 
This email was Virus checked by Astaro Security Gateway. http://www.sophos.com
From: Pierre H. <pie...@cr...> - 2014年09月08日 10:23:53
Le 05/09/2014 21:53, Arnaldo Russo a écrit :
> The following code plots my table, but greek letters are not in Arial.
What about adding greek letters directly with a Unicode string and 
keeping LaTex only for the table?
best,
Pierre
(my greek and math unicode "copy-pasting files" attached)
From: Ken M. <ma...@gm...> - 2014年09月08日 02:28:31
Hi,
I'm having trouble with Basemap South Pole Stereographic
projections. The required "boundinglat" doesn't seem to work properly,
and I hope someone can help me figure out the correct syntax.
I have the following information about the data:
extent: -3,333,500 to 3,333,500 m
true scale latitude: -71
south pole stereographic projection.
Given this, I try the following:
m = Basemap(resolution='c',projection='spstere',
lat_ts=-71,lat_0=0.,lon_0=0.)
And it crashes reporting that I need boundinglat. I can't give
width/height which are accepted by the 'stere' projection.
I use http://www.pgc.umn.edu/tools/conversion and determine that
3333500 is 60 degrees south. If then add "boundinglat=-60" to the
Basemap call, the data appears nowhere near the correct location.
If I add "boundinglat=-89.999999" it looks almost perfect. If I change
that to "-90" or add a few more 9's, it crashes.
Am I determining the bounding lat correctly from the provided
information? Should I be calling Basemap differently? Any help will be
much appreciated.
Thanks,
 Ken Mankoff
 
From: Mannucci, A. J (335G) <ant...@jp...> - 2014年09月07日 21:21:43
I have studied how to make floating axes with curvilinear grids. However, I cannot figure out how to achieve my desired goals.
The code snippet below is a distillation that takes me part-way there. I cannot seem to access/modify the radial tick labels and their locations.
I am plotting data in a latitude/longitude coordinate system. I am converting latitude to the radial coordinate, and longitude is the angular coordinate. My plot extends from 90 degrees latitude (= zero radius) to 50 degrees latitude (=cos(50) radius). The figure appears like a pie wedge, with the point of the pie pointing down and the circular part of the wedge at the top.I can easily translate the data into radius/angle coordinates for the plotting.
What I cannot figure out is how to change the radial axis labels. I want these to go from 90 to 50. That is, coordinate 0 should have the label "90", and coordinate 50 should have the label "50". Since I am not versed in the various low-level artists, I cannot figure out how to change the axis labels. By default, the tick labels run from 0 to 50.
In the code below, I manipulate the object called ax1.axis["left"]. I can toggle the labels on and off, and whether there is a text label. However, I cannot figure out how to set the tick labels and where they are located. In all the examples I've seen online, defaults axes labels are used, so I don't know how to do this. I have searched the documentation but cannot find a function that allows me to set tick labels and their locations. In the pylab interface, this can be done, e.g. with ax.set_xticks and ax.set_xticklabels. I don't know how to do this without the pylab interface.
Help is appreciated! Thank you.
=======================
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.axisartist.floating_axes as floating_axes
from matplotlib.projections import PolarAxes
from matplotlib.transforms import Affine2D
fig = plt.figure()
tr_rotate = Affine2D().translate(30, 0)
tr_scale = Affine2D().scale(np.pi/180., 1.)
tr = tr_rotate + tr_scale + PolarAxes.PolarTransform()
grid_helper = floating_axes.GridHelperCurveLinear( tr, extremes=( 0, 120,
0.0, 50.0), tick_formatter1 = None, tick_formatter2 = None )
ax1 = floating_axes.FloatingSubplot( fig, 111, grid_helper=grid_helper )
# adjust axis
ax1.axis["left"].set_axis_direction("bottom")
ax1.axis["right"].set_axis_direction("top")
ax1.axis["bottom"].set_visible(False)
ax1.axis["top"].set_axis_direction("bottom")
ax1.axis["top"].toggle(ticklabels=False, label=False)
ax1.axis["left"].toggle(ticklabels=False, label=False) # This is radial axis, outside.
ax1.axis["top"].major_ticklabels.set_axis_direction("top")
ax1.axis["top"].label.set_axis_direction("top")
a = ax1.axis["left"]
a.toggle(ticklabels=True, label=True)
a.label.set_text("Magnetic Latitude")
aux_ax = ax1.get_aux_axes(tr)
aux_ax.patch = ax1.patch
fig.add_subplot( ax1 )
aux_ax.plot([55.0, 55.0, 65.0, 45.0], [45., 30.0, 10., 20.], marker='o', ls='')
ax1.grid( True )
plt.show()
=======================
-Tony
--
Tony Mannucci
Supervisor, Ionospheric and Atmospheric Remote Sensing Group
 Mail-Stop 138-308, Tel > (818) 354-1699
 Jet Propulsion Laboratory, Fax > (818) 393-5115
 California Institute of Technology, Email > Ton...@jp...
 4800 Oak Grove Drive, http://scienceandtechnology.jpl.nasa.gov/people/a_mannucci/
 Pasadena, CA 91109
From: Oliver <oli...@gm...> - 2014年09月07日 11:30:06
pyplot.gca().set_xlim([0, 10])
2014年09月07日 13:20 GMT+02:00 Albert Yiamakis <vki...@gm...>:
> Hello,
>
> When creating a simple plot with
>
> xs = [0.01*x for x in range(1000)]
> ys = [x*x for x in xs]
> pyplot.fill_between(xs, ys)
>
> The plot shows between x=0 and x=10, as expected.
> However, when looking to fill between 2 and 8, in this way:
>
> b = [False if x<2 or x>8 else True for x in xs]
> pyplot.fill_between(xs, ys, where=b)
>
> Then the plot shows between x=0 and x=8. Is there a way to get it to show
> up to x=10? Thanks,
>
> Albert
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Albert Y. <vki...@gm...> - 2014年09月07日 11:20:39
Hello,
When creating a simple plot with
xs = [0.01*x for x in range(1000)]
ys = [x*x for x in xs]
pyplot.fill_between(xs, ys)
The plot shows between x=0 and x=10, as expected.
However, when looking to fill between 2 and 8, in this way:
b = [False if x<2 or x>8 else True for x in xs]
pyplot.fill_between(xs, ys, where=b)
Then the plot shows between x=0 and x=8. Is there a way to get it to
show up to x=10? Thanks,
Albert
From: fizix137 <fiz...@gm...> - 2014年09月07日 01:34:47
My full question is in stack overflow. Basically I want to add an image of a
flag into each of the wedges of a pie chart. The wedges will never be
smaller than 1/8 of the pie so the flag should always fit nicely.
I can't figure out how to get an image to be inside a wedge. That's what I
need help with.
Thanks!
http://stackoverflow.com/questions/25596938/matplotlib-applying-an-image-as-the-background-of-a-matplotlib-wedge
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Get-an-image-into-a-wedge-of-a-pie-chart-tp43899.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Arnaldo R. <arn...@gm...> - 2014年09月06日 20:01:33
Hi Tobi and others,
I have tested include other packages (e.g \usepackage{cmbright} ), but it
seems to not solve my problem.
Including on matplotlibrc, exactly the lines as you said, my output is the
same as I have attached (Matplotlib To.png).
On pure LaTex, I really don't know how it should be charged. I have tried
this:
\documentclass{report}
\usepackage{fontspec}\setmainfont{Arial}\setmathrm{Arial}\setmathsf{Arial}\setmathtt{Arial}\usepackage{amsmath}
\begin{document}
$\mu$text $\eta$text $\cdot$ m$^{-2}$ s$^{-1}$
\end{document}
Thanks
---
*Arnaldo D'Amaral Pereira Granja Russo*
Lab. de Estudos dos Oceanos e Clima
Instituto de Oceanografia - FURG
2014年09月06日 6:19 GMT-03:00 Tobias Winchen <to...@wi...>:
> Hi,
>
> On Friday 05 September 2014 16:53:47 Arnaldo Russo wrote:
> > I'm trying to figure out how I could use greek letters on axis labels,
> > without italic.
> > I have read a lot about alternatives, but I do need to use LaTeX to
> insert
> > a table inside the plot area.
>
> I use the sfmath package together with the sans-serif latex fonts in
> matplotlib. The relevant lines in my matplotlibrc are:
>
> font.family : sans-serif
> font.serif : Computer Modern Roman, Times, Palatino,
> font.sans-serif : Computer Modern Sans serif, Helvetica, Avant Garde,
> font.cursive : Zapf Chancery
> font.monospace : Courier, Computer Modern Typewriter
>
> text.latex.unicode : True
> text.latex.preamble : \usepackage{lmodern},\usepackage{sfmath},
> \usepackage{amsmath}, \usepackage{amssymb}, \usepackage{siunitx},
>
> This should do what you want?
>
> Best regards,
>
>
> Tobi
>
From: Sterling S. <sm...@fu...> - 2014年09月05日 20:50:09
When I wanted to make my math text in a LaTeX beamer presentation upright, I added the following to my beamer style file:
%%Attempt to get upright math symbols
\AtBeginDocument{
 \DeclareSymbolFont{pureletters}{\encodingdefault}{\mathfamilydefault}{m}{n}
 \SetMathAlphabet{\mathrm}{normal}{\encodingdefault}{\rmdefault}{m}{n}
 \DeclareMathAlphabet{\mathbf}{\encodingdefault}{\mathfamilydefault}{bx}{n}
 \DeclareMathAlphabet{\mathsf}{\encodingdefault}{\sfdefault}{m}{n}
 \DeclareMathAlphabet{\mathit}{\encodingdefault}{\mathfamilydefault}{m}{it}
 \DeclareMathAlphabet{\mathtt}{\encodingdefault}{\ttdefault}{m}{n}
 \ifx\mv at bold\@undefined\else
 \SetSymbolFont{numbers}{bold}{\encodingdefault}{\mathfamilydefault}{bx}{n}
 \SetSymbolFont{pureletters}{bold}{\encodingdefault}{\mathfamilydefault}{bx}{n}
 \SetMathAlphabet{\mathrm}{bold}{\encodingdefault}{\rmdefault}{bx}{n}
 \SetMathAlphabet{\mathbf}{bold}{\encodingdefault}{\mathfamilydefault}{bx}{n}
 \SetMathAlphabet{\mathsf}{bold}{\encodingdefault}{\sfdefault}{bx}{n}
 \SetMathAlphabet{\mathit}{bold}{\encodingdefault}{\mathfamilydefault}{bx}{it}
 \SetMathAlphabet{\mathtt}{bold}{\encodingdefault}{\ttdefault}{bx}{n}
 \fi
 \def\operator at font{\mathgroup\symnumbers}
 \DeclareMathSymbol{0}\mathalpha{numbers}{"30}
 \DeclareMathSymbol{1}\mathalpha{numbers}{"31}
 \DeclareMathSymbol{2}\mathalpha{numbers}{"32}
 \DeclareMathSymbol{3}\mathalpha{numbers}{"33}
 \DeclareMathSymbol{4}\mathalpha{numbers}{"34}
 \DeclareMathSymbol{5}\mathalpha{numbers}{"35}
 \DeclareMathSymbol{6}\mathalpha{numbers}{"36}
 \DeclareMathSymbol{7}\mathalpha{numbers}{"37}
 \DeclareMathSymbol{8}\mathalpha{numbers}{"38}
 \DeclareMathSymbol{9}\mathalpha{numbers}{"39}
 \DeclareMathSymbol{A}\mathalpha{pureletters}{"41}
 \DeclareMathSymbol{B}\mathalpha{pureletters}{"42}
 \DeclareMathSymbol{C}\mathalpha{pureletters}{"43}
 \DeclareMathSymbol{D}\mathalpha{pureletters}{"44}
 \DeclareMathSymbol{E}\mathalpha{pureletters}{"45}
 \DeclareMathSymbol{F}\mathalpha{pureletters}{"46}
 \DeclareMathSymbol{G}\mathalpha{pureletters}{"47}
 \DeclareMathSymbol{H}\mathalpha{pureletters}{"48}
 \DeclareMathSymbol{I}\mathalpha{pureletters}{"49}
 \DeclareMathSymbol{J}\mathalpha{pureletters}{"4A}
 \DeclareMathSymbol{K}\mathalpha{pureletters}{"4B}
 \DeclareMathSymbol{L}\mathalpha{pureletters}{"4C}
 \DeclareMathSymbol{M}\mathalpha{pureletters}{"4D}
 \DeclareMathSymbol{N}\mathalpha{pureletters}{"4E}
 \DeclareMathSymbol{O}\mathalpha{pureletters}{"4F}
 \DeclareMathSymbol{P}\mathalpha{pureletters}{"50}
 \DeclareMathSymbol{Q}\mathalpha{pureletters}{"51}
 \DeclareMathSymbol{R}\mathalpha{pureletters}{"52}
 \DeclareMathSymbol{S}\mathalpha{pureletters}{"53}
 \DeclareMathSymbol{T}\mathalpha{pureletters}{"54}
 \DeclareMathSymbol{U}\mathalpha{pureletters}{"55}
 \DeclareMathSymbol{V}\mathalpha{pureletters}{"56}
 \DeclareMathSymbol{W}\mathalpha{pureletters}{"57}
 \DeclareMathSymbol{X}\mathalpha{pureletters}{"58}
 \DeclareMathSymbol{Y}\mathalpha{pureletters}{"59}
 \DeclareMathSymbol{Z}\mathalpha{pureletters}{"5A}
 \DeclareMathSymbol{a}\mathalpha{pureletters}{"61}
 \DeclareMathSymbol{b}\mathalpha{pureletters}{"62}
 \DeclareMathSymbol{c}\mathalpha{pureletters}{"63}
 \DeclareMathSymbol{d}\mathalpha{pureletters}{"64}
 \DeclareMathSymbol{e}\mathalpha{pureletters}{"65}
 \DeclareMathSymbol{f}\mathalpha{pureletters}{"66}
 \DeclareMathSymbol{g}\mathalpha{pureletters}{"67}
 \DeclareMathSymbol{h}\mathalpha{pureletters}{"68}
 \DeclareMathSymbol{i}\mathalpha{pureletters}{"69}
 \DeclareMathSymbol{j}\mathalpha{pureletters}{"6A}
 \DeclareMathSymbol{k}\mathalpha{pureletters}{"6B}
 \DeclareMathSymbol{l}\mathalpha{pureletters}{"6C}
 \DeclareMathSymbol{m}\mathalpha{pureletters}{"6D}
 \DeclareMathSymbol{n}\mathalpha{pureletters}{"6E}
 \DeclareMathSymbol{o}\mathalpha{pureletters}{"6F}
 \DeclareMathSymbol{p}\mathalpha{pureletters}{"70}
 \DeclareMathSymbol{q}\mathalpha{pureletters}{"71}
 \DeclareMathSymbol{r}\mathalpha{pureletters}{"72}
 \DeclareMathSymbol{s}\mathalpha{pureletters}{"73}
 \DeclareMathSymbol{t}\mathalpha{pureletters}{"74}
 \DeclareMathSymbol{u}\mathalpha{pureletters}{"75}
 \DeclareMathSymbol{v}\mathalpha{pureletters}{"76}
 \DeclareMathSymbol{w}\mathalpha{pureletters}{"77}
 \DeclareMathSymbol{x}\mathalpha{pureletters}{"78}
 \DeclareMathSymbol{y}\mathalpha{pureletters}{"79}
 \DeclareMathSymbol{z}\mathalpha{pureletters}{"7A}
}
I don't know if that helps here. Perhaps you would add this to rcParams['latex.preamble'], which was always advertised as being experimental. (You may need to preface it with \makeatletter, and end with \makeatother.)
-Sterling
On Sep 5, 2014, at 1:21PM, Paul Hobson wrote:
> How do you do this in a normal LaTeX document?
> 
> 
> On Fri, Sep 5, 2014 at 12:53 PM, Arnaldo Russo <arn...@gm...> wrote:
> Hi,
> 
> I'm trying to figure out how I could use greek letters on axis labels, without italic.
> I have read a lot about alternatives, but I do need to use LaTeX to insert a table inside the plot area.
> 
> Using mathtex it responds with normal font on greek letters.
> 
> What I`m doing wrong?
> 
> The following code plots my table, but greek letters are not in Arial.
> 
> import
> numpy as np
> 
> import matplotlib.
> pyplot as plt
> 
> t2 
> = np.arange(100)
> 
> fig 
> = plt.figure(figsize=(8,4))
> 
> ax 
> = fig.add_subplot(111)
> 
> 
> plt
> .rcParams.update({'font.family' : 'sans-serif',
> 
> 
> 'font.sans-serif' : 'Arial',
> 
> 
> 'font.style' : 'normal',
> 
> 
> 'xtick.labelsize' : 12,
> 
> 
> 'ytick.labelsize' : 12,
> 
> 
> 'mathtext.fontset' : 'stixsans',
> 
> 
> 'mathtext.default': 'regular',
> 
> 
> 'mathtext.tt' : 'Arial',
> 
> 
> })
> 
> plt
> .subplots_adjust(left=0.12, right=0.95, top=0.95, bottom=0.1)
> 
> 
> 
> ax
> .set_xlim(0,100)
> 
> xvals 
> = [0, 16.6, 33.33, 50, 66.66, 83.33, 100]
> 
> ax
> .set_xticks(xvals)
> 
> ax
> .set_xticklabels(['tick 0', 'tick 1', 'tick 2','tick 3', 'tick 4', 'tick 5', 'tick 6'])
> 
> ax
> .set_ylabel(r'$\mu$text $\eta$text $\cdot$ m$^{-2}$ s$^{-1}$')
> 
> ax
> .set_yticklabels(['0', '200', '400', '600', '800', '1000', '1200', '1400'])
> 
> ax
> .plot(t2, color='black')
> 
> ax
> .fill_between(np.arange(0, len(t2)),t2,0, color='black', alpha=0.8)
> 
> 
> 
> 
> from matplotlib import
> rc
> rc
> ('font',**{'family':'sans-serif','sans-serif':['Arial']})
> 
> rc
> ('text', usetex=True)
> 
> table 
> = r'''\begin{tabular}{lccccccc}\hline&tick 0& tick 1 & tick 2 & tick 3 & tick 4 & tick 5 & tick 6 \\\hline Vals & 32.00 & 3.28 & 5.80 & 5 & 8 & 45 & 7.3 \\\hline \end{tabular}'''
> 
> plt
> .text(20,80,table,size=10)
> 
> 
> plt
> .show()
> 
> And an example using Mathtex, using regular fonts work out of the box, but my table of course is included as plain text. I have to close my IPython session and start it again to correct usage of plot parameters.
> 
> import
> numpy as np
> 
> import matplotlib.
> pyplot as plt
> 
> t2 
> = np.arange(100)
> 
> fig 
> = plt.figure(figsize=(8,4))
> 
> ax 
> = fig.add_subplot(111)
> 
> 
> plt
> .rcParams.update({'xtick.labelsize' : 12,
> 
> 
> 'ytick.labelsize' : 12,
> 
> 
> 'mathtext.fontset' : 'stixsans',
> 
> 
> 'mathtext.default': 'regular',
> 
> 
> 'mathtext.tt' : 'Arial',
> 
> 
> })
> 
> plt
> .subplots_adjust(left=0.12, right=0.95, top=0.95, bottom=0.1)
> 
> 
> 
> ax
> .set_xlim(0,100)
> 
> xvals 
> = [0, 16.6, 33.33, 50, 66.66, 83.33, 100]
> 
> ax
> .set_xticks(xvals)
> 
> ax
> .set_xticklabels(['tick 0', 'tick 1', 'tick 2','tick 3', 'tick 4', 'tick 5', 'tick 6'])
> 
> ax
> .set_ylabel(r'$\mu$text $\eta$text $\cdot$ m$^{-2}$ s$^{-1}$')
> 
> ax
> .set_yticklabels(['0', '200', '400', '600', '800', '1000', '1200', '1400'])
> 
> ax
> .plot(t2, color='black')
> 
> ax
> .fill_between(np.arange(0, len(t2)),t2,0, color='black', alpha=0.8)
> 
> 
> 
> #from matplotlib import rc
> #rc('font',**{'family':'sans-serif','sans-serif':['Arial']})
> #rc('text', usetex=True)
> 
> table 
> = r'''\begin{tabular}{lccccccc}\hline&tick 0& tick 1 & tick 2 & tick 3 & tick 4 & tick 5 & tick 6 \\\hline Vals & 32.00 & 3.28 & 5.80 & 5 & 8 & 45 & 7.3 \\\hline \end{tabular}'''
> 
> plt
> .text(20,80,table,size=10)
> 
> 
> plt
> .show()
> 
> Regards,
> Arnaldo.
> 
> ---
> Arnaldo D'Amaral Pereira Granja Russo
> Lab. de Estudos dos Oceanos e Clima
> Instituto de Oceanografia - FURG
> 
> 
> 
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> ------------------------------------------------------------------------------
> Slashdot TV. 
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Paul H. <pmh...@gm...> - 2014年09月05日 20:21:44
How do you do this in a normal LaTeX document?
On Fri, Sep 5, 2014 at 12:53 PM, Arnaldo Russo <arn...@gm...>
wrote:
> Hi,
>
> I'm trying to figure out how I could use greek letters on axis labels,
> without italic.
> I have read a lot about alternatives, but I do need to use LaTeX to insert
> a table inside the plot area.
>
> Using mathtex it responds with normal font on greek letters.
>
> What I`m doing wrong?
>
> The following code plots my table, but greek letters are not in Arial.
>
> import numpy as npimport matplotlib.pyplot as plt
>
> t2 = np.arange(100)
> fig = plt.figure(figsize=(8,4))
> ax = fig.add_subplot(111)
>
> plt.rcParams.update({'font.family' : 'sans-serif',
> 'font.sans-serif' : 'Arial',
> 'font.style' : 'normal',
> 'xtick.labelsize' : 12,
> 'ytick.labelsize' : 12,
> 'mathtext.fontset' : 'stixsans',
> 'mathtext.default': 'regular',
> 'mathtext.tt' : 'Arial',
> })
> plt.subplots_adjust(left=0.12, right=0.95, top=0.95, bottom=0.1)
>
>
> ax.set_xlim(0,100)
> xvals = [0, 16.6, 33.33, 50, 66.66, 83.33, 100]
> ax.set_xticks(xvals)
> ax.set_xticklabels(['tick 0', 'tick 1', 'tick 2','tick 3', 'tick 4', 'tick 5', 'tick 6'])
> ax.set_ylabel(r'$\mu$text $\eta$text $\cdot$ m$^{-2}$ s$^{-1}$')
> ax.set_yticklabels(['0', '200', '400', '600', '800', '1000', '1200', '1400'])
> ax.plot(t2, color='black')
> ax.fill_between(np.arange(0, len(t2)),t2,0, color='black', alpha=0.8)
>
> from matplotlib import rc
> rc('font',**{'family':'sans-serif','sans-serif':['Arial']})
> rc('text', usetex=True)
> table = r'''\begin{tabular}{lccccccc}\hline&tick 0& tick 1 & tick 2 & tick 3 & tick 4 & tick 5 & tick 6 \\\hline Vals & 32.00 & 3.28 & 5.80 & 5 & 8 & 45 & 7.3 \\\hline \end{tabular}'''
> plt.text(20,80,table,size=10)
>
> plt.show()
>
>
> And an example using Mathtex, using regular fonts work out of the box, but
> my table of course is included as plain text. I have to close my IPython
> session and start it again to correct usage of plot parameters.
>
> import numpy as npimport matplotlib.pyplot as plt
>
> t2 = np.arange(100)
> fig = plt.figure(figsize=(8,4))
> ax = fig.add_subplot(111)
>
> plt.rcParams.update({'xtick.labelsize' : 12,
> 'ytick.labelsize' : 12,
> 'mathtext.fontset' : 'stixsans',
> 'mathtext.default': 'regular',
> 'mathtext.tt' : 'Arial',
> })
> plt.subplots_adjust(left=0.12, right=0.95, top=0.95, bottom=0.1)
>
>
> ax.set_xlim(0,100)
> xvals = [0, 16.6, 33.33, 50, 66.66, 83.33, 100]
> ax.set_xticks(xvals)
> ax.set_xticklabels(['tick 0', 'tick 1', 'tick 2','tick 3', 'tick 4', 'tick 5', 'tick 6'])
> ax.set_ylabel(r'$\mu$text $\eta$text $\cdot$ m$^{-2}$ s$^{-1}$')
> ax.set_yticklabels(['0', '200', '400', '600', '800', '1000', '1200', '1400'])
> ax.plot(t2, color='black')
> ax.fill_between(np.arange(0, len(t2)),t2,0, color='black', alpha=0.8)
> #from matplotlib import rc#rc('font',**{'family':'sans-serif','sans-serif':['Arial']})#rc('text', usetex=True)
> table = r'''\begin{tabular}{lccccccc}\hline&tick 0& tick 1 & tick 2 & tick 3 & tick 4 & tick 5 & tick 6 \\\hline Vals & 32.00 & 3.28 & 5.80 & 5 & 8 & 45 & 7.3 \\\hline \end{tabular}'''
> plt.text(20,80,table,size=10)
>
> plt.show()
>
>
> Regards,
> Arnaldo.
>
> ---
> *Arnaldo D'Amaral Pereira Granja Russo*
> Lab. de Estudos dos Oceanos e Clima
> Instituto de Oceanografia - FURG
>
>
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Arnaldo R. <arn...@gm...> - 2014年09月05日 19:54:27
Hi,
I'm trying to figure out how I could use greek letters on axis labels,
without italic.
I have read a lot about alternatives, but I do need to use LaTeX to insert
a table inside the plot area.
Using mathtex it responds with normal font on greek letters.
What I`m doing wrong?
The following code plots my table, but greek letters are not in Arial.
import numpy as npimport matplotlib.pyplot as plt
t2 = np.arange(100)
fig = plt.figure(figsize=(8,4))
ax = fig.add_subplot(111)
plt.rcParams.update({'font.family' : 'sans-serif',
 'font.sans-serif' : 'Arial',
 'font.style' : 'normal',
 'xtick.labelsize' : 12,
 'ytick.labelsize' : 12,
 'mathtext.fontset' : 'stixsans',
 'mathtext.default': 'regular',
 'mathtext.tt' : 'Arial',
 })
plt.subplots_adjust(left=0.12, right=0.95, top=0.95, bottom=0.1)
ax.set_xlim(0,100)
xvals = [0, 16.6, 33.33, 50, 66.66, 83.33, 100]
ax.set_xticks(xvals)
ax.set_xticklabels(['tick 0', 'tick 1', 'tick 2','tick 3', 'tick 4',
'tick 5', 'tick 6'])
ax.set_ylabel(r'$\mu$text $\eta$text $\cdot$ m$^{-2}$ s$^{-1}$')
ax.set_yticklabels(['0', '200', '400', '600', '800', '1000', '1200', '1400'])
ax.plot(t2, color='black')
ax.fill_between(np.arange(0, len(t2)),t2,0, color='black', alpha=0.8)
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Arial']})
rc('text', usetex=True)
table = r'''\begin{tabular}{lccccccc}\hline&tick 0& tick 1 & tick 2 &
tick 3 & tick 4 & tick 5 & tick 6 \\\hline Vals & 32.00 & 3.28 & 5.80
& 5 & 8 & 45 & 7.3 \\\hline \end{tabular}'''
plt.text(20,80,table,size=10)
plt.show()
And an example using Mathtex, using regular fonts work out of the box, but
my table of course is included as plain text. I have to close my IPython
session and start it again to correct usage of plot parameters.
import numpy as npimport matplotlib.pyplot as plt
t2 = np.arange(100)
fig = plt.figure(figsize=(8,4))
ax = fig.add_subplot(111)
plt.rcParams.update({'xtick.labelsize' : 12,
 'ytick.labelsize' : 12,
 'mathtext.fontset' : 'stixsans',
 'mathtext.default': 'regular',
 'mathtext.tt' : 'Arial',
 })
plt.subplots_adjust(left=0.12, right=0.95, top=0.95, bottom=0.1)
ax.set_xlim(0,100)
xvals = [0, 16.6, 33.33, 50, 66.66, 83.33, 100]
ax.set_xticks(xvals)
ax.set_xticklabels(['tick 0', 'tick 1', 'tick 2','tick 3', 'tick 4',
'tick 5', 'tick 6'])
ax.set_ylabel(r'$\mu$text $\eta$text $\cdot$ m$^{-2}$ s$^{-1}$')
ax.set_yticklabels(['0', '200', '400', '600', '800', '1000', '1200', '1400'])
ax.plot(t2, color='black')
ax.fill_between(np.arange(0, len(t2)),t2,0, color='black', alpha=0.8)
#from matplotlib import
rc#rc('font',**{'family':'sans-serif','sans-serif':['Arial']})#rc('text',
usetex=True)
table = r'''\begin{tabular}{lccccccc}\hline&tick 0& tick 1 & tick 2 &
tick 3 & tick 4 & tick 5 & tick 6 \\\hline Vals & 32.00 & 3.28 & 5.80
& 5 & 8 & 45 & 7.3 \\\hline \end{tabular}'''
plt.text(20,80,table,size=10)
plt.show()
Regards,
Arnaldo.
---
*Arnaldo D'Amaral Pereira Granja Russo*
Lab. de Estudos dos Oceanos e Clima
Instituto de Oceanografia - FURG
From: David P. <dp...@ny...> - 2014年09月04日 21:37:32
NumPy, SciPy, MatPlotLib Users & Science teachers:
I have written an introduction to scientific python that you may find useful. You can download it from GitHub and use it freely:
https://github.com/djpine/pyman
I wrote this manual/book for undergraduates taking science and engineering courses that use programming to solve science and engineering problems. It is not for experts. I am sharing it with the hope that others may find it useful. It includes an introduction to very basic programming, numpy, matplotlib, & scipy, as well as instructions on how to download and install Python and these three libraries. It also includes an introduction to IPython notebooks.
Corrections and suggestions for improvements are welcome.
David Pine
From: Eric F. <ef...@ha...> - 2014年09月01日 06:42:51
On 2014年08月31日, 6:48 PM, John Ladasky wrote:
> Hi folks,
>
> I am trying to install Matplotlib 1.4.0 on an older laptop, running
> Ubuntu 12.04. I am committed to Python 3. In the standard Ubuntu
> repositories, python3-matplotlib (of any version) is unavailable until
> Ubuntu 13.04.
>
> My first instinct would be to upgrade to a more current Ubuntu
> revision. However, when I tried to upgrade Ubuntu, I received a warning
> that the Unity3D GUI was probably too heavy-weight for my machine.
My recommendation is to switch to Xubuntu 14.04 if/when you can manage 
the disruption of doing a clean installation.
> Traceback (most recent call last):
> File "setup.py", line 154, in <module>
> result = package.check()
> File "/home/john/Desktop/matplotlib-1.4.0/setupext.py", line 940, in
> check
> if 'No such file or directory\ngrep:' in version:
> TypeError: argument of type 'NoneType' is not iterable
>
This is a bug in 1.4.0 that has been fixed in 1.4.x.
Eric
From: John L. <joh...@sb...> - 2014年09月01日 06:36:50
On 08/31/2014 09:48 PM, John Ladasky wrote:
> Hi folks,
>
> I am trying to install Matplotlib 1.4.0 on an older laptop, running 
> Ubuntu 12.04. I am committed to Python 3. In the standard Ubuntu 
> repositories, python3-matplotlib (of any version) is unavailable until 
> Ubuntu 13.04.
[snip]
OK. Problem solved. I succeeded in building and installing Matplotlib. 
It looks like I don't have any backends installed, but I'll fix that next.
I had freetype12 installed, but NOT freetype-dev. I figured this out by 
looking at the source code of setupext.py. Ordinarily I get more 
descriptive error messages when a Matplotlib build fails. Even if 
they're coming from the C++ compiler, I get the name of the file which 
triggered the error, and it is usually related to the name of the broken 
package.
From: John L. <joh...@sb...> - 2014年09月01日 04:48:37
Hi folks,
I am trying to install Matplotlib 1.4.0 on an older laptop, running 
Ubuntu 12.04. I am committed to Python 3. In the standard Ubuntu 
repositories, python3-matplotlib (of any version) is unavailable until 
Ubuntu 13.04.
My first instinct would be to upgrade to a more current Ubuntu 
revision. However, when I tried to upgrade Ubuntu, I received a warning 
that the Unity3D GUI was probably too heavy-weight for my machine.
I have read the matplotlib 1.4.0 documentation and, according to the 
dependencies information contained there, it looks like I should be able 
to get matplotlib 1.4.0 to run on my machine if I take the trouble to 
install the dependencies manually. I have done this before, on other 
machines.
I thought that I followed the directions 
(http://matplotlib.org/users/installing.html) correctly. I believe that 
I have installed all the required dependencies, and I have even 
installed some of the optional ones I do not need. Something is still 
wrong. Here's my latest build error log from the console:
xxxx@xxxxxxxxxx:~/Desktop/matplotlib-1.4.0$ python3 setup.py build
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
 matplotlib: yes [1.4.0]
 python: yes [3.2.3 (default, Feb 27 2014, 21:33:50) [GCC
 4.6.3]]
 platform: yes [linux2]
REQUIRED DEPENDENCIES AND EXTENSIONS
 numpy: yes [version 1.6.1]
 six: yes [using six version 1.7.3]
 dateutil: yes [using dateutil version 2.0]
 tornado: yes [using tornado version 2.1]
 pyparsing: yes [using pyparsing version 2.0.2]
 pycxx: yes [Official versions of PyCXX are not compatible
 with Python 3.x. Using local copy]
 libagg: yes [pkg-config information for 'libagg' could not
 be found. Using local copy.]
Traceback (most recent call last):
 File "setup.py", line 154, in <module>
 result = package.check()
 File "/home/john/Desktop/matplotlib-1.4.0/setupext.py", line 940, in 
check
 if 'No such file or directory\ngrep:' in version:
TypeError: argument of type 'NoneType' is not iterable
The "required dependencies and extensions" section appears to be 
incomplete. I am expecting to see the installer check for freetype and 
png next. It never gets there.
A Python TypeError is being generated. My first thought would be that I 
have a Py2/Py3 compatibility issue, and I would immediately think of the 
_six_ package as the source of the problem. But maybe it's something else?
Any advice would be appreciated. Thanks.
4 messages has been excluded from this view by a project administrator.

Showing results of 98

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