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

Showing 9 results of 9

On 9/8/11 1:51 AM, Jakob Malm wrote:
> Picking up on an old thread. Hopefully Jeff is still listening in...
>
> On 2010年04月04日 23:24, Jeff Whitaker wrote:
>> On 4/4/10 11:06 AM, Will Hewson wrote:
>>> Hi again Jeff et al...
>>>
>>> I've had a play around with the extra few lines of code - on paper this
>>> seems like it should solve the problems I'm experiencing. However, an
>>> error's being thrown up by the transform scalar function, as my lons and
>>> lats won't necessarily be increasing. The data I'm plotting is satellite
>>> data and so at the beginning and end of the orbit file lats go over the pole
>>> from 90 to -90, with a similar problem for the lons - whereby the data is
>>> taken across the satellite track. I've thought about sorting the data before
>>> passing it to transform_scalar but I'm always going to be left with the
>>> problem in either lats or lons.
>>>
>>> I've uploaded the file I'm currently working with this time. It's three
>>> columns of lons, lats and z values.
>>>
>>> Once again, many thanks for your help.
>>>
>>> Will.
>>>
>>> http://old.nabble.com/file/p28133659/test.plt test.plt
>>>
>> Will: Is it a regular lat/lon grid or a satellite swath? If it's the
>> latter, you can't use my solution.
>>
>> -Jeff
> What if it _is_ a satellite swath? Can I get around the problem of
> off-projection plotting with Basemap.pcolormesh()?
> Example code and plots can be found at
> http://pythonbits.blogspot.com/2011/09/i-have-problem-with-basemap-plotting.html
>
> Thanks,
> Jakob Malm
>
Jakob: I think that's the price you pay for the speed of pcolormesh (vs 
pcolor). It appears to make more assumptions about the structure of 
your data. I don't see any way around it.
-Jeff
Hi,
sorry that it has taken me so long to reply. Anyway, i could be wrong,
but i don't think that the code:
 xi = np.linspace(llcrnlon,urcrnlon,1000)
 yi = np.linspace(llcrnlat,urcrnlat,1000)
