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
2
votes
0answers
22 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
26 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.
1
vote
0answers
19 views

How use IF conditions for choose cmap to plot NetCDF4

I have some variable in my NetCDF4. I have 2 type of variable IR ( infrared) or VIS visible all time when when I choose var to plot in list_ var in index I need to choose cmap : Dor IR the cmap is ...
0
votes
0answers
17 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
32 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
63 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
36 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
52 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
340 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
55 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
68 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
225 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
249 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
135 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
202 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
523 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
332 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
361 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
492 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
170 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
255 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
229 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
87 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
223 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
153 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
266 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
122 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
485 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
541 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
508 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
468 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
251 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
49 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
711 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
372 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
989 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
705 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
341 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
86 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
512 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
238 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 ...