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
1answer
25 views

Plot RGB using rasterio

When plotting and RGB image using rasterio, I have seen that it is necessary to normalize the values first (0-1) and the use show. I am using the following code for that: def norm(band): band_min,...
2
votes
0answers
34 views

Add WMS to matplotlib Python

Currently I am adding a basemap from stamen.com to my plots as it is explained here: http://geopandas.org/gallery/plotting_basemap_background.html . Is it also possible to load a WMS from another ...
3
votes
3answers
83 views

Colorizing polygons based on color values in dataframe column?

I preparing some choropleth election result maps in Geopandas. The assigned color for each electoral district must correspond with the winning party (a color that I pre-determine), and the intensity ...
1
vote
0answers
45 views

Plotting TIFF File on tkinter Canvas

I have a TIFF file which I am trying to plot on tkinter canvas using the following code: import tkinter from matplotlib.backends.backend_tkagg import ( FigureCanvasTkAgg, NavigationToolbar2Tk) # ...
0
votes
2answers
125 views

GeoPandas: plot two layers but only to the extent of the smaller one

I am using GeoPandas and I want to plot two layers. I want the map to have the extent of the smaller layer. With this code below, the map's size automatically fits the bigger layer. import geopandas ...
0
votes
1answer
48 views

How to put a Google Map image (or any other map layers) under my UTM cordinates plot uding matplotlib and Python?

