Skip to main content

All Questions

1vote
1answer
65views

How to remove xarray plot bad value edge colour

I know set_bad can colour the pixel into a specific colour but in my example I only want to have edge colour for blue and grey pixels with values and not the bad pixels (red) import matplotlib.pyplot ...
0votes
1answer
131views

How do I animate xarray data using matplotlib?

I am trying to animate a plot using matplotlib's FuncAnimation, however it never outputs anything. The data is NetCDF, precipitation rates for the USA with coords for day, x and y. The x is longitude ...
1vote
1answer
318views

How to apply stippling to contourf plots in Python?

I want to add stippling to Xarray DataArray data to indicate significance. The data is 2D climate data on a lat lon grid. I want to give a True/False mask to plot over mapped variable data. I am ...
4votes
2answers
2kviews

Seam where longitude wraps around in matplotlib/cartopy Mollweide projection

I am plotting some NETCDF data, handled by xarray in Matplotlib using a Cartopy wrapper for the map projections. When I produce a filled contour plot (contourf), I end up with a 'seam' at longitude ...
0votes
0answers
74views

Cartopy facecolor='' not working as intended only for certain projections

I am using Cartopy 0.23.0 on a Windows 11 OS installed via conda-forge, Xarray version 2023.6.0, matplotlib version 3.8.4, and Python 3.9.19 . I am seeing strange behavior that I cannot figure out ...
0votes
0answers
145views

Clip spatial data to polygon in python

Good day, I am trying to create a spatial plot of gridded precipitation data. I have opened the netCDF using xarray. However, the data is currently not land-only (Figure 1) and I want it to only cover ...
0votes
0answers
58views

Remove white spaces in subplots matplolib

I try to plot the subplots as shown below. It works okay but it still have some white spaces at the end of figure. Is it possible remove white spaces. Any help would be very great. Here is the code ...
3votes
2answers
215views

Using xarray with resample and interpolate to animate the movement of contours

Lets say I have the following python code, showing a contour value at 12pm and 1pm, indicating that it's position has moved: import xarray as xr import numpy as np import matplotlib.pyplot as plt from ...
0votes
1answer
491views

How to use matplotlib.pyplot.contourf to plot a density array

I have an xarray Dataset called dens that I would like to plot. This is the Dataset: <xarray.Dataset> Dimensions: (time: 641, lat: 30, lon: 30) Coordinates: * time (time) datetime64[ns] ...
1vote
0answers
41views

Quiverplot adds a number to the plot in top right corner [duplicate]

I have an xarray's dataset (DS in the code below) with geophysical data. When I am plotting it using quiver, a dot with a number appears in the top right corner, outside of the plot's range: the dot. ...
0votes
1answer
58views

Looping through plots, then taking sum of a select number of plots

I am trying to create a function that plots EOFs and loops through each mode. This part is fine and I had no trouble getting out a plot of the 12 EOFs. However, now I would like to sum across the ...
0votes
1answer
626views

Issue plotting WRF Data with Lambert Projection -Coastlines overlay not being displayed on top of data

I recently started using python via jupyter on windows to plot netCDF data. However I am having issues plotting output data I have from a WRF run that uses Lambert Conformal projection. I cannot seem ...
1vote
1answer
921views

Customize xarray colorbar position

I try to position colorbar in a designed position as figure below (horizontal in row 5, from second column onwards). Here is demo code import cartopy.crs as ccrs import numpy as np import xarray as xr ...
2votes
1answer
370views

calculate the partial derivatives of temperature (horizontal advection of temperature)

I would like to know which way is the most correct to calculate the partial derivatives of temperature in the x and y directions (horizontal advection of temperature) The second code used the data ...
-2votes
1answer
27views

Why some data is missing on a figure when I define the axes? My dataset is a DataArray and some values are masked [duplicate]

I would like to be able to define my axis and not lose information. Currently, I am missing the last data point in both dimensions I defined (see figure). DATA = xr.DataArray(np.random.rand(74,13),...

153050per page
close