plot Africa only

Is it possible to tell matplotlib to only plot the African continent?
http://tommycarstensen.com/python2_matplotlib_basemap_merc_bluemarble_hresolution.jpg

I can do this in gnuplot, but I can't figure out how to do it with
matplotlib/basemap.

Thanks,
Tommy

Does anyone know, whether a continent can be left out when plotting
with matplotlib basemap? For example I wish to hide Europe (and
Madagascar) on this plot:
http://www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg

···

On Sat, Oct 18, 2014 at 7:57 AM, Tommy Carstensen <tommy.carstensen@...287...> wrote:

Is it possible to tell matplotlib to only plot the African continent?
http://tommycarstensen.com/python2_matplotlib_basemap_merc_bluemarble_hresolution.jpg

I can do this in gnuplot, but I can't figure out how to do it with
matplotlib/basemap.

Thanks,
Tommy

Hi Tommy, there is not easy way to do it with matplolib+basemap. Also, you
will find it extra hard because the image you are plotting (blue
marble) is raster that is cut in lon, lat bounding box. Therefore, unless
you create a mask around what to plot and what not to plot, it will show
everything that is inside that box.

One alternative is cartopy. With cartopy you have easy access to Natural
Earth features. That way you can find the proper feature, that represents
just the African continent, and plot it:

http://scitools.org.uk/cartopy/docs/latest/examples/hurricane_katrina.html

https://ocefpaf.github.io/python4oceanographers/blog/2013/09/30/natural_earth/

Good luck!

-Filipe

···

On Fri, Oct 24, 2014 at 7:21 AM, Tommy Carstensen < tommy.carstensen@...287...> wrote:

Does anyone know, whether a continent can be left out when plotting
with matplotlib basemap? For example I wish to hide Europe (and
Madagascar) on this plot:

http://www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg

Felipe, thanks for the links! I do realize it would be impossible to
leave out non-African mainland when using bluemarble(). I could color
Europe, Madagascar, Middle East white on a map with filled continents,
but I would have to be accurate at the Israel/Egypt, Djibouti/Yemen
and Spain/Morocco borders. Not the solution I was looking to
implement. Using Cartopy and a shapefile of Africa seems to be a very
good solution. I'll look into this. Thanks!

···

On Fri, Oct 24, 2014 at 12:25 PM, Filipe Pires Alvarenga Fernandes <ocefpaf@...287...> wrote:

Hi Tommy, there is not easy way to do it with matplolib+basemap. Also, you
will find it extra hard because the image you are plotting (blue marble) is
raster that is cut in lon, lat bounding box. Therefore, unless you create a
mask around what to plot and what not to plot, it will show everything that
is inside that box.

One alternative is cartopy. With cartopy you have easy access to Natural
Earth features. That way you can find the proper feature, that represents
just the African continent, and plot it:

http://scitools.org.uk/cartopy/docs/latest/examples/hurricane_katrina.html

Cartopy and the Natural Earth Dataset

Good luck!

-Filipe

On Fri, Oct 24, 2014 at 7:21 AM, Tommy Carstensen > <tommy.carstensen@...287...> wrote:

Does anyone know, whether a continent can be left out when plotting
with matplotlib basemap? For example I wish to hide Europe (and
Madagascar) on this plot:

http://www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg

------------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options