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
0 votes
0 answers
6 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
0 votes
0 answers
10 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
  • 686
1 vote
0 answers
22 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
47 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
  • 524
0 votes
1 answer
74 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
45 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
28 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
86 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
223 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
46 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
213 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,108
3 votes
1 answer
302 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
  • 749
0 votes
0 answers
22 views

Cartopy draws values that equal to zero in the array as non zero values

I draw a map of a parameter with matplotlib and cartopy. Use cartopy crs Mercator (also I tried AlbersEqualArea - result is the same). An array (2d as it's a mesh) has some float values like 1.1 - 5....
Nikolay Yasinskiy's user avatar
1 vote
1 answer
631 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
345 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
688 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
12 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
798 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
487 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
163 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
238 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
119 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
275 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
5k 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
  • 315
1 vote
1 answer
1k 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
1k 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
362 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
1 vote
0 answers
350 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
  • 33
3 votes
0 answers
491 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
36 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
  • 155
0 votes
1 answer
108 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
179 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
3k 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,037
1 vote
1 answer
812 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,037
2 votes
1 answer
574 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
1k 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,037
8 votes
3 answers
3k 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
1 vote
0 answers
376 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
  • 103
4 votes
3 answers
10k 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
465 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
709 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,219
2 votes
1 answer
362 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
657 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
555 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
0 votes
2 answers
252 views

Mapleaflet- Latitude and longitudes are properly not getting plotted

I am using Leaflet (Mplleaflet) to plot and display a simple polygon of an area on a map. I took the points, correctly, from Google Earth but it is not plotting the coordinates on the city of Kolkata ...
user avatar
1 vote
1 answer
133 views

Array is visualized differently in matplotlib than QGIS

I am getting different resutls when plotting a np.array with matplotlib than when doing it in an external software - QGIS. Here is what I have: print(wiw[0].shape) (1, 8433, 9254) print(wiw[0]...
GCGM's user avatar
  • 1,108
2 votes
0 answers
1k views

Plotting maps using Matplotlib with a loop: Only two of four iterations completing

Using two different dataframes (Itis and Myyrmanni), I'm attempting to use a loop to plot four different maps with Matplotlib. Each respective dataframe is to be represented with two different maps: ...
Tristan Scott's user avatar
2 votes
1 answer
4k views

Plotting multiple maps using GeoPandas

I have two GeoDataFrames. The first one have the administrative boundaries of the 25 regions of a country. The second one, the urban fabric of the same country. regions.head() COD NAMEREG ...
José Rojas's user avatar

1
2 3 4 5