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
0 answers
18 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 ...
1 vote
0 answers
20 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=...
0 votes
0 answers
38 views

geopandas add legend to simple plot with no columns

I have a single feature that I want to plot with a legend, but the legend is not showing off. It's a simple polygon with simple fill. The code that I ran is like this, import geopandas as gpd import ...
  • 764
0 votes
0 answers
23 views

How can I ignore the black zones when I will plot a composition of bands in a stack? In this order of bands (5,4,3)

This is my code: from osgeo import gdal import numpy as np import matplotlib.pyplot as plt import rasterio from rasterio.plot import show banda3 = gdal.Open(raster3) banda4 = gdal.Open(raster4) ...
  • 348
0 votes
1 answer
71 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 ...
0 votes
1 answer
711 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 ...
  • 133
1 vote
1 answer
419 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 ...
  • 181
1 vote
1 answer
310 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 ...
1 vote
0 answers
180 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 ...
1 vote
0 answers
117 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 ...
  • 33
3 votes
0 answers
212 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") ...
  • 323
1 vote
1 answer
26 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 ...
  • 121
0 votes
1 answer
45 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....
1 vote
1 answer
335 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, -...
1 vote
1 answer
100 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 ...
0 votes
1 answer
322 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=...
  • 175
1 vote
1 answer
767 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 ...
  • 1,007
1 vote
1 answer
286 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 ...
  • 1,007
2 votes
1 answer
154 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 ...
2 votes
1 answer
462 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 ...
  • 1,007
7 votes
2 answers
975 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 &...
  • 173
1 vote
0 answers
200 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 ...
  • 103
0 votes
0 answers
32 views

Query ASCII Rastor format data data in gpw

I have downloaded this from website gpw-v4-population-count-rev11_2020_30_sec_1.asc gpw-v4-population-count-rev11_2020_30_sec_2.asc gpw-v4-population-count-rev11_2020_30_sec_3.asc gpw-v4-population-...
4 votes
3 answers
4k 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:\...
1 vote
1 answer
213 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....
  • 157
3 votes
1 answer
271 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 ...
  • 1,169
0 votes
0 answers
119 views

Basemap and matplotlib table cannot be plotted on same axis

I am adapting code from here. I am trying to add a basemap on the plot but I realize I cannot have both the map tile and the matplotlib table on the same axis. When I comment the snippet for the ...
0 votes
0 answers
17 views

Projection causes interpolation error?

I'm trying to do an interpolation with matplotlibs tri function, but the results show as empty for some reason. Specifically, I am trying to interpolate rainfall across an island given 41 weather ...
  • 153
2 votes
1 answer
160 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('...
1 vote
0 answers
329 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 ...
  • 13
0 votes
0 answers
15 views

Installing external dependencies of QGIS on MAC

I need to install the QGIS SCP plugin to be able to work with some raster images on Mac. This plugin needs some external dependencies like scipy or matplotlib to be installed. However, I can't manage ...
  • 1
2 votes
2 answers
262 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 ...
0 votes
2 answers
122 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 ...
's user avatar
1 vote
1 answer
83 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]...
  • 1,078
2 votes
0 answers
543 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: ...
2 votes
1 answer
1k 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 ...
0 votes
1 answer
549 views

Plotting: overlay raster on vector

I'm trying to create something like this: Which can be done in R using this guide: https://www.mzes.uni-mannheim.de/socialsciencedatalab/article/geospatial-data/ While I enjoy R I would like to know ...
  • 144
1 vote
2 answers
802 views

Plot shapely polygon on top of rasterio

I have 2D raster and I'm interested in plotting on top of it polygon. When I print the geometry and its' type I get this: #this is inside a loop that takes each time one row which is one polygon ...
3 votes
0 answers
271 views

How can I plot a Kernel Density Estimation in a projected coordinate system in Python?

I am trying to plot a Kernel Density Estimation calculated from a geopandas GeoDataFrame in UTM. I am using sci-kit learn's KernelDensity, because other implementations don't allow for much ...
0 votes
0 answers
119 views

Creating mask of geospatial data with maximum side-length(triangulation)

Earlier I asked a question, about Python GeoPandas crops result or sets boundary to data And I still cant understand how to work with geospatial data. I generate coordinates and create a plot with ...
  • 129
1 vote
1 answer
519 views

Python GeoPandas crops result or sets boundary to data

When I create GeoDataFrame from source data and then show it by pyplot all good, because I didn't do anything with the data. It looks like this: If I plot it with tricontourf, it looks like (errors ...
  • 129
1 vote
1 answer
2k views

Adding custom names to a GeoPandas legend

I have a shapefile which has an attribute table with a column I would like to make a map/plot of. The attribute values are numerical (integer). I have made two dicts to map the colors and names I want ...
  • 952
0 votes
0 answers
96 views

Creating plots for each hour of each day with Python

I am trying to create an animated map (by generating multiple plots) of road traffic throughout a week, where the thickness of roads is represented by the volume of traffic at a specific time of day. ...
0 votes
1 answer
566 views

How to plot coordinate system from EPSG 4326 on north pole centered map in Python?

I have the following pandas dataframe (df) which looks like this with column headers and data values, 3 points each: temperature: array([-101.6015625, -100.9296875, -85.4296875]) latitude: array([32....
1 vote
3 answers
247 views

Geopandas and Matplotlib Plotting error

I am trying to plot a point on top of a shapefile. the Coordinates of the point are accurate. I verified it using the go to XY tool of ArcMap. but when I try to plot overlay using Python the location ...
2 votes
1 answer
135 views

Obtain CRS from existing axis with cartopy

Is there a method to get the CRS from a figure created with cartopy? Say for example, I only had access to the ax created here: import cartopy.crs as ccrs import matplotlib.pyplot as plt plt.figure(...
  • 419
3 votes
1 answer
827 views

Matplotlib skip color for assigned interval in map plotted from GeoPandas DataFrame, if attribute don't have value in range of user defined bins

I have a GeoPandas GeoDataFrame which I am plotting against a specific column and the colour of the output/map is same for different assigned bins/intervals. The issue is because, sometimes, there is ...
4 votes
1 answer
780 views

Legend colour not matching as assigned in the bins in matplotlib map plotted from GeoPandas DataFrame

I have a GeoPandas GeoDataFrame which I am plotting against a specific column and the colour of the output/map is not matching with the colour assigned to different bins/intervals. It should ideally ...
5 votes
1 answer
514 views

Removing NaN value from legend in matplotlib map plotted from GeoPandas DataFrame

I have a GeoPandas GeoDataFrame which I want to plot against a specific column. for day in days_list: df2 = csv_file[["state_id", "state_name", "tmx_corrl"]].loc[...
0 votes
0 answers
89 views

Plotting contours for geodetic data.(in Python)

I need to plot contour plot for a geodetic dataset, but I have data for 15 locations of New Zealand. I have been able to generate a map a New Zealand using cartopy library of Python, but I am not sure ...

1
2 3 4 5