python,runtime-error,matplotlib-basemap

For whatever reason, Basemap.quiver doesn't like taking Pandas DataFrame columns after upgrading. I changed: gMap.quiver(AllPoints['lon'],AllPoints['lat']....) to: gMap.quiver(AllPoints['lon'].values,AllPoints['lat'].values....) and it works fine now.

python,matplotlib,matplotlib-basemap

tcaswell pointed me in the exactly right direction: ax = plt.gca() def format_coord(x, y): return 'x=%.4f, y=%.4f'%(m(x, y, inverse = True)) ax.format_coord = format_coord This does what I wanted....

python-2.7,gis,shapefile,matplotlib-basemap

I was able to solve this by using basemap (which uses Pyshp): val = [] s = m.readshapefile('last_500','last_500') for shapedict in m.last_500_info: val.append(shapedict['fieldname']) print val ...

python,matplotlib,matplotlib-basemap

You can do this using the following: import matplotlib import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt matplotlib.use('Agg') fig = plt.figure() fig.patch.set_facecolor('blue') fig.patch.set_alpha(0.7) ax = fig.add_subplot(111) m = Basemap(projection='ortho',lat_0=0,lon_0=0,resolution='c',ax=ax) m.drawmapboundary(fill_color='black') m.drawcoastlines(linewidth=1.25, color='#006600') plt.savefig('Desktop/out.png',facecolor="red", edgecolor="blue") This creates a plot with blue...

python,matplotlib,matplotlib-basemap

m.imshow(im, extent=extent, alpha=0.6) ...

python,pandas,data-analysis,matplotlib-basemap,proj

This is resolved by changing m(cat_data.LONGITUDE, cat_data.LATITUDE) to m(cat_data.LONGITUDE.values, cat_data.LATITUDE.values), thanks to Alex Messina's finding. With a little further study of mine, pandas changed that Series data of DataFrame (derived from NDFrame) should be passed with .values to a Cython function like basemap/proj since v0.13.0 released on 31 Dec 2013...

from matplotlib.colors import from_levels_and_colors cmap, norm = from_levels_and_colors([0,1,2,3],['red','green','blue']) plt.imshow(data, cmap=cmap, norm=norm) ...

python,numpy,matplotlib-basemap

width = 200 height = 300 lllon, lllat, urlon, urlat = -144.99499512, -59.95500183, -65.03500366, 60.00500107 dlon = (urlon-lllon) / width dLat = (urlat-lllat) / height baseArray = np.fromfunction(lambda y,x: (1000.0 / (width + height)) * (y+x), (height, width), dtype = float) lons = np.arange(lllon, urlon, dlon) lats = np.arange(lllat, urlat,...

python,matplotlib,matplotlib-basemap

Those are several questions and it would be better to split them up. In the mean time, Evan Mosseri already answered the question about the markersize. An alternative would be to simply use the dot-marker, as I'll show. He also showed how to maximize the figure, I'll use an alternative...

python,matplotlib,matplotlib-basemap

If you subclass the Bloch class of QuTip, and alter the way it draws the sphere, you can draw density plots and keep all the other framework it creates. Taking the matplotlib surface_plot examples, and altering the Bloch class' plotting functions works. Putting it in your own subclass prevents you...

python,matplotlib,matplotlib-basemap,map-projections

Try cartopy and its new epsg feature: projection = ccrs.epsg(32636) fig, ax = plt.subplots(figsize=(5, 5), subplot_kw=dict(projection=projection)) ax.coastlines(resolution='10m') Here is a notebook with an example: http://nbviewer.ipython.org/gist/ocefpaf/832cf7917c21da229564...

python,data,matplotlib,matplotlib-basemap,imshow

I now understand. You are trying to combine answers you received from here-imshow and here-hexbin. Your problem boils down to the fact that you want to use your Basemap as the "canvas" on which you plot your 2D histogram. But instead of doing that, you are making a Basemap then...

python,matplotlib,figure,matplotlib-basemap

Thanks to @JoeKington here and @EdSmith at How to superimpose figures in matplotlib, i was able to understand how to achieve what i wanted: reuse basemap objects and pass them around. I made it this way: Created a base_map.py that has two functions: plot() that create a map object and...

python,numpy,matplotlib,matplotlib-basemap,basemap

In Fedora 20, /usr/lib64/python2.7/site-packages/mpl_toolkits/basemap/pyproj.py had the line: pyproj_datadir = '/usr/share/basemap' In Fedora 21 the data directory has been changed to: pyproj_datadir = os.sep.join([os.path.dirname(__file__), 'data']) In Fedora 21, pyproj.py is looking for the data in /usr/lib64/python2.7/site-packages/mpl_toolkits/basemap/data, but the rpm packages for python-basemap-data and python-basemap-data-hires are still putting the proj data in...

python,python-3.x,matplotlib,plot,matplotlib-basemap

This is probably not the best way to resolve this and if anyone has a better method please share. I've found that a very simple way to get around the polygons going over the bars and creating this offset look is to simply make the polygon collection have a high...

python,matplotlib,matplotlib-basemap,basemap

Based on coordinates and example, maybe you need to change order in map. x, y = map(long_list[:5], lat_list[:5]) Because in geography latitude is Y-coordinate and longitude is X-coordinate....

python,matplotlib,matplotlib-basemap,basemap

I think you're forgetting the simplest line, however you haven't shown most of your code so it's hard to guess. i.e. map = Basemap(projection='cyl', lat_0 = lat_0, lon_0 = lon_0, llcrnrlon = llcrnrlon, llcrnrlat = llcrnrlat, urcrnrlat = urcrnrlat, urcrnrlon = urcrnrlon, area_thresh = 1000., resolution='l') #valid aproximate coordinates for...

python,matplotlib,matplotlib-basemap,grib,gfs

I solved it myself 2 months later: Matplotlib doesn't fill the area if your longitude range is from 0 to 359.75 because it ends there from matplotlibs point of view. I solved it by dividing up the data and then stacking it. selecteddata_all = data.select(name = "Temperature")[0] selecteddata1, lats1, lons1...

python,matplotlib,matplotlib-basemap,map-projections

From the documentation, both Hammer and Mollweide projections don't allow this as they print out entire world maps. Here's some code using Polyconic projection, but it is bounded by straight lines. The trick here is to define the corner longitude and latitudes on creation. from mpl_toolkits.basemap import Basemap import matplotlib.pyplot...

python-2.7,matplotlib,3d,matplotlib-basemap,cartopy

The basemap mpl3d is a pretty neat hack, but it hasn't been designed to function in the described way. As a result, you can't currently use the same technique for much other than simple coastlines. For example, filled continents just don't work AFAICT. That said, a similar hack is available...

python,matplotlib,shapefile,esri,matplotlib-basemap

I think this article I just found could give you some help. But I am not sure it is a full answer. http://basemaptutorial.readthedocs.org/en/latest/clip.html...

python,matplotlib,pyqt,matplotlib-basemap

As Joe Kington pointed out: plot returns a list of artists of which you want the first element: self.line = self.widget.canvas.ax.plot(self.ValueTotal,'r-')[0] So, taking the first list element, which is the actual line. A minimal example to replicate this behavior: l = plt.plot(range(3))[0] l.set_xdata(range(3, 6)) l = plt.plot(range(3)) l.set_xdata(range(3, 6)) The...