All Questions
599 questions
52
votes
7
answers
13k
views
why does my colorbar have lines in it?
Edit: Since this seems to be a popular post, here's the solution that seems to be working well for me. Thanks @gazzar and @mfra.
cbar.solids.set_rasterized(True)
cbar.solids.set_edgecolor("face")
...
50
votes
18
answers
149k
views
Python basemap module impossible to import
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/...
32
votes
5
answers
22k
views
Is it possible to control matplotlib marker orientation?
If I have a triangular marker, is it possible to control its orientation? I have a series of facets, with their corresponding vertices, and I would like to plot a basemap of them. I know it is ...
28
votes
6
answers
51k
views
Basemap with Python 3.5 Anaconda on Windows
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 ...
27
votes
2
answers
20k
views
Python Matplotlib Basemap overlay small image on map plot
I am plotting data from an aircraft on a map and I would like to insert this 75px by 29px PNG image of an airplane at the coordinates of the latest data point on the plot.
As far as I know and have ...
26
votes
2
answers
32k
views
Draw polygons more efficiently with matplotlib
I have a dateset of around 60000 shapes (with lat/lon coordinates of each corner) which I want to draw on a map using matplotlib and basemap.
This is the way I am doing it at the moment:
for ii in ...
24
votes
2
answers
50k
views
How to insert scale bar in a map in matplotlib
Any ideas on how can I insert a scale bar in a map in matplotlib that shows the length scale? something like the one I have attached.
Or maybe any ideas on measuring and showing distances ...
24
votes
3
answers
35k
views
Fill countries in python basemap
Hi I am trying to plot a map using pythons basemap with some countries filled in a certain colour.
Is there a quick and easy solution out there??
24
votes
1
answer
40k
views
How to smooth by interpolation when using pcolormesh?
I have a basemap of the world, and it's filled with data (lintrends_mean) using pcolormesh. Because the data has relatively large grid boxes, I'd like to smooth the plot. However, I can't figure out ...
21
votes
2
answers
61k
views
What names can be used in plt.cm.get_cmap?
I have this code :
plt.scatter(data_projected[:,0],data_projected[:,1],c=digits.target
,edgecolors='none',alpha=0.5,cmap=plt.cm.get_cmap('nipy_spectral',10));
My confusion comes from plt....
20
votes
7
answers
16k
views
world map without rivers with matplotlib / Basemap?
Would there be a way to plot the borders of the continents with Basemap (or without Basemap, if there is some other way), without those annoying rivers coming along? Especially that piece of Kongo ...
19
votes
3
answers
38k
views
How to use Basemap (Python) to plot US with 50 states?
I am aware that the powerful package Basemap can be utilized to plot US map with state boundaries. I have adapted this example from Basemap GitHub repository to plot 48 states colored by their ...
17
votes
1
answer
17k
views
Plot GDAL raster using matplotlib Basemap
I would like to plot a raster tiff (download-723Kb) using matplotlib Basemap. My raster's projection coordinates is in meter:
In [2]:
path = r'albers_5km.tif'
raster = gdal.Open(path, gdal....
16
votes
3
answers
84k
views
How to make grouper and axis the same length?
For my assignment I'm supposed to plot the tracks of 20 hurricanes on a map using matplotlib. However when I run my code I get the error: AssertionError:Grouper and axis must be the same length
Here'...
16
votes
3
answers
4k
views
Eliminate white edges in Matplotlib/Basemap pcolor plot
I am plotting data on a map using this code:
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from mpl_toolkits.basemap import Basemap
from ...