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 to add hours onto Day of Year

I am working with oceanographic data in Python. I am currently trying to create a contour plot of time on the x axis, pressure on the y axis, and temperature as the contours. Right now I am trying to format the time array with values that I got from…
0
votes
0 answers

Is Matlab's contourf function not using all provided data?

I am trying to plot an uncomplete data set using the contourf function. A minimum working example of this is figure() hold on; scatter([1, 2, 3, 4, 5], [1, 1, 1, 1, 1]) scatter([1, 2, 3, 4, 5], [2, 2, 2, NaN, NaN]) scatter([1, 2, 3, 4, 5], [NaN,…
Axel
  • 1,415
  • 1
  • 16
  • 40
0
votes
1 answer

basemap & contourf, Python

I have a set of satellite data file here, I created a grid for lat & lon and a 2D array for Ozone values. I know that in order to plot the contourf of the data in a map I need the projection coordinates, but I can't get find a way around it as my…
0
votes
1 answer

Contourf plotting from spreadsheet columns in python

I want to plot a coloured contour graph with x,y,z from 3 columns of a comma delimited text file, but each time I try the code below, I get ValueError: too many values to unpack (expected 3) error. I would be grateful if that could be resolved. I…
Olatoye
  • 35
  • 7
0
votes
1 answer

Error while trying to Manage Contour levels?

Here is a code simulating the Electric Potential around two oppositely charged particles: clc; clear; close all; e_0 = 8.987E-9; % Coulomb's constant xy = [1,2.5; 4,2.5]; % particle coordinates. q…
Ziezi
  • 6,375
  • 3
  • 39
  • 49
0
votes
1 answer

Can't get my data plotted as countour map on basemap

I am trying to plot a global map of gas emission. However, it seems that I can't get my data (NH3idx) plotted on the amp. I don't know whether the translation from lat lon coordinates to map projection coordinates wrong or I cannot read the data…
0
votes
1 answer

Get a plot like spectrogram in MATLAB

I would like to get a plot of the same type of the one that I get with spectrogram function, I am trying with contour but I do not get the same result. I have written a small function which compares the two plot. The function records audio for one…
Nisba
  • 3,210
  • 2
  • 27
  • 46
0
votes
0 answers

plotting netCDF file with python: why do not visualize the contour?

I'm trying to produce a temperature colormap of a netcdf file with python. This is the first part of the code: from netCDF4 import Dataset import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap my_path =…
Mal
  • 63
  • 1
  • 9
0
votes
0 answers

Non-rectangular Arrays in Python x3

I am creating graphs in python's matplotlib using contourf and I want to know if there is anyway to set the size of the pixel size to create a "flexible" plot size. The program I am creating will have user generated data that could mean the matrix I…
Justin Jones
  • 361
  • 1
  • 3
  • 7
0
votes
1 answer

python define range of colormap

I made a contourplot and as default it sets eight different colors in the range of -150 to 250. But I want to increase the number of colors, so the resolution of the colorbar. I tried some things (for example like in the code sample below) but…
Leo
  • 113
  • 1
  • 4
  • 13
0
votes
1 answer

2D traveling wave with contourf() animation?

Hello I want to have python contour animation.for example Every second a wave will be born from the center and spread to the periphery. But I only want it with the level [0.0, 0.8] wave. The contour and color are OK, but the animation does not work…
Free_M_1
  • 3
  • 5
0
votes
1 answer

x-axis tick label for contourf plot using dates

I'm trying to create a time series contourf plot of some velocity/depth data I collected out at sea. The raw data is in a .mat format and I was able to read this into a pandas data frame and produce something really close to what I need, except for…
Christeanne
  • 5
  • 1
  • 6
0
votes
1 answer

how do i plot contourf given no relationship between X, Y and Z variables?

I have a dataset in which I would want to plot in matlab. The main dataset is the result of the differences between two angles (Øact - Øcalc) obtained from analytical and experimental results at specific analytical angles (Øact: 20, 30, 45, 60, 75,…
oma11
  • 55
  • 7
0
votes
1 answer

Polar plot in Matplotlib using contourf plots incorrect range

I'm plotting some hydrodynamical simulation data run in spherical coordinates and sometimes prefer to use contourf over pcolormesh because it looks nice and smooth instead of pixelated. However, I notice that contourf always extends my data to r=0…
trw
  • 3
  • 1
0
votes
1 answer

Reading meshgrid data from file in python

I have a file "data.dat" following data: [[0.2 0.3 0.4][0.3 0.2 0.4][0.5 0.3 0.4]] Now I am reading this data from file as f=open("data.dat","r") z=f.read() f.close() I have x=[1 2 3] & y=[1 2 3]. I made a meshgrid from x & y…