I am plotting the route taken by a car on a graph, using matplotlib. I have the cordinates of the car over time and I have extracted them in UTM cordinates (tile 31U). Below are the arrays. x = [...
4
votes
1answer
145 views

Center / normalize choropleth colors in GeoPandas

I'm looking to plot a choropleth with a divergent colormap. I need to center the colormap in such a way that the middle color is displayed for a specific value (e.g. 0). How could I do this in ...
0
votes
0answers
54 views

GeoPandas plot choropleth line color

I'm using GeoPandas to create a categorical choropleth of my data. I managed to get the correct colormap applied to the polygon fill but there are tiny slivers between the polygons that I would like ...
0
votes
1answer
95 views

GeoPandas plot does not work

I am running this code import geopandas df = geopandas.read_file('test.geojson') ax = df.plot(figsize=(10, 10), alpha=0.5, edgecolor='k') and I get nothing besides this error /usr/local/lib/python3....
2
votes
1answer
46 views

Fixing colors of LISA Cluster maps from Pysal?

I am using the LISA Cluster package from Pysal to create a LISA (Local Indicator of Spatial Autocorrelation) map. As the example of the documentation shows, the color lightblue is used to identify ...
2
votes
0answers
27 views

Run Schelling's model of segregation on a geographical map instead of the matplotlib plot or grid

If you don't know what is Schelling's model of segregation, you can read it here. I have written the following code to run the Schelling's model of segregation simulation. import matplotlib.pyplot ...
1
vote
0answers
91 views

Converting coordinates using NCO/CDO

I have a NetCDF file of ice velocities of the Greenland ice sheet but they are in polar stereographic coordinates (y: -655750 to -3355750 and x: -639750 to 855750 meters). I am wondering if there ...
1
vote
0answers
16 views

Store the lat long coordinates in matplotlib figure to a table in Python

The matplotlib figure is made of polygons and I want to take the centroid of each polygon and convert it into raster data and store it in a table.
0
votes
0answers
22 views

Reading dataset of NetCDF file

I have 2 NC files having the same dataset which I am reading by using netCDF4 in Python. After reading one of the NC file, the dataset is getting properly displayed by using np.rot90(data) which was ...
0
votes
1answer
58 views

Plotting Dataset of netCDF using matplotlib.pyplot displays rotated plot

I have read a Dataset in NC file using netCDF4 in python and then tried to plot the dataset using matplotlib.pyplot. But issue is the plot shows the image but with 90 Degrees clockwise rotation. ...
0
votes
0answers
129 views

Basemap and EPSG 3857

I have my MatPlotLib basemap set up in Mercator projection: map = Basemap(projection='merc', llcrnrlon=-10., llcrnrlat=30., urcrnrlon=36.5, urcrnrlat=46.) I need to create an ...
0
votes
0answers
55 views

Saving matplotlib map to shapefile in python?

I already plot a prediction map I made with xgboost modal by matplotlib function and I want to save this map as a shapefile so I can work with it in ArcGIS, how can I do that? Picture of the map:
2
votes
1answer
80 views

Converting QgsRaster object to array

So I'm a newbie, so sorry if this is an idiot question. I'm trying to write a plugin for QGIS3 for my organisation, and I'd like to output a standalone figure (i.e. not in the QGIS window) as the ...
1
vote
1answer
722 views

Increasing resolution of Cartopy stock background?

I am trying to create a small application that will show zoomed in maps. If possible, I would like to avoid using map tiles. Going off the example on this page: https://scitools.org.uk/cartopy/docs/...
1
vote
1answer
78 views

Visualization of 11-bit images

I'm trying to visualize a 11-bit TIFF image using matplotlib. To do it, I load the image using tifffile to obtain a 3D numpy array. Next, I have to down-sample the image because the array contains ...
0
votes
0answers
21 views

Problems opening Matplotlib on Mac

Just downloaded Matplotlib on my mac and found I can't open it. Keep getting the error message "The UnixImage IO framework is required". What can I do?
0
votes
0answers
90 views

NDVI Python image showing inverse

I am trying to calculate NDVI using python and landsat imagery. I am able to calculate ndvi using the following equation: def ndvi(sat, fp): raster = rasterio.open(fp) if sat.lower() == 'l8': ...
1
vote
1answer
277 views

Using rasterio and matplotlib how can I create a window for an NDVI image to fit into?

I am using Rasterio, Numpy, and Matplotlib. I created a window with the dimensions of 800x600 and plotted the band 5 for a Landsat 8 image, that worked just fine. I also have the nir image so then I ...
0
votes
1answer
296 views

Using Rasterio, Matplotlib, and Numpy trying to calculate and plot NDVI of a raster image getting error: IndexError: list index out of range?

First I create two variables and store my raster images in them and I use MatPlotLib to plot a subset of the original "nirband" raster image. That works fine. I am getting an IndexError: list index ...
2
votes
1answer
175 views

Setup shadedrelief background in basemap using a cropped orthographic projection

I'm trying to plot a sector of the world in basemap using an orthographic projection and I would like to have a shadedrelief background. If I don't use shadedrelief everything works fine: import ...
0
votes
1answer
252 views

How to append geojson file using featureselection

For example, I have a file as shown below: { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "...
0
votes
1answer
633 views

(OSMNX, Folium) Plotting and Isochrone on a Folium Web Map

I am trying to plot an isochrone map like the one in this example onto a Folium Web Map. I understand how to set up the colors for time/edges/nodes/polygons... I just don't understand how I could get ...
1
vote
1answer
453 views

How to use Contour_To_GeoJson?

I'm trying to convert a matplotlib contourf to geojson, but i'm stuck. I created contourf from a csv. Here's my code : data = np.genfromtxt('centroid.csv', delimiter=',') x = data[..., 0] y = data[.....
1
vote
0answers
377 views

How to fill the color in choropleth map in absolute value?

Problem I am planning to publish an article about 'how many votes are counted in each region' every one hour after the June election in Korea is over at 6 p.m. So at 7 p.m., at 8 p.m., at 9 p.m.,...
3
votes
1answer
608 views

How to define boundary numbers without decimal points - Geopandas

Problem The numbers in a legend has the decimal points (eg. 0.00-4.80 at the top of the legend box), when I want them to be integers without decimal points. All I care is that the boundary values are ...
4
votes
1answer
180 views

ArcMap crashing when plotting features with matplotlib few times via Python AddIn?

I made a 3D line plot Python add-in with matplotlib for ArcMap. After I execute this tool 3-4 times, ArcMap crashed. I have also executed it in the Python window, but the situation is just the same. ...
2
votes
1answer
310 views

Matplotlib integration in QGIS

I just made some experiments with Matplotlib and what i noticed is that all that is generated using matplotlib appear in a new window that doesn't seem to be tightly linked to qgis. The only "link" i ...
1
vote
1answer
264 views

Visualizing LAS with matplotlib

I'm trying to create a 3D scatterplot using an las file that contains xyz and return values. I want to keep all returns but would like to subset the cloud. I've learned how to subset using laspy so no ...
0
votes
1answer
109 views

Touching Polygon Intersection

I have two touching Polygons (two neighbouring counties) and there intersection is a MultiLineString, where: len(list(counties["King's Co."].intersection(counties["Queen's Co."]).geoms)) list(...
-1
votes
1answer
266 views

What does it mean to have a list of longitudes and a list of latitudes?

I am working with matplotlib. And trying to understand what it might mean to have a list of longitudes and a list of latitudes? such as using plt.plot( [longitude list] , [latitude list] ) I am ...
-1
votes
1answer
167 views

Shapefiles with Ireland's Inland Waterways

I wish to produce a set of polygons for each county on the island of Ireland. I found shapefiles here of all 32 counties: https://www.townlands.ie/page/download/ The problem is that there are no ...
2
votes
1answer
2k views

Reducing space in geopandas and matplotlib.pyplot's subplots?

I use geopandas and matplotlib.pyplot's subplots to plot two subplots in a single figure, with a single colorbar, as: How do I reduce the whitespace around the maps in each subplot (not in between ...
0
votes
1answer
298 views

ArcGIS error with Python Toolbox that imports matplotlib?

Recently upgraded to 10.5 ArcGIS. Custom ArcPy Toolbox (pyt) shows the red-x error and will not load. Going to "Check Syntax.." results in this: File "[from custom ArcPy Tool .py file]"... ...
2
votes
0answers
2k views

Create custom color map for multiple GeoPandas plots to share same scale

My objective is to create a 2x2 figure where each cell in each grid is on the same color scale. Currently, I haven't found a compound plot option in GeoPandas that allows me to plot one GeoDataFrame ...
0
votes
0answers
134 views

Selectively install frameworks for macos QGIS?

The KyngChaos method is the one-stop shop for Mac users to install QGIS. This page has links to the critical frameworks and python modules, which he graciously packages and maintains himself. Have ...
1
vote
0answers
538 views

How to loop the kernel for covering all pixels from a raster in 5x5 convolution window by using OpenCV? [closed]

Here, I have python code which is helping me in selecting 5 by 5 window from upper left corner of a raster (.tif). I want a process to automate through entire image in 5 by 5 convolution window. ...
1
vote
1answer
5k views

Groupby Ploting - give each plot title/name

I have used this code to group by the continents and then plotted using geopandas. I would like to set the plot title for each continent. I would have liked also to draw the continents side by side. ...
1
vote
0answers
584 views

Clip a NetCDF file using a shapefile with Python

I have global net radiation data but I want to extract for my country. I've loaded the NetCDF but I don't know how to proceed further. The following is a similar question (Extract data from netcdf ...
1
vote
0answers
583 views

calculate difference between two interpolated grids using python [closed]

I'm trying to calculate difference between two interpolated grids. The grids are of different shapes, so cannot use np.subtract to calculate the difference. Any help on how to calculate the difference?...
2
votes
0answers
511 views

Generating tiles from matplotlib plots

I have a number of analyses that are being plotted as heat maps in UTM coordinates using matplotlib. I'd like to generate tiles from these to display on a leaflet map over top of an OSM map. At this ...
2
votes
0answers
263 views

Using python spectral package? [closed]

I found this tutorial about spectral using python and I will test kmeans classification using Landsat image. I don't understand some things about this tutorial. First thing I can't understand is about ...
1
vote
0answers
52 views

If a point (lat long) lies within any polygon of a shapefile [duplicate]

i checked different places to finally come up with a code which used ray casting method to check if the given lat, long was inside one of the many polygons of my shapefile. this code worked fine when ...
0
votes
1answer
802 views

Assign colour to my shapefile with matplotlib

import shapefile as shp import matplotlib.pyplot as pltsf = shp.Reader("D:/New folder1/21_8_2016.shp") plt.figure() for shape in sf.shapeRecords(): x = [i[0] for i in shape.shape.points[:]] y ...
1
vote
1answer
409 views

Extracting Lats and Lons from grib2 file

I am working on NCEP GFS data to plot certain parameters. I use python for plotting and wgrib2 for extracting data from grib2 files. There are no problem as such to extract parameter from grib2 data (...
1
vote
0answers
1k views

Plotting Shapely polygons on basemap

I have some polygons and multipolygons created using latitudes and longitudes using shapely(there is no shapefile). I want to plot them using basemap. However they don't show up. When I use matplotlib ...