SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Sappy85 <rob...@gm...> - 2015年01月24日 16:11:23
I would like to draw very, very simple maps of only europe in matplotlib /
basemap, which takes very much time (around 10 seconds!). This is just
unreal!? Setting of resolution is only "l" (low).
I need to plot hundreds of those maps every few hours. This would be
impossible!!? :(
Here is the very simple code:
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
m = Basemap(projection='stere',lon_0=5,lat_0=90.0,rsphere=6371200.,\
 
llcrnrlon=-25.0,urcrnrlon=72.0,llcrnrlat=26.0,urcrnrlat=65.0,resolution='l')
m.drawcoastlines(linewidth=0.2)
m.drawcountries(linewidth=0.2)
plt.savefig('/var/www/map.png')
Hope you can help! :(
Regards
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-maps-with-matplotlib-basemap-very-slow-tp44755.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Christian A. <ia...@gm...> - 2015年01月24日 16:28:21
Hi,
Have you considered reading from a suitably low-resolution shapefile
instead? I suppose overlays or colors change per generation but not
the geographical area.
Cheers,
Christian
On Sat, Jan 24, 2015 at 4:11 PM, Sappy85 <rob...@gm...> wrote:
> I would like to draw very, very simple maps of only europe in matplotlib /
> basemap, which takes very much time (around 10 seconds!). This is just
> unreal!? Setting of resolution is only "l" (low).
> I need to plot hundreds of those maps every few hours. This would be
> impossible!!? :(
>
> Here is the very simple code:
>
> import matplotlib
> matplotlib.use('Agg')
> import matplotlib.pyplot as plt
> from mpl_toolkits.basemap import Basemap
>
> m = Basemap(projection='stere',lon_0=5,lat_0=90.0,rsphere=6371200.,\
>
> llcrnrlon=-25.0,urcrnrlon=72.0,llcrnrlat=26.0,urcrnrlat=65.0,resolution='l')
>
> m.drawcoastlines(linewidth=0.2)
> m.drawcountries(linewidth=0.2)
> plt.savefig('/var/www/map.png')
>
>
> Hope you can help! :(
>
> Regards
>
>
>
>
>
> --
> View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-maps-with-matplotlib-basemap-very-slow-tp44755.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> http://p.sf.net/sfu/gigenet
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Sappy85 <rob...@gm...> - 2015年01月24日 18:01:40
Hi, yes that helps a lot, reading in the boundaries from a shapefile.
But does anybody know, how avoid the "double inner borders"? Coastlines seem
to have a thinner border. Borders between two countries be drawn twice.
<http://matplotlib.1069221.n5.nabble.com/file/n44757/map.png> 
Regards
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-maps-with-matplotlib-basemap-very-slow-tp44755p44757.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Benjamin R. <ben...@ou...> - 2015年01月24日 19:37:04
10 seconds? That doesn't seem right. Are you running the process as an
apache user or something without a home directory? I suspect that the font
cache is not being created, and so it is having to build the font listing
every time it starts up.
Ben Root
On Jan 24, 2015 1:02 PM, "Sappy85" <rob...@gm...> wrote:
> Hi, yes that helps a lot, reading in the boundaries from a shapefile.
>
> But does anybody know, how avoid the "double inner borders"? Coastlines
> seem
> to have a thinner border. Borders between two countries be drawn twice.
>
> <http://matplotlib.1069221.n5.nabble.com/file/n44757/map.png>
>
> Regards
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Plotting-maps-with-matplotlib-basemap-very-slow-tp44755p44757.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> http://p.sf.net/sfu/gigenet
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Sappy85 <rob...@gm...> - 2015年01月24日 20:05:53
Hi Ben, 
i run the process as user "root" on a virtual linux server. Is this a
problem?
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-maps-with-matplotlib-basemap-very-slow-tp44755p44759.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2015年01月24日 21:53:28
On 2015年01月24日 6:11 AM, Sappy85 wrote:
> I would like to draw very, very simple maps of only europe in matplotlib /
> basemap, which takes very much time (around 10 seconds!). This is just
> unreal!? Setting of resolution is only "l" (low).
> I need to plot hundreds of those maps every few hours. This would be
> impossible!!? :(
>
> Here is the very simple code:
>
> import matplotlib
> matplotlib.use('Agg')
> import matplotlib.pyplot as plt
> from mpl_toolkits.basemap import Basemap
>
> m = Basemap(projection='stere',lon_0=5,lat_0=90.0,rsphere=6371200.,\
>
> llcrnrlon=-25.0,urcrnrlon=72.0,llcrnrlat=26.0,urcrnrlat=65.0,resolution='l')
>
You can save a lot of time by pickling the Basemap instance at this 
point, saving it to a cache. Then the next time, just pickle.load it 
from the cache.
Eric
> m.drawcoastlines(linewidth=0.2)
> m.drawcountries(linewidth=0.2)
> plt.savefig('/var/www/map.png')
>
>
> Hope you can help! :(
>
> Regards
>
>
>
>
>
> --
> View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-maps-with-matplotlib-basemap-very-slow-tp44755.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> http://p.sf.net/sfu/gigenet
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Sappy85 <rob...@gm...> - 2015年01月24日 23:58:55
Hi,
creating a pickle of the Basmap instance was the correct way. Now it works
great! Thank's all for that quick and helpful support!
Solution as follows:
m = Basemap (...)
pickle.dump(m,open('map.pickle','wb'),-1) # pickle it
for ... : # loop to generate x plots
 pickle.load(open('map.pickle','rb')) # load here the above pickle 
 # do some other stuff
Regards
Sappy85
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-maps-with-matplotlib-basemap-very-slow-tp44755p44761.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
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 によって変換されたページ (->オリジナル) /