|
From: Benjamin R. <ben...@ou...> - 2014-12-10 17:58:28
|
I am getting something, but the speckled stuff is all on one side, and all monochromatic for most of the pcolormesh plot. I am using basemap 1.0.7 and a development version of matplotlib. Your code looks correct, so I don't know what is wrong. Probably worth filing a bug report: https://github.com/matplotlib/basemap/issues Ben Root On Mon, Dec 8, 2014 at 7:24 PM, Timothy W. Hilton <th...@uc...> wrote: > Hello, > > I am experiencing strange behavior using mpl_toolkits.basemap.Basemap. > My understanding is that pcolormesh is faster than pcolor, and thus > preferable. Here is a minimal example (below) where I get a different > plot from pcolormesh than from pcolor. > > On two systems (mac os x 10.9.5; Ubuntu 11.04 (GNU/Linux 2.6.32.28 > x86_64); basemap 1.0.7 on the mac and 1.0.8 on the Ubuntu machine; both > using matplotlib 1.4.2) I get the expected grid of random colors from > pcolor, but a monochrome plot from pcolormesh. > > Is this expected? Are there circumstances in which I should be using > pcolor instead of pcolormesh? Is this a bug in matplotlib or in > basemap? > > Many thanks! > > Tim > > -- > > Timothy W. Hilton > Assistant Project Scientist > School of Engineering > University of California, Merced > th...@uc... > > #================================================== > # minimal example > > import matplotlib.pyplot as plt > from mpl_toolkits.basemap import Basemap > import numpy as np > > def setup_map(ax): > > m = Basemap(width=8.0e6, > height=6.5e6, > projection='aeqd', > lat_0=54, > lon_0=-105, > resolution='l', > area_thresh=1000, > rsphere=6371007.181000, > fix_aspect=True, > ax=ax) > m.drawcoastlines() > m.drawcountries() > m.drawstates() > return(m) > > # create pseudo-data with longitudes and latitudes > lon, lat = np.meshgrid(np.arange(-180, 180), > np.arange(90, -90, -1)) > data = np.random.rand(*lon.shape) * 100 > > # two-panel figure > fig, ax = plt.subplots(nrows=1, ncols=2) > > # plot pseoddata in left panel using pcolormesh > m0 = setup_map(ax[0]) > cm = m0.pcolormesh(lon, lat, data, latlon=True, > vmin=0.0, vmax=100.0, cmap=plt.cm.get_cmap("Blues")) > plt.colorbar(cm, ax=ax[0]) > ax[0].set_title('pcolormesh') > > # plot pseoddata in left panel using pcolor > m1 = setup_map(ax[1]) > cm = m1.pcolor(lon, lat, data, latlon=True, > vmin=0.0, vmax=100.0, cmap=plt.cm.get_cmap("Blues")) > plt.colorbar(cm, ax=ax[1]) > ax[1].set_title('pcolor') > > plt.show() > > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > > http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |