Questions tagged [matplotlib]

If you are thinking about using this tag then perhaps reconsider whether your question would be better posted to Stack Overflow because "matplotlib is a python 2D plotting library" rather than GIS software.

Filter by
Sorted by
Tagged with
1 vote
1 answer
25 views

How do I insert labels or annotate the points in a plot with multiple things?

I'm trying to make a simple study area map which consists of basin boundary shapefile, sampling points and river shapefile. Here's the dataframe of the sampling points: And here's the code to plot ...
mfirdaus_96's user avatar
4 votes
1 answer
187 views

Labelling a Map

I have a map I have made using python, matplotlib, cartopy and shapely. It has a coast, county borders, lakes and rivers. I also shade in districts, in the form of polygons, on the map in order to ...
Baz's user avatar
  • 77
1 vote
1 answer
310 views

Setting the background color when plotting in GeoPandas

I am wondering if there is an easy way in GeoPandas to change the background color of a plotted map. Here is my code; I can't figure out how to change the white background color to any other color. ...
sMartines's user avatar
  • 121
0 votes
0 answers
35 views

Visualization Issue when Overlapping Change Detection Map and Shapefile in Python using Rasterio and Matplotlib

I'm encountering a visualization problem while attempting to overlap a change detection map with a shapefile using Python, Rasterio, and Matplotlib. The change detection map is generated from a matrix ...
JCV's user avatar
  • 139
0 votes
0 answers
95 views

Using the Arctic SDI WMTS with cartopy and matplotlib

I am trying to use the Arctic SDI topographic basemap (https://arctic-sdi.org/services/topografic-basemap/) with cartopy + matplotlib in python, but seemingly without success. It seems that for some ...
dfghhjj's user avatar
0 votes
0 answers
19 views

QNeat3 Polygons do not finish calculating interpolation

I have been using QGIS for a couple of years and used QNEAT3 for the first time around one year ago. I never had any problem with it but, after some months not using it, I tried to use it again to ...
Jose Cáceres's user avatar
1 vote
1 answer
76 views

Barplot with a basemap as a background

I have some data as a pandas DataFrame with values associated with longitude. I have plotted it as stacked bars like this: A subset of the data as an example via df.to_dict(): {'Commodity driven ...
Jan Pisl's user avatar
  • 726
1 vote
0 answers
84 views

Plot raster in synusoidal projection in python

I want to plot data in a matrix, with two other matrices with coordinates, with a sinusoidal projection, in Python. I read data and coordinates from HDF5 or NetCDF files in the form of numpy arrays. ...
Ferny's user avatar
  • 21
0 votes
0 answers
125 views

How to get bbox coordinates of text on cartopy map

I'm making a map using cartopy in python and am labeling the countries based on the centroid of the country. However, if a name extends outside of the map's crop I would like to move the label so that ...
JWB's user avatar
  • 564
0 votes
1 answer
162 views

Adding polygon geometry to numpy array to plot it with background

I'm trying to plot image I treated in dataframes. I need to add geometry to it in order to plot it with a background. I should have used GeoPandas and geodataframes in the first place. I have arrays ...
sam's user avatar
  • 33
1 vote
0 answers
84 views

Control the range with show_hist of rasterio

When I set up the "range" argument, Running this code will have an Error. Would help me with how to set up the range ? from rasterio.plot import show_hist a =src.read(1) show_hist(a, bins=...
This_is_my_first_day's user avatar
0 votes
0 answers
50 views

Semi-Automatic Classification Plugin: Matplotlib error

I recently installed QGIS 3.22 in my MacOS system. But when I installed "Semi-Automatic Classification Plugin", this error occured: Semi-Automatic Classification Plugin: Error. Check Python ...
Latika-verma's user avatar
0 votes
1 answer
91 views

Estimated Min Max values of ERA5 data

I am working with u and v component of wind on earth engine (ERA5) dataset hourly aggregates as well as directly fetching data from ERA5. 1) What I don't understand is why are u and v component values ...
pwnkit's user avatar
  • 17
0 votes
1 answer
450 views

Saving plot from .nc file without showing the plot

I am trying to save the sequence of plots of 24 hours of ERA5 data from .nc file without plotting them. I am using xarray for reading .nc data. Here is my code: import xarray as xr import matplotlib....
pwnkit's user avatar
  • 17
0 votes
0 answers
59 views

Hue and intensity visualization from two bands in python

I would like to visualize this raster image (SAR interferogram) in a way that the phase band gives the color to the pixel and the coherence gives the intensity (value). This is the image: https://...
benedetta's user avatar
  • 138
0 votes
1 answer
335 views

Plot GeoJSON on top of raster plot

I am trying to plot a GeoJSON file on top of a raster. While different questions have touched this topic, I have not found a specific one addressing the approach I need. I would prefer using imshow ...
GCGM's user avatar
  • 1,118
3 votes
1 answer
555 views

Using different projections in insets with Matplotlib/Geopandas

In Matplotlib I can create inset plots with .inset_axes(). This works very well with GeoPandas, allowing me to do e.g.: inset = ax.inset_axes([x, y, w, h]) df_main.plot(ax=ax, ...) df_subset.plot(ax=...
leo's user avatar
  • 801
1 vote
1 answer
1k views

Geopackage how to view whats in it - Python

I'm pretty new when it comes to GIS and such. I am trying to see what data is available inside a geopackage that I downloaded off Natural Earth in Python. How do I do this? #import libraries import ...
Brittany's user avatar
2 votes
0 answers
746 views

QGIS 3.18 error on install python modules for SCP

I downloaded the QGIS 3.18 version for Mac. (College assignment). I need to also download the SCP plugin, however when I do that, I get errors "when importing scipy and matplotlib" ...
Leandro Di Maria's user avatar
2 votes
1 answer
1k views

GeoPandas | Plot separate groups of many MultiPolygons

Goal: Plot 8 graphs; each with 3 legends, and 1-to-many Polygons. I have 3 lists: extracted_poly, original_poly_flip_y, wkt_poly_flip_y These represent sources of the same annotations I want to ...
StressedBoi_69420's user avatar
0 votes
0 answers
13 views

Rasterio how to find same values in excel

I have two geographical tiff files, the difference is 20 years. There are some values ​​in the pixels of these drawings. I need to find differences between the second file and the first one. I tried ...
Даут Цицкиев's user avatar
1 vote
1 answer
1k views

Python imshow will not overlay -- only display last line's map

I have the following code that when run separately, displays two maps: Map1: f = h5py.File(filename[0], 'r') group_id='Soil_Moisture_Retrieval_Data_AM' var_id = 'soil_moisture' a = f[group_id][var_id][...
hoshijun's user avatar
0 votes
1 answer
752 views

Plotting LiDAR data with matplotlib

I am trying to plot a las file with one million points in Matplotlib. When I try to plot the file it always gives me a blank result. This is the code I am using: import numpy as np import laspy from ...
Purple_Ad's user avatar
1 vote
1 answer
194 views

Iteratively plot large shapefiles using matplotlib

I am working with the National Wetlands Inventory, a set of shapefiles that describe all wetlands in the United States. There are 50 states, and each state has at least one shapefile (some have more ...
sdg's user avatar
  • 43
1 vote
0 answers
291 views

How to plot the map correctly over the SST data in cartopy?

I am trying to plot L2 Sea Surface Temperature data and I want to plot it over the globe in a geostationary projection. I tried the following code: import h5py import sys import numpy as np import ...
The Emerging Star's user avatar
1 vote
0 answers
136 views

Link image position and size to figure's dpi

Is there a method to link image position and size to figure's dpi? With the code below I'm be able to plot a chart. fig = plt.figure(figsize=(10, 10), dpi=100) plt.subplots_adjust(left=0, right=1, top=...
MaxDragonheart's user avatar
0 votes
1 answer
332 views

Plotting Raster Above a shapefile

I'm trying to plot a raster above a shapefile in python. My code is working however I can't seem to get the raster to plot above the shapefiles. It only appears when I don't show countries, rivers ...
Humzah Qazilbash's user avatar
0 votes
1 answer
7k views

plt.title not displaying

I am unable to add plt.title import numpy as np import geopandas as gpd from shapely.geometry.polygon import LinearRing import pyproj import cartopy.crs as ccrs import cartopy.feature as cfeature ...
arkriger's user avatar
  • 327
1 vote
1 answer
2k views

Increase map size with subplots and Cartopy

I try to make subplot maps with Cartopy using data from xarray tutorial and increase each map in vertical size, but failed. Also making colorbar at each specific subplots. import matplotlib.pyplot as ...
Tuyen's user avatar
  • 209
1 vote
1 answer
2k views

Converting ee.Image to numpy array in Earth Engine Python API takes too much time [closed]

I am using Earth Engine's Python API to convert ee.Image() to Python plots. I am currently using the ee.sampleRectangle() function to convert ee.Image() to a NumPy array and then using matplotlib's ...
Shidharth Routh's user avatar
1 vote
0 answers
413 views

Could not find the matplotlib module. Make sure the matplotlib is installed

When I open my QGIS this message is open : Could not find the matplotlib module. Make sure the matplotlib is installed. I am trying to install the matplotlib through OSGeo shell (windows system) but ...
user204436's user avatar
2 votes
1 answer
502 views

How to produce a Cartopy map in UTM with north-east up?

I'm currently trying to produce maps of a shoreline, which runs roughly from south-east - north-west in an UTM projection to visualize shoreline change. By default Cartopy maps are in north up. Is ...
eimes's user avatar
  • 43
3 votes
1 answer
574 views

Making spatial pie chart using two columns in GeoPandas

I am trying to make a pie chart that looks like the one below: - I am using GeoPandas for that: us_states = gpd.read_file("conus_state.shp") data = gpd.read_file("data_file.shp") ...
lsr729's user avatar
  • 323
1 vote
1 answer
37 views

Display the date on a time series graph

I have the following script that displays graphs of a time series for a variable: import pandas as pd from pandas import read_csv from matplotlib import pyplot %matplotlib inline from matplotlib.pylab ...
Bouram's user avatar
  • 165
0 votes
1 answer
154 views

Plotting Open Data Cube xarray data with two or more measurement parameters in the same axis

How can I plot the two measurement parameters (seasonal cover and permanent water cover) in the same axis as I want to compare them? I have this code: #load the cgls product ds_cgls_builtcover = dc....
Essy Maina's user avatar
1 vote
1 answer
2k views

Incorrect plotting of point and line

I'm learning how I can plot shapely's geometries with matplotlib. I have the point and line below: point = Point(-170.212027219433033, 80.62335710279816) linestring = LineString([(-0.446866298572111, -...
MaxDragonheart's user avatar
1 vote
1 answer
211 views

GDAL hillshade doesn't match with Matplotlib Basemap coastline

I try to plot hillshade image processed with GDAL with matplotib basemap coastline, but the resulting projection did not match. Here are my code: from mpl_toolkits.basemap import Basemap import ...
greensquare68's user avatar
0 votes
1 answer
1k views

Plotting multiple subplots with different shapefiles in background

I am trying to plot side by side GeoPandas shapefiles using matplotlib but the titles, xlabel and ylabel are not plotting correctly. fig, axes = plt.subplots(1,2, figsize=(10,3), sharex=True, sharey=...
pyaj's user avatar
  • 175
2 votes
1 answer
4k views

Set red color to NaN values with matplotlibs with subplots

I need to plot four arrays arranged in subplots using Python and matplotlib. I prefer grey scale colormap. How to plot the NaN values that can be present in each array in red? import matplotlib.pyplot ...
ilFonta's user avatar
  • 1,057
1 vote
1 answer
1k views

Customize axis and labels of rasterio plots

I have three plots consisting in a vector polygon over three different raster layers arranged in facets. I used rasterio, geopandas and matplotlib. I would modify the labels of axis in order to show ...
ilFonta's user avatar
  • 1,057
2 votes
1 answer
714 views

Contextily adds blank space to the right of matplotlib panel plot

I am unsure why I get this blank space to the right hand side of my panel plot when I add a contextily basemap. See the image example below: Here is a reproducible example: import geopandas as gpd ...
Thirst for Knowledge's user avatar
2 votes
1 answer
2k views

Overlay raster and vector using matplotlib and faceting

I'm using the function imshow from matplotlib to display several rasters using faceting. I need to overlay the vector vec.shp on each raster in each facet. I would prefere to do this with matplotlib ...
ilFonta's user avatar
  • 1,057
8 votes
3 answers
4k views

Displaying GeoTIFF file in Python

I have a list of GeoTIFF files, which I uploaded to a repo in Github. The files are generated in R, there I can read them with the raster library : > library(raster) Loading required package: sp &...
VYago's user avatar
  • 183
2 votes
0 answers
415 views

Plotting images from Google Earth Engine?

I am trying to plot GEE images as standalone figures (e.g., JPEG or PNG) for publications, however, I have not been able to find a standard method for doing that. For example, I have a landcover image ...
Mohamad's user avatar
  • 113
4 votes
3 answers
11k views

Shapely deprecation warning message when plotting GeoPandas geodataframe

I am trying to plot a GeoPandas geodataframe as I always do. Now I am having a new pc when I try to plot my geodataframe using : gdf.plot() there is no plot displayed and I receive this message: C:\...
Mahfoud B.'s user avatar
1 vote
1 answer
614 views

How to change projection in geoplot

I have trouble printing a map in Austrian Lambert projection. I use matplotlib and geoplot. It all works fine as long as the shapefile has WGS84 (epsg=4326), or if not is set to these CRS (using file....
Carina's user avatar
  • 157
3 votes
1 answer
867 views

Displaying polygon on top of DEM with GeoPandas and Rasterio

I have a DEM and a polygon, both in the NAD83 Datum. I need to plot both at the same time. Plotting the polygon import os import rasterio import geopandas as gpd import contextily as cx import ...
BallpenMan's user avatar
  • 1,217
2 votes
1 answer
461 views

How to plot spatial data in Python with axis in DMS format?

I have a plot that displays a raster file and shapefiles with the axes shown in lat/lon. Is there an option to change the axis to DMS instead? coastline = gpd.read_file('.shp') coords = gpd.read_file('...
kentopanini's user avatar
1 vote
0 answers
799 views

Ploting GEE image with imshow and adding an cartopy.io.img_tiles using add_image

I transformed a GEE image in an numpy array and I'm trying to plot a this array using plt.imshow() with a background image of cartopy image tiles (cimgt) with .add_image(). However, the array and ...
Izaeljr's user avatar
  • 13
2 votes
2 answers
640 views

Cannot plot GeoDataFrame [closed]

I am new to geopandas and having trouble plotting geometry. I have searched the forum and none of the other questions address this issue. import shapely.wkt import geopandas as gpd import pandas as pd ...
Marina W.'s user avatar

1
2 3 4 5