will produce a grid which gives the lat/lon coordinates with 1km
spacing. The reason being is that the distance between 2 lons (say
-117.731659 and -91.303642) is different depending on where you are in
terms of the latitude (i.e. the extreme examples are of course the north
pole vs the equator). So the above gives a regular grid in terms of
degrees but not in terms of distance.
Anyway, but the example was still helpful in terms of getting me started
with the griddata issue. In my experience the mlab.griddate fcn did not
work as well as the scipy.griddata (but that could be a user error as
well ... ). Not sure why though. It might be the size of my source data
and the destination grid. I had to upgrade to the 64-bit python to be
able to access enough memory.
thanks
matt
On 9/6/2011 12:36 PM, Aman Thakral wrote:
> Hi Matt,
>
> Something like this?:
>
> def create_map(ax, llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat):
> m =
> Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,urcrnrlon=urcrnrlon,urcrnrlat=urcrnrlat,resolution='i',projection='cyl',lon_0=(urcrnrlon+llcrnrlon)/2,lat_0=(urcrnrlat+llcrnrlat)/2)
> m.drawcoastlines()
> m.drawmapboundary()
> m.drawstates(linewidth=3)
> m.fillcontinents(color='lightgrey',lake_color='white')
> m.drawcountries(linewidth=3)
> return m
>
>
> def plotMapData(ax,data):
>
> lats = []
> lons = []
> val = []
> 
> for k,v in data.iteritems():
> lats.append(float(k[0]))
> lons.append(float(k[1]))
> val.append(float(v))
> 
> value = np.array(val)
> lat = np.array(lats)
> lon = np.array(lons)
> 
> llcrnlon = lon.min()-0.5
> llcrnlat = lat.min()-0.5
> urcrnlon = lon.max()+0.5
> urcrnlat = lat.max()+0.5
>
> xi = np.linspace(llcrnlon,urcrnlon,1000)
> yi = np.linspace(llcrnlat,urcrnlat,1000)
> zi = griddata(lon,lat,value,xi,yi)
>
> cmap = cm.jet
> m = create_map(ax,llcrnlon,llcrnlat,urcrnlon,urcrnlat)
> cs = ax.contour(xi,yi,zi,15,linewidth=0.5,cmap=cmap,alpha=0.5) 
> ax.contourf(xi,yi,zi,15,cmap=cmap,zorder=1000,alpha=0.5)
>
> colorscale = cm.ScalarMappable()
> colorscale.set_array(value)
> colorscale.set_cmap(cmap)
>
> colors = colorscale.to_rgba(value)
> ax.scatter(lon,lat,c=colors,zorder=1000,cmap=cmap,s=10)
> colorbar(colorscale, shrink=0.50, ax=ax,extend='both')
> 
>
> On Tue, Sep 6, 2011 at 1:28 PM, Matt Funk <mat...@gm...
> <mailto:mat...@gm...>> wrote:
>
> Hi,
> i want to interpolate irregular spaced satellite data onto a regular
> spaced grid. The regular spaced grid should have cell sizes of
> 1km^2. Is
> it possible to use basemap to create such a grid. It looked like it
> includes some facilities like that, but i am not sure if they are
> meant
> to be used by end user or more like internal fcns (the makegrid
> fcn for
> example).
>
> Any advice would be appreciated.
>
> thanks
> matt
>
> ------------------------------------------------------------------------------
> Special Offer -- Download ArcSight Logger for FREE!
> Finally, a world-class log management solution at an even better
> price-free! And you'll get a free "Love Thy Logs" t-shirt when you
> download Logger. Secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsisghtdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
-- 
Matt Funk
Research Associate
Plant and Environmental Scienc. Dept.
New Mexico State University
From: Benjamin R. <ben...@ou...> - 2011年09月08日 16:22:02
On Thu, Sep 8, 2011 at 7:11 AM, xyz <mi...@op...> wrote:
> Hello,
> I have found
>
> http://matplotlib.sourceforge.net/plot_directive/mpl_examples/pylab_examples/histogram_demo_extended_05.hires.png
>
> http://matplotlib.sourceforge.net/plot_directive/mpl_examples/pylab_examples/histogram_demo_extended.py
>
> How is it possible to the following draw stacked bar charts with number
> in the chart:
> http://www.jpowered.com/php-scripts/stacked-bar-chart.htm
> http://gnuplot.sourceforge.net/demo_4.2/showcase_plot.png
>
> Thank you in advance.
>
>
The histogram() function is merely a convenience function that performs both
the histogramming calculation and calls bar() under the hood. Bar charts
are capable of being stacked using the "bottom" kwarg:
http://matplotlib.sourceforge.net/examples/pylab_examples/bar_stacked.html
As for numbers with the bars:
http://matplotlib.sourceforge.net/examples/pylab_examples/barchart_demo.html
http://matplotlib.sourceforge.net/examples/pylab_examples/barchart_demo2.html
I hope this helps!
Ben Root
From: Benjamin R. <ben...@ou...> - 2011年09月08日 16:09:42
On Thu, Sep 8, 2011 at 10:30 AM, Yves Revaz <yve...@ep...> wrote:
> Dear List,
>
> when I'm saving a plot with the option facecolor='k',
> around my image, there is still a one pixel white border.
>
> How is it possible to remove this ?
>
> try for example this very simple script:
> (using )
>
> import pylab as pt
> from numpy import *
>
> x = arange(0,10)
> y = x**2
> pt.plot(x,y)
>
> pt.savefig('qq.png',facecolor='k')
>
>
> Thanks in advance.
>
> yves
>
>
yves,
This might depend on the version of matplotlib and which backend you are
using. I currently do not see this white line on my development build of
mpl using the GTKAgg backend. What are you using?
Ben Root
From: Yves R. <yve...@ep...> - 2011年09月08日 15:30:31
Dear List,
when I'm saving a plot with the option facecolor='k',
around my image, there is still a one pixel white border.
How is it possible to remove this ?
try for example this very simple script:
(using )
import pylab as pt
from numpy import *
x = arange(0,10)
y = x**2
pt.plot(x,y)
pt.savefig('qq.png',facecolor='k')
Thanks in advance.
yves
-- 
 (o o)
