matplotlib-basemap

Overlaying contour plot on basemap

Overlaying contour plot on basemap Question: Please can anyone look at this code it is not giving a desired result. # use the Miller projection m = Basemap( projection=’mill’, resolution=’i’, lon_0=0., lat_0=0.) # draw coastline, map-boundary m.drawcoastlines(linewidth=0.5) m.drawmapboundary( fill_color=’white’ ) # draw grid m.drawparallels( np.arange(-90.,90.,30.), labels=[1,0,0,0] ) m.drawmeridians( np.arange(-180.,180.,60.), labels=[0,0,0,1] ) # Creating 2-D grid …

Total answers: 1

Fix ValueError at matplotlib.pyplot.set_cmap() with custom LinearSegmentedColormap

Fix ValueError at matplotlib.pyplot.set_cmap() with custom LinearSegmentedColormap Question: I’m looking for a way to use custom color map with matplotlib.pyplot. I wrote this code: import numpy as np from matplotlib.colors import LinearSegmentedColormap import matplotlib as mpl import matplotlib.pyplot as plt %matplotlib inline # color_map = mpl.cm.get_cmap(‘Spectral’) # get builtin colormap color_map = LinearSegmentedColormap.from_list(‘custom’, [(0, ‘#ff0000’), …

Total answers: 1

How to show correlation between the age and results at the graphic?

How to plot correlation between two columns Question: The task is the following: Is there a correlation between the age of an athlete and his result at the Olympics in the entire dataset? Each athlete has a name, age, medal (gold, silver, bronze or NA). In my opinion, it is necessary to count the number …

Total answers: 1

Basemap: Get all data points on colorbar which each point refelecting the ploted color

Basemap: Get all data points on colorbar which each point refelecting the ploted color Question: I have a dataset, containing different types of trees in numerical i.e Types = 4,8,9,10,13,15,19,33 I am plotting these types on a scatter plot, each type being represented by a different color. I can’t figure out a way for the …

Total answers: 1

subplots onto a basemap

subplots onto a basemap Question: I have a map of the UK and 121 locations, each with 3 values. I would like to plot a little bar graph of the three values at each of the 121 locations. Currently, the values are plotted as the markersize attribute, which looks like this: Trypophobic_Plot made with the …

Total answers: 1

Plotting a masked Antarctica with a shapefile or geopandas

Plotting a masked Antarctica with a shapefile or geopandas Question: I’m trying to plot data around the Antarctica while masking the continent. While I’m using basemap and it has an option to easily mask continents using map.fillcontinents(), the continent considered by basemap includes the ice shelves, which I do not want to mask. I tried …

Total answers: 2

Adding custom attributes to matplotlib Figure and Axes instances: ill-advised?

Adding custom attributes to matplotlib Figure and Axes instances: ill-advised? Question: I noticed that I can add my own attributes to matplotlib.axes.Axes() and matplotlib.figure.Figure() instances. For instance, import matplotlib as mpl fig = mpl.figure.Figure() ax = fig.add_subplot() ax.foo = ‘bar’ In practical terms, I might like to add a basemap instance to an axes object …

Total answers: 1

Python basemap module impossible to import

Python basemap module impossible to import Question: I have troubles to import the basemap module of mpl_toolkits in python. Here is what I get when I run the test.py script from the module directory: /usr/lib/python2.7/dist-packages/mpl_toolkits/basemap$ python test.py Traceback (most recent call last): File “test.py”, line 1, in <module> from mpl_toolkits.basemap import Basemap, shiftgrid ImportError: No …

Total answers: 18

Basemap with Python 3.5 Anaconda on Windows

Basemap with Python 3.5 Anaconda on Windows Question: I use Python 3.5 with latest version of Anaconda on Windows (64 bit). I wanted to install Basemap using conda install basemap. Apparently there is a conflict between Python 3 and basemap. After some googling indeed I found that basemap is not supported on Python 3 for …

Total answers: 6

matplotlib Basemap Fundamental Lune

matplotlib Basemap Fundamental Lune Question: I’m trying to recreate this projection using matplotlib Fundamental Lune Plot. The reference material associated with this specific projection is here, Carl Tape Moment Tensors The geophysics behind the plot isn’t crucial, but essentially its a projection between longitudes of -30 and 30 degrees and latitudes -90 to 90. I’ve …

Total answers: 1