1,247 questions
0
votes
1
answer
71
views
Basemap plots in Matplotlib have cutoff map boundary lines
When trying to create a grid of maps in matplotlib using the Basemap toolkit, I noticed that the line that bounds the map projection is cut off on all four sides.
Look at the following minimal example ...
0
votes
0
answers
33
views
How to plot streamlines from west to east with netcdf data in python
I wanted to plot streamlines with NOAA composite (2.5*2.5 lon/lat) from 30 west to 10 east ( I definitely want the map to be from west to east(. I tried to draw it with basemap (The codes are attached)...
1
vote
1
answer
125
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
58
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
151
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, ...
1
vote
1
answer
256
views
Python netcdf EOF analysis
I am performing a EOF analysis for JJAS NDVI.
from netCDF4 import Dataset
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import xarray as xr
import matplotlib as mpl
import ...
1
vote
1
answer
86
views
Python NetCDF Prime Meridian Line blank [duplicate]
I am trying to draw climatology map of GPCC precipitation.
But I found out there is a blank (data cut) in Prime Meridian Line.
How can I fix the problem? I can use CDO, NCO, Python.
I also share the ...
0
votes
0
answers
40
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
255
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
1
answer
151
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 ...
1
vote
1
answer
52
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
560
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
721
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
100
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 ...
2
votes
1
answer
200
views
Python xarray, numpy, matplotlib netcdf masking ocean?
I am trying to draw linear regression map of NDVI.
But using countour map, it filled the ocean too.
I would like to remove the ocean without values.
using Nan or maskoceans
but maskoceans is not ...
0
votes
1
answer
47
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
2k
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
752
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
63
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
2
answers
81
views
Is there a way to move the map that the whole great circle route would be shown? (basemap)
I tried to make a program for my paperwork that will live show the range between two cities and i wanted and i got a problem that i cant handle.
Actual map looks like this:
Code:
from mpl_toolkits....
1
vote
0
answers
63
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 ...
1
vote
0
answers
30
views
Function "addcyclic": IndexError
I am using "addcyclic" function and encounter the Index Error. Error details are:
IndexError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_11852/1134487354.py in
6 m....
0
votes
1
answer
117
views
Creating Animated SST Plot with Python
I would like to create a plot that showcases sea-surface temperature changing over the years, very similar to the SST maps that NOAA creates. The image I've inserted is essentially what the plot ...
0
votes
1
answer
43
views
Having a problem running python script from import error of modules that i have installed on my computer
i have ran pip install tabulate (other Modules too) however when running script it says i am missing such modules
import error of the various modules
as you can see it says that I have an issue even ...
0
votes
0
answers
143
views
Interpolating temperature data on geographical map using python, not giving good results on the edges
I am trying to plot some correlation data about temperature on a stereographic map of the north pole. the data is from different stations in this region.
I am using:
from scipy.interpolate : griddata ...
0
votes
0
answers
112
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
...
2
votes
1
answer
783
views
Plotting .netCDF data correctly, impossible in Python (Basemap, Cartopy)
I have been using .netCDF files (satellite data) for a few weeks now, and in general, I never had issues plotting them. I've been experimenting with sea ice concentration data but I can't get them ...
0
votes
0
answers
177
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
360
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
3k
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
1
answer
175
views
Overlaying contour plot on basemap
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,...
1
vote
0
answers
370
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
142
views
Python Basemap pcolormesh valueError
I want to use Python basemap and map an aggregated value of income in various cities. I have created a dictionary of cities and their respective income. When plotting the code, I am getting an error ...
0
votes
1
answer
139
views
MPL Basemap Projections not showing output properly
So I have this old code from my teacher that plots a Mollweide Projection using Basemap
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from itertools ...
1
vote
0
answers
34
views
Can't remove package sucessfully with "conda remove"
I installed with a downloaded ".tar.bz2" file, but it couldn't work. So I used conda install basemap trying to cover the wrong one, this sentence carried out successfully, but the version of ...
0
votes
1
answer
216
views
Geopandas to Basemap to see if on land or not
I've got a geopanda where I want to check if the points are on land or not. I tried using Globe land mask, but the resolution was quite poor as a lot of the points.
As I understand it I need to ...
1
vote
0
answers
122
views
Python basemap - struggling with putting a basemap on top of a satellite image
I have a satellite image taken from NWC-SAF of a certain region of the world, and 2 ndarrays that holds data about the latitudes and longitudes values of each pixel.
I try to use this information and ...
0
votes
1
answer
564
views
Plot milepost along coastline in python
I want to plot mileposts on a map every 100 miles along the coastline. An example is shown in the figure below:
It is easy to plot the coastlines using Cartopy, but how to determine the locations of ...
1
vote
1
answer
4k
views
Fix ValueError at matplotlib.pyplot.set_cmap() with custom LinearSegmentedColormap
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 ...
0
votes
1
answer
347
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(...
1
vote
0
answers
134
views
Why is my Networkx graph not plotting edges with Basemap?
I am trying to plot my Network Graph, produced with NetworkX over a Basemap - following the logic of this example. My netowkr will plot separately but when I run the code below I am just given the ...
0
votes
1
answer
414
views
Fill oceans in high resolution to hide low resolution contours in basemap
When plotting low-resolution contours over a high-resolution coastline I get the following result
I would like to fill the area outside of the coastlines (caused by the low resolution of the ...
0
votes
0
answers
486
views
Convert local coordinates to pixel values in python
I have a dataset that contains local coordinates of tracking cars, and I have an image related to my dataset, I would like to plot my track on the image, but the coordinate systems are not matched. I ...
0
votes
1
answer
65
views
Is there any code for showing a different modes(charging,parking,driving) of a vehicle on map?
I have a location data set for a vehicle including LONGITUDE,LATITUDE and MODE (charging,driving and parking) as follows:
longitude
latitude
mode
x
y
charging
x
y1
charging
x1
y3
parking
x2
y2
driving
...
0
votes
1
answer
72
views
convert a list to real number for scatter plot
I have two lists of latitude and longitude which latitude (xx) is like:
print(xx)
[['46.0'], ['-69.7'], ['-50.7'], ['-22.3'], ['-36.7'], ['65.1'], ['-26.3'], ['-47.5'], ['19.4'], ['-82.3'], ['50.8'], ...
1
vote
1
answer
1k
views
Is it possible to plot networkx graph over openstreet style map image?
I am trying to plot a network graph of car journeys over a streetmap style map.
I have two dataframes; zones and journeys, which I have used to create a network using Networkx
locations = pd.DataFrame(...
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
2
answers
403
views
Basemap: Get all data points on colorbar which each point refelecting the ploted color
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 ...
0
votes
0
answers
2k
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',
...
-1
votes
1
answer
509
views
pip install geos or basemap - fail to install
Can anyone help please, I'm trying to install geos and basemap in jupyter notebooks but getting the same error for both.
Selections of output posted below.
× Running setup.py install for lxml did ...