Questions tagged [contourf]

Filled two-dimensional contour plot

Function Reference

A filled contour plot displays isolines calculated from matrix Z and fills the areas between the isolines using constant colors. The color of the filled areas depends on the current figure's colormap.

contourf(Z) draws a contour plot of matrix Z, where Z is interpreted as heights with respect to a plane. Z must be at least a 2-by-2 matrix. The number of contour lines and the values of the contour lines are chosen automatically.

contourf(Z,n) draws a contour plot of matrix Z with n contour levels.

contourf(Z,v) draws a contour plot of matrix Z with contour levels at the values specified in vector v.

contourf(X,Y,Z), contourf(X,Y,Z,n), and contourf(X,Y,Z,v) produce contour plots of Z using X and Y to determine the x- and y-axis limits. When X and Y are matrices, they must be the same size as Z, in which case they specify a surface as surf does.

[C,h,CF] = contourf(...) returns the contour matrix C as calculated by the function contourc and used by clabel, a vector of handles h to patch graphics objects, and a contour matrix CF for the filled areas.

Documentation: http://nf.nci.org.au/facilities/software/Matlab/techdoc/ref/contourf.html


Function Reference

matplotlib.pyplot.contourf

364 questions
0
votes
1 answer

How do I add a coastline to an xarray.plot.facetgrid.FacetGrid?

I am attempting to make a figure with 12 plots showing the monthly average of a parameter from the 1800's to the 2100's for each month. I have the plots pretty much finished with the average monthly data for each month and 12 plots, I just want to…
franke11
  • 35
  • 5
0
votes
1 answer

MATLAB- Why does my contourf refuse to fill the .1- -.1 values as white?

I am trying to create a contourf plot with a specific color scheme. I defined the colormap as specific matrix values and defined it as such in the code. cb=[.64 .08 .18;1 0 0;1 .41 .16;1 1 .07;1 1 1;0 1 0;0 1 1;.07 .62 1;0 0 1]; This is my contourf…
Garett
  • 1
0
votes
1 answer

Matplotlib: strange minor ticks with log base 2 colorbar

I am plotting some contours with tricontourf. I want the colormap to be scaled in log values and tick labels and colours bounds to be in log base 2. Here's my code: import numpy as np import matplotlib.pyplot as plt import matplotlib.tri as…
user2078621
  • 111
  • 3
  • 12
0
votes
1 answer

Re-arranging order of longitude values on the x-axis

I have a time-longitude array which I am plotting using the matplotlib contourf function. My longitude values span from [-180, 180] and as such appear on the x-axis in this order. I would like my x-axis to run from 0 degrees to 0 degrees, so my…
0
votes
1 answer

How can I force ticks to have a certain spacing and range using contourf() in Python?

I'm creating a series of contours to be presented simultaneously; some plots have data in the range (0,6) and some are (4,6), but I'd like all contours to have the same colorbar which ranges from 0 to 6. For the plots with data in the range (0,6),…
Amelia Henkel
  • 55
  • 1
  • 1
  • 6
0
votes
0 answers

How can I use different colors for contours in MATLAB?

I want that each successive contour is plotted with a different color or to use a colormap for the contour plot. Right now all the contours are being plotted in white. I tried to change the color of the contours but all I could do was to color all…
anish
  • 13
  • 4
0
votes
1 answer

Matplotlib/CartoPy Solid Fill Underneath Contour Plot

I am looking to add a solid fill underneath my contoured data (contourf in Matplotlib). Specifically, I would like the solid fill to be constrained to specific shapefiles, in this case individual states in the continental United States. My current…
TornadoEric
  • 399
  • 3
  • 16
0
votes
0 answers

Create 2D array from 1D temperature array and plot with contourf over a map. Random 1D lat and lon coordinates

Good day to all I have 3 1D arrays of data, let’s say lat=[28.9, 30.2, 27.5], lon=[18.0, 17.6, 18.85], Temp=[22.22, 20.1, 20.1]. Please notice that none of them is in ascending or descending order of values. How can I make the required 2D arrays to…
athakarag
  • 1
  • 1
0
votes
0 answers

How to make an intersection plot of contours in Python

I'm working with optimization and I'd like to get a plot of the intersection of two constraints. This is one constraint and this is the other. What I need is the something like that. Here is a piece of the code that generates both constraints: #…
cieslak
  • 1
  • 3
0
votes
0 answers

How to get the contourf handler from matplotlib?

I was wondering how to get the contourf handler from an axes within matplotlib. From the codes and outputs below you can easily find that im is matplotlib.contour.QuadContourSet but no such kind of thing in ax.get_children(). I know I can obtain im…
Fei Yao
  • 1,502
  • 10
  • 10
0
votes
0 answers

matplotlib contourf inconsistent plots

the two figures below (I will call the top one Figure 1 and the bottom one Figure 2) were created using the same call to the same function from the Spyder commandline, one immediately after the other. It can be seen that the results of contourf()…
Y T
  • 63
  • 5
0
votes
1 answer

How to plot contour chart in python when we have date in X axis

I am facing an issue while plotting contour chart in python as it gives an error message "Value error: could not convert string to float: 03Dec2063". I have data in Excel as per below format. FinalMaturity | Tenor | Breach 04Jan2021 | 12 | …
Add
  • 407
  • 1
  • 4
  • 9
0
votes
1 answer

How can I modify my code below to plot contour levels with a for loop?

The code below plots multiple contour maps at different locations on the Z axis specified by Zlevel. However, I have more than one Z data points of interest, hence I would like to use a for loop. Zlevel=[0 1]; figure(1) hold on…
0
votes
0 answers

TriContourf in Matplotlib not working where as Tripcolor is working fine

Same Python Script if i use for my Matplotlib plot then i am getting the plot with Tripcolor but i want the plot with Tricontourf , Error which i am getting with Tricontourf is given below :- …
MSA msa
  • 83
  • 1
  • 10
0
votes
1 answer

Windrose: Scatter plot wrscatter over contourf

I'd like to overlay a wind rose made with contourf() with a wrscatter plot. This is my MWE: import random wind_dir = []; wind_speed = []; for i in range(30): wind_dir.extend(random.sample(range(0, 359),1)) …