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
19 views

GeoPandas & Rasterio - Overlaying rasters above a shapefile

I'm new to GeoPandas/Rasterio and I'm trying to make a piece of code for generating a map - I want to show a basemap shapefile (PAA.shp) and layer a raster on top (landuse.tif). Landuse.tif has 3 ...
user avatar
1 vote
1 answer
32 views

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

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 ...
user avatar
1 vote
0 answers
37 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 ...
user avatar
1 vote
0 answers
38 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 ...
user avatar
  • 33
2 votes
0 answers
31 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") ...
user avatar
  • 291
1 vote
1 answer
22 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 ...
user avatar
  • 109
0 votes
0 answers
12 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....
user avatar
1 vote
1 answer
23 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, -...
user avatar
1 vote
1 answer
51 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 ...
user avatar
0 votes
1 answer
36 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=...
user avatar
  • 153
1 vote
1 answer
173 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 ...
user avatar
  • 987
1 vote
1 answer
85 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 ...
user avatar
  • 987
2 votes
1 answer
77 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 ...
user avatar
2 votes
1 answer
141 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 ...
user avatar
  • 987
7 votes
2 answers
516 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 &...
user avatar
  • 173
1 vote
0 answers
105 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 ...
user avatar
  • 103
0 votes
0 answers
25 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-...
user avatar
3 votes
3 answers
1k 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:\...
user avatar
1 vote
1 answer
96 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....
user avatar
  • 165
3 votes
1 answer
148 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 ...
user avatar
  • 1,102
0 votes
0 answers
51 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 ...
user avatar
0 votes
0 answers
14 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 ...
user avatar
  • 153
2 votes
1 answer
66 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('...
user avatar
0 votes
0 answers
181 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 ...
user avatar
0 votes
0 answers
12 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 ...
user avatar
  • 1
2 votes
2 answers
131 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 ...
user avatar
0 votes
2 answers
80 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
50 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]...
user avatar
  • 1,038
0 votes
0 answers
111 views

How to show RGB image with latitude and longitude in Python?

I need to create an RGB figure based on an HDF5 file, which consists of latitude layer, longitude layer, and different band data layers. However, the ax.contourf() function only receive 2-dimensions(...
user avatar
2 votes
0 answers
54 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: ...
user avatar
0 votes
0 answers
26 views

Using linear regression on subplots [duplicate]

I was able to create 2 plots, one of which has a linear regression. I want to do linear regression for each subplot, how to do it? X=trw["CID"].values y=trw['b1_T34UFE_'].values df=pd....
user avatar
  • 9
0 votes
0 answers
15 views

Error using matplotlib in QGIS 3 processing script

When I'm using the command plt.show() of Matplotlib in QGIS 3 processing script, it produces this error: File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 269, in show return ...
user avatar
  • 65
0 votes
0 answers
75 views

Replacing mpl_toolkits.basemap functionality to create figure with monthly NASA Blue Marble image

I'd like to uncouple the deprecated mpl_toolkits.basemap calls from this inherited code and replace it with something that will be supported going forward - they recommend Cartopy but I'm open to ...
user avatar
  • 153
2 votes
1 answer
804 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 ...
user avatar
0 votes
1 answer
415 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 ...
user avatar
  • 144
1 vote
2 answers
493 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 ...
user avatar
0 votes
0 answers
71 views

Plugin Import Error cannot load "WX" as "qt5" is currently running Ubuntu 21.04

Trying to import a self-written Plugin (works on other machines e.g. Windows) but I get an Import Error under Ubuntu 21.04 with QGIS 3.18: Cannot load backend 'WX' which requires the 'wx' interactive ...
user avatar
3 votes
0 answers
210 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 ...
user avatar
0 votes
0 answers
92 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 ...
user avatar
  • 129
1 vote
1 answer
407 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 ...
user avatar
  • 129
1 vote
1 answer
1k 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 ...
user avatar
0 votes
0 answers
79 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. ...
user avatar
0 votes
1 answer
403 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....
user avatar
1 vote
3 answers
172 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 ...
user avatar
2 votes
1 answer
100 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(...
user avatar
  • 399
3 votes
1 answer
637 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 ...
user avatar
4 votes
1 answer
614 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 ...
user avatar
5 votes
1 answer
427 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[...
user avatar
0 votes
0 answers
54 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 ...
user avatar
0 votes
1 answer
2k views

Python Matplotlib Combine legend from histogram and lines [closed]

I wrote a Python script that uses matplotlib twinx to combine a histogram and some line functions plot as can see in the figure. However I was not capable of combining both legends (nb of points and ...
user avatar
  • 356

1
2 3 4 5