Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
7 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
20 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
30 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
30 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
37 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
181 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
45 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
58 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
152 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
207 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
117 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
158 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
437 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
279 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
348 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
428 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
161 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
0answers
233 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
0answers
175 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
76 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
192 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
138 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
1k 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
239 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
1k 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
101 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
478 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
4k 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
499 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
476 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
436 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
235 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
48 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
653 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
348 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
913 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 ...
1
vote
1answer
660 views

Can't import shapefile in Python

I am trying to plot district boundaries on a map of Nepal. For that I downloaded a shapefile of districts in Nepal from this site: http://www.arcgis.com/home/item.html?id=...
2
votes
0answers
313 views

All contours are not getting converted to shapefile in python

I am trying to create isoline plot for a weather parameter. Inputs are Lat, Lon and Value. They are read from csv file. When I plot the contours using matplotlib, the code works fine and generates ...
0
votes
1answer
79 views

using histogram2d with categorical dimension

This is a scatterplot of business addresses in Melbourne by ANZSIC division names. sns.pairplot(x_vars=["x coordinate"] , y_vars=["y coordinate"] , data=d , hue=...
3
votes
1answer
2k views

Graph points in image using matplotlib

I am trying to plot points (latitude, longitude) inside a raster image in Python. First, I read the image using rasterio and plot it using the same package, after transform the image from uint16 to ...
0
votes
1answer
2k views

Plotting elevation maps from latitude, longitude, and elevation

I have DEM ( Digital Elevation Model ) data, and I want to perform a representation of it, in the form of heatmap or 3d surface. I have the data converted from the .img DEM using gdal_translate in ...
9
votes
1answer
3k views

Change marker size in plot with GeoPandas

I have a geodataframe with points and some associated data. I want to plot it on a map using geopandas and have the size of the points correspond to one of the columns in the geodataframe. So far I ...
1
vote
1answer
498 views

Custom matplotlib discrete colormap with fixed values on raster

I've been using a color ramp with fixed values (0-255) corresponding to specific rgb color (discrete interpolation) for 8bit tifs in QGIS. I've used matplotlib to apply built in colormaps, but I'm ...
2
votes
1answer
226 views

Detecting degeneracy in triangulations that causes matplotlib to crash?

I built a plot over roads graph and am trying to interpolate the data in a raster, but some nodes cause triangulation error. Earlier I noticed and fixed a problem when multiple points sticked in one ...
1
vote
0answers
2k views

Images overlay in 3D surface plot matplotlib (python)

It is possible to overlay a geotiff, png or jpg to a surface_plot generated in matplotlib? I want to display for example a smooth hillshade, geology or orthoimages. Another question... how to smooth ...
2
votes
0answers
1k views

Skewing/rotating a plot in matplotlib.Basemap

I am currently plotting data onto an orthographic projection in matplotlib's Basemap. I would like to rotate or skew the plot to a 23.5 degree angle, corresponding to the Earth's axial tilt. The map ...
7
votes
2answers
2k views

DEM plot with matplotlib is too slow

I made a surface plot with matplotlib, mplot3d and gdal. Here is the code: import gdal from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import matplotlib.pyplot as plt import numpy ...
0
votes
1answer
344 views

Having trouble to get a nice plot of a DEM

With the explanations that I got on this post (Plot a surface with a DEM and mplot3d) I was able to plot a DEM (that I made with QGIS) with matplotlib on Python. However I am still having trouble to ...
2
votes
1answer
200 views

Code completion for matplotlib and numpy libraries in qgis script

I would like to know if it's possible to get code completion working for the matplotlib and numpy libraries in QGIS Script. For example, the following code runs fine in script console of QGIS, but ...