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 update subplot's colorbar during animation?

Below is my exemplary animation with sub-plots. I have two colorbars: local and global. I found a way to update the global colorbar during animation. However, I can't find a way to update the local one. In the current implementation, in every…
kauerbach
  • 1
  • 1
0
votes
1 answer

plot sea ice concentration in color map white

I have an nc file with lat, lon and ice_conc. I wish to plot the sea ice concentration on a square grid (which the script does) in shades of white instead of yellow and have the open ocean in blue. Here's what I…
Bacol
  • 3
  • 2
0
votes
0 answers

Matlab - How to get rid of edge artifact appearing around contour plot

I am facing a problem with the contourf function. Here is my code, which is part of a gui (hence the handles): contourLevels = (1:0.5:60); axes(handles.firstcontouraxes); contourf(Y,fliplr(X),z1, contourLevels,'edgecolor','none'); axis…
Mosawi
  • 197
  • 2
  • 16
0
votes
0 answers

make plotting contour and colormesh from array

I am undergraduate students and want to make visualization from data. I am beginner in python. and i want to make the def tempp(self) and def prss(self) using contourf but it says: Traceback (most recent call last): File "C:\Program…
AvadEuros
  • 1
  • 2
0
votes
1 answer

Setting min/max for contourf and the legend

I am trying to set the min/max values of a contour but for some reason, this code only modifies the color but not the legend itself. What might I be doing wrong? import matplotlib.pyplot as plt import numpy as np import pandas as pd x =…
wiggles8x0
  • 17
  • 6
0
votes
1 answer

Unusual reshape of numpy array

I am trying to render geophysics section with contourf map in matplotlib. I almost get desired result with only one exception, it renders from the bottom left corner. Rendered geophysics section As it is section from surface, so 0 is a surface…
Geolimber
  • 113
  • 1
  • 7
0
votes
0 answers

Two dimensional distribution with contour plotting with Gaussian smoothing

I am trying to plot Two-dimensional distribution with Gaussian smoothing for all the data points. Here is my sample data. I would like to plot like this paper figure. [Two-dimensional distribution of Hα emitters(galaxies). The small circles…
John Singh
  • 79
  • 1
  • 2
  • 10
0
votes
0 answers

Adjust size of 2 contour maps to height of color bar

The topic is not new but up till now all the examples i saw are used for random data and it somehow works with ax.img. However, i couldnt manage to make my code work. I have tried this solution with ImageGrid but i'm not sure how to defined my…
Jung
  • 145
  • 6
0
votes
1 answer

What is the interpolation method of python matplotlib contourf

Maybe it's right before my eyes, but I fail to see it... Does anyone know what is the default interpolation method of python matplotlib contourf? Where can I find relative documentation? A secondary question is "can I change that method, and…
athakarag
  • 1
  • 1
0
votes
0 answers

How do I plot a contour from a table of values?

I have a table that has 2 features (x,y) - and a vector with the same length that contains their corresponding values (z). I'm trying to use matplotlib to print this as a 2D plot but I am get an error: TypeError: Input z must be at least a (2, 2)…
Guy
  • 155
  • 11
0
votes
1 answer

Matplotlib: Change contour/contourf plot levels after plotting

I'm looking for a method to change the levels of a matplotlib contour/contourf plot after it has been plotted, in a way that is similar to the Axes.set_xlim() or Axes.set_xticks() methods for example. Does anything like this exist? Thanks fig =…
Alan
  • 9
  • 1
0
votes
1 answer

Python: Plotting a regular grid of data in a latitude longitude grid

I have a grid of data points with a value of latitude/longitude for each row/column. I want to plot this to give a nice looking map. How do I go about this? I have tried converting the latitude/longitude row/column 'titles' to cartesian but cant get…
MGedney
  • 25
  • 1
  • 1
  • 6
0
votes
1 answer

reshaping 3 column numpy array

i have the following numpy array extracted from a dataframe that i want to reshape Extraction x = c_df['x'].values y = c_df['y'].values z = c_df['z'].values convert to array x_y_z = np.array([x, y, z]) x_y_z Array looks like…
0
votes
1 answer

how to animate over time properly. static background map (cartopy) + dynamic contourf + dynamic title

I'm stuck trying to create an animation of a contourf representation of concentration over a map, the main code I've been using is: tiler = Stamen('terrain-background') fig, ax =…
Grmn
  • 65
  • 7
0
votes
2 answers

3D wireframe plot with 2D projections: Spatial organiszation & frequency of projection

I'm working on a 3D plot displayed by a wireframe, where 2D plots are projected on the x, y, and z surface, respectively. Below you can find a minimum example. I have 2 questions: With contourf, the 2D plots for every x=10, x=20,... or y=10,…