--------------------------------------------oOO--(_)--OOo-------
 Dr. Yves Revaz
 Laboratory of Astrophysics
 Ecole Polytechnique Fédérale de Lausanne (EPFL)
 Observatoire de Sauverny Tel : ++ 41 22 379 24 28
 51. Ch. des Maillettes Fax : ++ 41 22 379 22 05
 1290 Sauverny e-mail : Yve...@ep...
 SWITZERLAND Web : http://www.lunix.ch/revaz/
----------------------------------------------------------------
From: Yves R. <yve...@ep...> - 2011年09月08日 13:39:14
Dear List,
how is it possible to change the color of the ticks of a colorbar,
created using :
cb = mpl.colorbar.ColorbarBase(ax, 
cmap=cmap,norm=norm,orientation='horizontal',format=formatter)
Thanks in advance !
yves
-- 
 (o o)
--------------------------------------------oOO--(_)--OOo-------
 Dr. Yves Revaz
 Laboratory of Astrophysics
 Ecole Polytechnique Fédérale de Lausanne (EPFL)
 Observatoire de Sauverny Tel : ++ 41 22 379 24 28
 51. Ch. des Maillettes Fax : ++ 41 22 379 22 05
 1290 Sauverny e-mail : Yve...@ep...
 SWITZERLAND Web : http://www.lunix.ch/revaz/
----------------------------------------------------------------
From: xyz <mi...@op...> - 2011年09月08日 12:14:15
From: Jakob M. <jak...@gm...> - 2011年09月08日 07:51:47
Picking up on an old thread. Hopefully Jeff is still listening in...
On 2010年04月04日 23:24, Jeff Whitaker wrote:
> On 4/4/10 11:06 AM, Will Hewson wrote:
>> Hi again Jeff et al...
>>
>> I've had a play around with the extra few lines of code - on paper this
>> seems like it should solve the problems I'm experiencing. However, an
>> error's being thrown up by the transform scalar function, as my lons and
>> lats won't necessarily be increasing. The data I'm plotting is satellite
>> data and so at the beginning and end of the orbit file lats go over the pole
>> from 90 to -90, with a similar problem for the lons - whereby the data is
>> taken across the satellite track. I've thought about sorting the data before
>> passing it to transform_scalar but I'm always going to be left with the
>> problem in either lats or lons.
>>
>> I've uploaded the file I'm currently working with this time. It's three
>> columns of lons, lats and z values.
>>
>> Once again, many thanks for your help.
>>
>> Will.
>>
>> http://old.nabble.com/file/p28133659/test.plt test.plt
>>
>
> Will: Is it a regular lat/lon grid or a satellite swath? If it's the
> latter, you can't use my solution.
>
> -Jeff
What if it _is_ a satellite swath? Can I get around the problem of
off-projection plotting with Basemap.pcolormesh()?
Example code and plots can be found at
http://pythonbits.blogspot.com/2011/09/i-have-problem-with-basemap-plotting.html
Thanks,
Jakob Malm
On Wed, Sep 7, 2011 at 12:09 AM, Jeffrey Spencer <jef...@gm...> wrote:
> Can I specify horizontal or vertical clipping?? Or what is the best way to
> get around this?
my understanding is that the clipping is done with a "closed" path. so
I don't think one can do such thing as horizontal clipping, etc. I
guess one way is to simply increase the size of the clipping box
toward the direction you want. Here is a simple example,
Regards,
-JJ
x = np.arange(0, 8, 0.01)
y = np.sin(x)
ax = subplot(111)
l1, = plot(x, y, lw=4)
import matplotlib.transforms as mtransforms
bbox_ = mtransforms.Bbox.from_bounds(0, 0, 1., 1 + 0.1) # increase the height
bbox = mtransforms.TransformedBbox(bbox_, ax.transAxes)
l1.set_clip_box(bbox)

Showing 9 results of 9

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