1,247 questions
0
votes
0
answers
83
views
pixeled map matplot to "smooth map"?
rendering a map with netcdf information i have the image below but it's pixeled, is there a form to render a "smooth map" like the second image?
#Variables netcdf file
lons = ds.variables['...
0
votes
0
answers
479
views
Python Basemap Heatmap
I am trying to copy the method that was done on this page: https://makersportal.com/blog/2018/7/20/geographic-mapping-from-a-csv-file-using-python-and-basemap under "Mapping Interesting Data"...
0
votes
1
answer
2k
views
Show only one frame at a time using matplotlib.animation.FuncAnimation
I've got some code similar to this
from matplotlib import animation
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
def animate(i):
x0,y0 = np.random.random(size=(2,))...
1
vote
2
answers
1k
views
Add world street map to basemap
I am having problems with basemap - arcgisimage function. Sample code below
...
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from PIL import Image
m = Basemap(
...
4
votes
1
answer
2k
views
How to set different markers on a Matplotlib-Basemap plot based on elements in a CSV column?
I am using matplotlib's Basemap to plot points on a world map. I am extracting the latitude and longitude values from a two columns cordb['Latitude'] and cordb['Longitude'] in a CSV file. Also, the ...
0
votes
1
answer
62
views
Cannot render North America data with Basemap [duplicate]
I want to render an entire map and parts of North America using a netcdf file from European Centre for Medium-Range Weather Forecasts but only half of the map is shown.
import netCDF4 as nc
import ...
1
vote
1
answer
207
views
How can i return interactive map?
I have this code for a map using a netcdf file of European Centre for Medium-Range Weather Forecasts.
def interactive_map():
import netCDF4 as nc
import numpy as np
import matplotlib....
0
votes
1
answer
549
views
How to plot GIS databases in Python with Basemap?
I need to plot a shapefile in Python, which is supposed to be as simple as this:
m = Basemap(...)
m.readshapefile(path/filename,'.shp',...)
However, the data I need is included in a GIS database ...
1
vote
1
answer
6k
views
ImportError: cannot import name 'dedent' from 'matplotlib.cbook' [duplicate]
Hi when trying to import basemap I get this error
ImportError: cannot import name 'dedent' from 'matplotlib.cbook'
I've tried a lot of trouble shooting and can't figure it out.
I am using windows and ...
1
vote
1
answer
322
views
Multiple color matplotlib markers
I'm trying to create a timeline of events where some of the events are effected by other events in the timeline,
I want to use solid and multiple color markers so I could know which event was effected ...
0
votes
2
answers
3k
views
How to use basemap and matplotlib to display only a detailed map of a country?
I used this code to draw 2 latitude and longitude coordinates on the world map:
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
m = Basemap(projection='robin', lon_0=0, ...
0
votes
1
answer
334
views
Using imshow with basemap: mismatch between colours and map borders
I am trying to plot some grib data using basemap
and imshow instead of contourf. When I plot it with contourf I get the proper boundaries and colours, but when I do it with imshow there is a mismatch ...
0
votes
1
answer
588
views
Python Basemap script runs with Anaconda cmd prompt but not with VS Code
I'm running an example script for python basemap. Here is the script:
import sys
print("Running on = ", sys.executable)
from mpl_toolkits.basemap import Basemap
import numpy as np
import ...
0
votes
1
answer
330
views
Data not fitted to Basemap
When I try to plot data using Basemap from a Grib file, the map is not fitted to the data being plotted. I posted the code used below and and a link to the output image below that. I think the ...
9
votes
4
answers
18k
views
Maplotlib and Basemap: cannot import name 'dedent'
I'm trying to draw a network on a basemap overlay.
I have packages:
basemap=1.3.0=py36ha7665c8_0
matplotlib=3.3.1=0
matplotlib-base=3.3.1=py36hba9282a_0
networkx=2.5=py_0
When I run only the line
...
0
votes
1
answer
2k
views
GeoTIFF raster mirrored on Python basemap
I am trying to plot a .tif raster on my map with basemap. With QGIS I see the raster layer as it is supposed to be:
QGIS image
However, when then plotting with python basemap the colours are off, and ...
1
vote
1
answer
468
views
is there a way to use matplotlib.patches.Wedge's radius in km instead of degrees?
I currently want to draw a sector-like wedge in Cartopy, so I look up the matplotlib.patches.Wedge method. It's almost the function I need, but the unit of the parameter radius it needs is in degrees, ...
5
votes
2
answers
42k
views
How to use geopandas to plot latitude and longitude on a more detailed map with by using basemaps?
I am trying to plot some latitude and longitudes on the map of delhi which I am able to do by using a shape file in python3.8 using geopandas
Here is the link for the shape file:
https://drive.google....
3
votes
0
answers
897
views
ModuleNotFoundError: No module named 'mpl_toolkits.basemap'. Installing basemap in ubuntu
I have trouble importing the basemap module of mpl_toolkits in python. I've got following error message when I try to run "from mpl_toolkits.basemap import Basemap":
Traceback (most recent ...
1
vote
1
answer
838
views
color palette in seaborn heatmap
When using LinearSegmentedColormap, Matplotlib documentation mentions regarding the argument colors that
colors: array-like of colors or array-like of (value, color). If only colors are given, they ...
1
vote
1
answer
1k
views
How to replace df.ix if .iloc and .loc don't seem to work?
I'm trying to draw a map with Basemap following this tutorial: https://ramiro.org/notebook/basemap-choropleth/
This part of the code throws an error ('DataFrame' object has no attribute 'ix'):
if iso3 ...
2
votes
1
answer
517
views
Osmnx and basemap
Is it possible to have osmnx and basemap in the same environment? I've been trying to install it but had no luck. I need to plot some coordinates with basemap that I got from osmnx and connect them ...
0
votes
1
answer
112
views
Unable to use basemap of obspy in python. Installation problem
I have a problem on using basemap in python , obspy. I am using these commands:
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
from obspy import ...
0
votes
1
answer
4k
views
How to create a scalebar using cartopy and matplotlib?
in respect to the previous examples in stackoverflow, I searched for other alternatives in order to create a scalebar.
In my research, I verified that the Basemap class from mpl_toolkits.basemap see ...
-1
votes
3
answers
791
views
netCDF4 and Basemap package on Python 3.7
I hope someone can help me with this.
I am plotting netcdf data on a map using the mpl_toolkits.basemap and netCDF4.Dataset packages.
They worked perfectly a few month ago and I successfully plotted ...
3
votes
1
answer
5k
views
interpolated map using points python
I need to obtain a colour map using interpolation of altitude records. I have a set of 34 points located along a region and in each point I have altitude record. I tried the code below, but it results ...
0
votes
0
answers
108
views
Python basemap mismatch with scatter lat/long
Hi I have a dataframe (Df) with lat/long and values
lat lon utci
0 90.0 -180.00 242.923935
1 90.0 -179.75 242.923935
2 90.0 -179.50 242.923935
3 90.0 -179.25 242.923935
4 90.0 ...
0
votes
1
answer
3k
views
No module named 'mpl_toolkits.basemap'
When I run this code:
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
map = Basemap()
plt.show()
It gives me an error:
ModuleNotFoundError: No module named 'mpl_toolkits....
0
votes
1
answer
243
views
Issue plotting selected columns of a data-frame on a map based on the values of another column using pandas
I am new to python programming.
I have a csv file with over 1000 rows. I will like to plot the columns (latitude and longitude) based on the value of the column (peak current) on a map. I usually get ...
0
votes
1
answer
368
views
How to plot coordinate using basemap and file.csv
I am in trouble with how to plot the coordinate given in a file.csv using basemap. It has error when I run with latlon=True. My code below :
import pandas as pd
import matplotlib.pyplot as plt
import ...
0
votes
2
answers
925
views
Why isn't FuncAnimation repeating when I'm put repeat = True as a parameter?
import matplotlib.image as mpimg
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.widgets import Button
from matplotlib.widgets import Slider
...
0
votes
0
answers
36
views
Is it possible to have 1 matplotlib slider control 2 different matplotlib animations?
If anyone has any experience doing this, please let me know as I would greatly appreciate it.
0
votes
0
answers
599
views
Matplotlib ModuleNotFoundError: No module named 'mpl_toolkits.basemap'
I was trying to create a plot of a map with matplotlib, and I tried to run this code:
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
map = Basemap()
plt.show()
but I get ...
0
votes
2
answers
888
views
How to plot data on a basemap using matplotlib basemap
Two sections of my code are giving me trouble, I am trying to get the basemap created in this first section here:
#Basemap
epsg = 6060; width = 2000.e3; height = 2000.e3 #epsg 3413. 6062
m=Basemap(...
1
vote
1
answer
437
views
save only an extent of the map using matplotlib python
I am using matplotlib along with the basemap with the following code
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap,cm
#Map Center
core = (151.35,-23.92)
LAT = core[1]
LON =...
0
votes
1
answer
1k
views
Is there a way to get matplotlib's Basemap using North Polar Stereographic Projection to plot a range of lat/lons that doesn't include the pole?
Currently, the plot gives me this:
Using:
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
# setup north polar stereographic basemap.
# The longitude lon_0 ...
1
vote
0
answers
326
views
Figure Size getting changed when zooming in matplotlib using "zoom to rectangle" option
I am using the following code to plot Basemap using matplotlib in python.
import os
os.environ['PROJ_LIB'] = r"C:\Users\Anaconda3\pkgs\proj4-6.0.0-ha7a8c7b_0\Library\share\proj";
from ...
0
votes
0
answers
59
views
Button Not Working in Tkinter Python Application
I am writing a python application using tkinter that plots weather data on a map. I am currently testing out my button that is supposed to plot the data on the map I created using basemap. However, ...
0
votes
0
answers
3k
views
Plotting GPS track over Open Street Map background with Python
I am trying to make one figure for each of my GPS hiking route where I plot the track on a map, very likely the one from open street map.
Extracting the data from the gpx file is not an issue and I ...
1
vote
1
answer
5k
views
Python Basemap: getting more detailed coastline drawing
Is there a way to get a more detailed coastline than the default in Basemap? For example, if I try to show the coast of Norway, the default plot is very coarse and a bit ugly (see figure). Any way to ...
0
votes
1
answer
97
views
I tried to plot the horizontal histogram but I could not manage the ticks. How can I solve it?
How can I manage the tick for this horizontal histogram?
My code:
d1=pd.read_csv('Gold1.Dat')
d1.dropna(subset=['WF (mV)'],how='any', inplace=True)
binwidth=5
m_n=np.floor(min(d1['WF (mV)'])/binwidth)...
1
vote
0
answers
105
views
Multiple plot single colorbar in python matplotlib basemap system crash problem
Why I am getting a runtime error while running this code?? I wanted to show two SST data in a single plot using for loop. while I am running the code it shows your system has crashed. I am sharing the ...
0
votes
1
answer
347
views
Filling shapefile polygons partially in basemap
I would like to fill a polygon using basemap/shapefile data, but only a certain %. For example, in the example below, we fill based on the values, but let's say I wanted to fill a % of the polygon ...
0
votes
1
answer
333
views
Installing geopandas uninstalls basemap & vice-versa
I need a Python environment with both basemap and geopandas, but installing one removes the other. Is there anyway to have both, or is there a reasonable way to switch between interpreters in the same ...
0
votes
1
answer
2k
views
Is there a way to plot seaborn KDE on a geographical map
I am trying to show the density of geographical points using Basemap and seaborn :
f, ax = plt.subplots(1, figsize=(9, 9))
# plot coastlines with basemap
m = Basemap(projection='cyl', resolution='c',
...
2
votes
1
answer
687
views
Data points falling outside the meshgrid being interpolated over, while the meshgrid certainly covers those points
I am trying to interpolate sparse data over a meshgrid, but am observing some rather odd behavior. The white dots are precisely where I have values, and I am relying on the linear interpolation ...
0
votes
1
answer
462
views
How can I pull the data out of a pickled GeoAxesSubplot for re-plotting in a new figure?
I would like to "download" (save in a pickle file) a basemap loaded in cartopy, so that I can re-plot on one of two axes in a matplotlib figure using a different script than the one I used to download ...
1
vote
0
answers
200
views
imshow basemap doesn't fit in to a map
I am very new on python. I need to plot the CO2 map over European domain using netcdf files from daily global cams dataset.
1-I can plot global domain correctly without any interpolations. However, ...
1
vote
0
answers
428
views
Python/pcolormesh:TypeError: Dimensions of C (24, 4) are incompatible with X (24) and/or Y (24)
I'am getting this error(TypeError: Dimensions of C (24, 4) are incompatible with X (24) and/or Y (24); see help(pcolor)),at the line for pcolormesh, any idea how to handle this.
Script:
import numpy ...
6
votes
2
answers
83k
views
Python,IndexError: arrays used as indices must be of integer (or boolean) type [duplicate]
Iam getting an IndexError: arrays used as indices must be of integer (or boolean) type at the line for pcolormesh, any idea how to handle this.
script:
import numpy as np
import matplotlib.pyplot ...