All Questions
Tagged with matplotlib matplotlib-basemap
694 questions
1
vote
1
answer
25
views
Python: Plotting a Basemap in the x-y-plane of a 3d plot
I am trying to get the code contained in
https://basemaptutorial.readthedocs.io/en/latest/basemap3d.html
to work. However, I get an error already in the first snippet:
import matplotlib.pyplot as plt
...
1
vote
0
answers
29
views
Basemap nightshade() on Robinson Projection and lon_0=-180
I'm attempting to plot day/night shading on a Robinson projection centered at -180 degrees with Basemap, and as you can see, the shading doesn't look right. I'm also getting a warning about a non-...
0
votes
1
answer
55
views
How to plot streamlines with netcdf data in python using cartopy or basemap?
I wanted to plot streamlines with NOAA from composite (2.5*2.5 lon/lat).
I tried to draw it with basemap (The codes are attached) but I face to this error: 'y' must be strictly increasing.
After that, ...
0
votes
0
answers
52
views
Basemap Robinson Projection Map Border Cut Off on Left and Right Edges
I'm using Basemap to plot a global contour on a Robinson map projection, and I've noticed an aesthetic issue that has been bothering me. In every example I've come across using the Basemap Robinson ...
0
votes
0
answers
34
views
contourf, hatching not working on the last plot in a panel plot
Hatching don't work on the last plot in a panel plot.
The first and second plots are ploted fine, but the last plot doesn't work.
The "DJF_sig" variable is fine, I have attached a previously ...
4
votes
1
answer
189
views
How to overlap a geopandas dataframe with basemap?
I have a shapefile that I read as a geopandas dataframe
import geopandas as gpd
gdf = gpd.read_file('myfile.shp')
gdf.plot()
where gdf.crs
<Projected CRS: ESRI:54009>
Name: World_Mollweide
Axis ...
0
votes
0
answers
28
views
Custom multi-coloured markers in python [duplicate]
I need to plot a geographical distribution of five different instruments. Some locations can have only 1 instrument whereas other locations can have a combination of more than 1 instrument.
I want to ...
0
votes
1
answer
116
views
Plotting a grid in km with a center point in latitude and longitude onto a map
I want to plot a square grid of size 2km by 2km with the point (latitude, longitude) in degrees:
co_ord = (47.9187393, 106.9175013)
located at the center of the square grid.
I have tried:
import ...
0
votes
1
answer
40
views
Basemap with joint histograms plot
Here is the code returning the figure below:
import seaborn as sns
plt.figure(figsize=(8, 8))
gs = plt.GridSpec(3, 3)
ax_main = plt.subplot(gs[1:3, :2])
ax_lon = plt.subplot(gs[0, :2])
ax_lat = plt....
0
votes
1
answer
439
views
How to use matplotlib.pyplot.contourf to plot a density array
I have an xarray Dataset called dens that I would like to plot.
This is the Dataset:
<xarray.Dataset>
Dimensions: (time: 641, lat: 30, lon: 30)
Coordinates:
* time (time) datetime64[ns] ...
0
votes
1
answer
356
views
property of 'QuadContourSet' object has no setter error after update matplotlib in python
I wrote and ran a cod to plot a netcdf file. after upgrade pip and Libraries used , I got an error:property of 'QuadContourSet' object has no setter.
I would be grateful if someone could help me to ...
0
votes
0
answers
83
views
How to visualise overlay of quiver plot over video frames?
I have the following code segment where frames from a video are read sequentially. Next, the frames are cropped and intensity wise clipped from upper and lower side. The following segments demonstrate ...
0
votes
1
answer
36
views
Color Track depending on intersecting Geography/Country
In the below Cartopy snippet, I would like to color the track (based on csv coordinate data) in yellow if it intersects any of the EU member states. I have automated the coloring of the states using ...
0
votes
1
answer
1k
views
Add U.S. State Borders to plot
Can someone tell me how to modify the script below to add U.S. state borders using Geopandas? I have tried but can't seem to get it to work. Also, if there is a particular state border shapefile that ...
-1
votes
1
answer
558
views
Error command 'msbuild' failed: None when Install BaseMap for Windows 10 64 bit
im so newbie in matplotlib, and i want to install basemap in my windows 64 bit laptop.
i use python 3.11.5 and i have just successfully:
install pyproj-3.3.1-cp311-cp311-win_amd64.whl
osgeo4w
in ...
0
votes
1
answer
54
views
Why does the title show above the colorbar but below the map?
Please see the codes below:
plt.figure(figsize=(10,5))
m = Basemap(projection='cyl', resolution='c', llcrnrlat=0, urcrnrlat=90, llcrnrlon=0, urcrnrlon=360)
x, y = m(lon, lat)
scatter = m.scatter(x, y, ...
0
votes
0
answers
43
views
How to adjust colorbar height in Gridspec subplots
How can I produce 1x15 subplots where the first and second columns are filled contour and the third column will have two stacked horizontal line plots in each of the rows?
The code below is an example ...
0
votes
0
answers
97
views
Python: Adding a zoom variable for matplotlib map
I'm trying to add a zoom variable to the following code to increase / decrease the zoom (scale) of the map this code produces:
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
...
0
votes
0
answers
128
views
I am attempting to create an interactive map in tkinter using mpl_toolkits Basemap
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import tkinter as tk
from matplotlib.backends.backend_tkagg import FigureCanvasTk, NavigationToolbar2Tk
from matplotlib.figure ...
-1
votes
1
answer
316
views
Cartopy issue in polar stereographic projection
The issue only happens with contourf, not with pcolormesh.
How can I fix the discontinuity at longitude=0 (white stripe in the plot)?
0
votes
1
answer
2k
views
Plot data at coordinates lat, lon using matplotlib and basemap
I collect data about things like water temperature, air temperature, humidity etc. in a csv-file, and I want to plot that data on a map. However, I run into issues when trying to plot it, since ...
1
vote
0
answers
280
views
How to use a log scale on a pcolor plot using Basemap in Python?
I am trying to plot a pcolor plot on a map using Basemap. This is my current code:
# Plot Data
cs = m.pcolor(xi,yi,np.squeeze(elev),norm=colors.LogNorm(vmin=elev.min(),vmax=elev.max()),cmap=cmocean.cm....
0
votes
1
answer
297
views
Overlapping Text in Animation in Python
I'm making Terror Attacks analysis using Python. And I wanted make an animation. I made it but I have a problem the text above the animation overlaps in every frame. How can I fix it?
fig = plt.figure(...
0
votes
1
answer
2k
views
NotImplementedError: Axes3D currently only supports the aspect argument 'auto'. You passed in 'equal'
I was following this tutorial
I tried to run these codes:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.basemap import Basemap
map = Basemap()
fig = plt....
0
votes
0
answers
1k
views
Getting an error on pcolormesh (matplotlib) for masked array but my arrays aren't masked?
I'm trying to use matplotlib and basemap to plot temperature data from a netcdf file. My plotting code is:
fig = plt.figure(figsize=(10, 8))
m = Basemap(projection='lcc', resolution='c',
...
0
votes
0
answers
73
views
Plot a line graph on python basemap
Unable to plot a normal graph on python base map. The code I used to plot base map and line graph is as follows:
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(figsize=(12,9))
m ...
0
votes
1
answer
211
views
Basemap error: cannot import name 'basemap_data'
I have problems when I want to use Basemap and keep getting this error message:
ImportError: cannot import name 'basemap_data' from 'mpl_toolkits' (unknown location)
I can tell that Basemap is ...
2
votes
0
answers
179
views
Ticks not visible on matplotlib subplots
I'm trying to get ticks to show up on matplotlib subplots but nothing seems to be working.
I've tried using
ax.xaxis.set_tick_params(labelbottom = True), ax.yaxis.set_tick_params(labelleft = True, ax....
0
votes
1
answer
549
views
how to adjust space between columns in xarray faceted plot with basemap?
I want to make a faceted plot using xarray. The problem occurs when I try to add a bassemap to each subplot using basemap. Too much space is put between columns. I have already tried plt....
1
vote
0
answers
211
views
matplotlib basemap colorbar exception : Given element not contained in the stack
I am new to matplotlib, I got exception
Traceback (most recent call last):
File "C:\Users\Oscar\Documents\ConsumerSoftwareProject\Plot\pyqt��������.py", line 44, in handle_clicked_1
...
0
votes
0
answers
757
views
Want to plot NetCDF data over Shapfile region only?
I have a shapefile of the State of India called Rajasthan and I want to plot precipitation data over it only. I am unable to find a solution anywhere. I am providing the code as well as the plot down ...
1
vote
1
answer
497
views
Unable to use `Basemap` and `bluemarble`
The problem is exactly the same as the one reported here and using the same code:
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
plt.figure(figsize=(8, 8))
m = Basemap(...
0
votes
1
answer
70
views
Why does Marker does not accept zipped objects in Matplotlib and how to correct it?
I'm trying to run the code shown below (which I obtained from this source) to introduce pie charts in a Baseman object.
import math
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits....
1
vote
2
answers
1k
views
Cartopy: coastlines not lining up with imshow projection
I'm trying to produce a figure in Python that will line up the map coastlines from Cartopy with a RGB projection using satellite data (POLDER) that is fixed to Sinusoidal grid.
I have tried both ...
0
votes
2
answers
848
views
Basemap and zoom boundaries
After clicking on the ’Search‘ button and zooming in on a region of the map, how do you get the geographic coordinates in longitude and latitude of the borders of this displayed region?
from ...
1
vote
1
answer
2k
views
how do i increase the resolution of my gif file?
As I am trying to create a gif file, the file has been created successfully but it is pixelating. So if anyone can help me out with how to increase resolution.
.Here is the code:-
import PIL
from PIL ...
1
vote
1
answer
335
views
changing colorbar sensitivity
I re edited the question in order to make it more clear with what I need help. So I have the following code so far
#import the libraries
import netCDF4 as nc
from mpl_toolkits.basemap import Basemap
...
3
votes
0
answers
785
views
Rotating cartopy map by 90 degrees
I'm trying to create a map using cartopy, but have that map be rotated 90 degrees (see image below for a rough sketch of what I'm trying to do*).
which was produced using the following code:
import ...
1
vote
1
answer
681
views
How can I annotate text in Basemap using the exact coordinates of the location in Python?
I have created a Basemap of Asia using following lines of code. The projection used is "marcator". The region I want to show in this basemap is Chitwan, Nepal. The coordinates is also ...
2
votes
2
answers
3k
views
Cannot install matplotlib basemap
I tried to install basemap on google colab and run these commands:
!apt-get install libgeos-3.5.0
!apt-get install libgeos-dev
!pip install https://github.com/matplotlib/basemap/archive/master.zip
...
0
votes
1
answer
636
views
How to force geopandas to plot a map with "missing values" (legend) in a columns without "missing values"?
I want to make some maps (each column is a date), and for some columns (aka dates) there are some missing values, and for others are not. When I used the function within geopandas "missing_kwds&...
1
vote
1
answer
2k
views
How do you display the scale in meters, the north arrow and the axes in latitude and longitude on a map with Geopandas?
With reference to this issue, is it possible to have the scale bar (projected in meters, so 3857 for example) with the x,y axes in latitude, longitude projection (4326) and the north arrow?
I don't ...
0
votes
0
answers
134
views
plotting coordinates on the global map
i want to plot the three coordinates point on the global map along with the axis values.
The coordinates and the cities name are as follows:
lat lon name
17.38 74.48 STA
-25.02 ...
0
votes
1
answer
918
views
plotting stations on map
i have three stations named as A, B, C. I want to plot them on a map using matplotlib basemap.
station A: latitude=17.8 longitude=74.48
station B: latitude=-25.02 longitude=25.60
station C: latitude=...
1
vote
1
answer
368
views
Matplotlib Annotations disappear during animation when updating xlim
I am having an issue with FuncAnimation where my annotations are removed after updating xlim. Here is the code with a preview underneath
You can try the code in a google colab here https://colab....
1
vote
1
answer
339
views
How can I change the python matplotlib.pyplot legend marker into a serial number like 1,2,3 instead of shape or character?
import matplotlib.pyplot
plt.figure()
plt.plot(x, 'r+', label='one')
plt.plot(x1, 'go--', label ='two')
plt.plot(y, 'ro', label='Three')
plt.legend()
In the above code legend marker is 'r+' , 'go--'...
0
votes
0
answers
542
views
Extended colorbar with defined colors for contourf
I am plotting using contourf in which color schemes are user-defined and colorbar is extended at both ends. But same color is appearing for the last two-interval at both ends (as in the figure). I am ...
-1
votes
1
answer
592
views
Creating numpy array where values are within the range of two other arranges of the same size
I have created a map of a particular climate variable, which has been produced by extracting data from netCDF4 files and converting them into mask arrays. The data is the ensemble mean of 9 CMIP6 ...
2
votes
0
answers
845
views
how to change specific value's color in pcolormesh, such as -1,-2,-3, not NaN
I know there is a func cmap.set_bad to change NaN's color but I want to change color of more values such as -1,-2,-3, how to do it?
this plot is base on basemap
and I want to hold the color of the ...
1
vote
0
answers
419
views
hvplot heatmap with cartopy? A heatmap with more geo details?
Above are two visualizations of some temperature data in the Gulf of Mexico (land and deep ocean masked out). The same data are plotted here, in the top most picture using contouring with Matplotlib ...