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

Python matplotlib colorbar range

So, after searching for a few hours, I can't seem to find a simple answer to my issue. I have a filled contour plot (contourf) for whom I want the values displayed on the colorbar to be between -45 and 45. fig, ax =…
Yoshi
  • 671
  • 8
  • 20
0
votes
0 answers

Bad contour lines when plotting gridded data

I have heavily edited data from an underwater glider that measures temperature, conductivity, and pressure. From that we get salinity, density and sigma (sigma = density - 1000). The instrument did not sample very well, hence the heavy editing. I…
B.K.I
  • 1
  • 1
0
votes
1 answer

Convert given value of contourf color to rgb code

I created a 2D contourf plot with viridis color scheme in bounds vmin=0,vmax=4. Here is the code: ax.contourf(xi/d,yi/d,data/d,12,vmin=0,vmax=4,cmap=vs.viridis(),aspect='equal') Now I have from another calculation a data point at a specific…
0
votes
0 answers

Matlab: contourf, repeated data points: median instead of average

I use contourf function for plotting a 2D filled contour. I get warning that some of the data points for Z are repeated and average values will be used in that case. Can I somehow force Matlab to use the median values instead? Thank you. File:…
algoProg
  • 718
  • 2
  • 11
  • 27
0
votes
0 answers

Contour plot of rectangular matrix in polar coordinates matlab

I have a rectangular matrix of dimensions (r,theta) and I am trying to display its contours on polar coordinates: This method basically 'wraps' the contours onto polar coordinates, which produces a discontinuity at 0°. I am looking for a way to…
0000011111
  • 133
  • 1
  • 9
0
votes
1 answer

Scilab: same colormap in contourf

When the following program is run, It becomes the same figure. I want the same…
yos
  • 3
  • 1
0
votes
1 answer

pyplot depicted range of colorbar

I have a problem creating a contourf-plot in python and setting the limits of the colorbar. I have set them in so far that the color scaling is correct, but only the part that is used is depicted. My code looks like this: import numpy as np import…
Mohammed Li
  • 823
  • 2
  • 7
  • 22
0
votes
1 answer

Different colours for maximum and minimum of data

I have data normalised beween 0 and 1 with continuous values inbetween. Is it possible to make a colour map to highlight one particular value? In this case, I want the max value of one to be a custom defined colour and the rest use a normal colour…
Michael
  • 129
  • 1
  • 8
0
votes
0 answers

How To Create A Custom Colorbar

I'm trying to customize a colorbar on a contoured image I am producing. I would like custom intervals with different colors between each interval. Below are a few lines of how I tried to generate such a colorbar but with no success.…
Ryan
  • 1
  • 2
0
votes
0 answers

matlab animation with multiple layers

I'm using contourf to generate a wave propagation animation. I'm coloring just one range in the matrix for each iteration of the for loop.I'm then animating the generating images as gif. When I add an image to to serve as background to my wave…
Ahmed Niri
  • 653
  • 1
  • 5
  • 11
0
votes
2 answers

How to setup step colorbar in matlab?

I want to change the default color bar (jet color) generated by Matlab, especially the step of the color (just like the figure below). How to do that? Here's my code [hC hC] =…
Eko Susilo
  • 250
  • 2
  • 15
0
votes
1 answer

Matplotlib: contourf rescales and axes wrong when I use X,Y

Full test Code as requested: import numpy as np import matplotlib.pyplot as plt # Numtopad determines number of padding points numtopad = 512 # Define axis x = np.arange(numtopad) y = x[:,np.newaxis] # Offsets which are zero x0 = 256*0 y0 =…
0
votes
0 answers

convert a scatter plot into a contour plot in matplotllib

I have the following scatter plot where I plotted using ALPHA=0.2 This allowed me to show areas with lower populations in a lighter shade and the higher ones (due to overlay) in a darker color. I plotted this in matplotlib using 2 1D (one…
Patrick
  • 41
  • 1
  • 5
0
votes
1 answer

MeshGrid for Triangle Elements

I want to build a contourf plot of a certain aspect in my Plate. The plate is divided in triangle elements, which I have the coordinates (x,y) of each knot of the triangle. So, How can I make a meshgrid for my knots so I can make my contourf plot??…
0
votes
1 answer

Volume under a contour surface in matlab

I am using contourf to generate a contour plot for a 2 variable function. My function is Z = f(x,y). I generate x and y through meshgrid function in matlab and generate values for Z and then plot the contour using contour(x,y,z). I want to be able…
Vignesh R
  • 53
  • 11