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
1
vote
1 answer

Contourf not showing full range of values

I have two datasets that when compared result in a basically random distribution of values between -1 and 1. When I plot this using contourf, however, the figure shows almost all values > 0.5. When I plot every 10th point (thin the data), I get a…
ZLebo
  • 11
  • 1
1
vote
0 answers

matlab quiver: arrows stuck on one side of the plot

I am trying to plot some arrows with quiver on matlab to represent the flow over a contour but when I run this code, the arrows are only drawn over the left part of the contour, would anyone have an idea of what causes this…
aurore
  • 11
  • 1
1
vote
0 answers

TypeError: Input z must be 2D, not 1D

I have successfully plotted an excel data to make a 3d plot. Now I want to plot it to make a contour map. But somehow it resulted an error. could someone help me? This is my code: import matplotlib.pyplot as plt import numpy as np import pandas as…
Akbar Andi
  • 11
  • 2
1
vote
1 answer

Show distribution of data about mean using contours

I was wondering if anyone could point me in the right direction with some functions or code (in python) which would allow me to plot the distribution of a timeseries dataset using contours, as shown in the attached image. I have a dataset like the…
1
vote
1 answer

How to change color in contourplot for just NAN values matplotlib

I am making a contourplot from a pandas dataframe (df in example), for which part of the graph are values that should should not be displayed. In the dataframe they are NaN values. The NaN values show up as a white area, but I would like to give…
Berendvv
  • 75
  • 8
1
vote
0 answers

Python contourf-function with customized colorbar

I have a plot and would like to emphazise the low-value regions to see how the values change there. I was thinking of using a gamma-function (gamma<1), such that y = x^(gamma), with x being the old value and y being the new value. This ensures to…
Yannick
  • 11
  • 2
1
vote
1 answer

Set_xlim and set_ylim not working for contourf in 3d plot

I want to create a 2d slice contour plot in 3d with the range of x and y larger than the given xlim and ylim. However, when I set xlim and ylim the contour seems to be extended outside of the axes. I would be most appreciative if there is a way to…
Winston Wu
  • 45
  • 4
1
vote
1 answer

Griddata and Contourf produce artifacts with increasing steps/levels

I am using SciPy Griddata to interpolate data in its Cartesian form and then plot these data using contourf with a polar projection. When the Cartesian interpolated data is plotted with contourf there are no artifacts. However, when the projection…
ngc1535
  • 35
  • 5
1
vote
1 answer

Trying to (fill) draw polygons from matplotlib contourf but they don't seem closed

I have found some elevation data as a matrix. I plotted the data with a contourf plot with matplotlib. This looks like top left of the figure. I would like to reuse these contours later in other parts of the code. At some point, I want to redraw…
mwoua
  • 403
  • 5
  • 13
1
vote
0 answers

Contourf's number of color levels in Matplotlib

I'm trying to make a 3d contour plot using countourfcommand in Matplotlib. Here's the variable distribution: I'm trying to plot the contour over 3 sides of a cube: plt.close('all') fig = plt.figure() ax = fig.gca(projection='3d') ax.pbaspect =…
RaphaelDavid
  • 111
  • 2
1
vote
0 answers

contourf does not show the color outside the levels range without colorbar

I am trying to make some contourf figures with the option 'extend=both'. However, the colors outside the color range (both max and min) does not show in the figure. When calling the colorbar function after contourf, the outside colors appears, but I…
1
vote
1 answer

contourf colormap from blue to white with gradient

I would like to change the colormap in my plot, from yellow to blue, to be from blue to white;only two colors with gradient. Is it possible? Code: x = randn(1000,1); y = randn(1000,1); [N,Xedges,Yedges] = histcounts2(x,y); contourf(N) any help is…
user1640255
  • 1,224
  • 3
  • 19
  • 25
1
vote
3 answers

Conditional function change in matplotlib's contour plot

I would like to generate a contour plot, using a 2 variable function, Z(X,Y). However, I would like to impose a condition that changes the function when X is less/greater than a certain value. Such a change would allow me to use just a singular…
1
vote
1 answer

Masking/clipping part of a contour plot above a specified curve with python

I have a contour plot which is produced using Triangulation/TriInterpolation and contourf, shown in the image below. I also have the two curves plotted on either side of the contour which are the boundary for where data should not go past. As can be…
1
vote
1 answer

pyplot.contourf and branca colormap does not show the same colors in folium

I am trying to display a contourf plot as you can see below in the code snippet on a Folium map. I can see the filled contour plot just fine. Also, I added a color bar with exact same colors using branca at this line: bmap =…