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
0 answers

Matplotlib scatter/contour hybrid plot

I am trying to create a countourplot with very sparse data, without interpolation. I would like to create something like this In other words, I would like to create a 'scatterplot/ countourplot hybrid'. Is this possible in matplotlib? If so how?…
coccolith
  • 47
  • 8
0
votes
0 answers

filled contour plot while overly on another image

I have an issue to display the filled contours while is overly on another image. Currently it display me the unfilled contours. any comment would appreciated. plt.imshow(t_image.detach().cpu().squeeze(),…
AI_NA
  • 336
  • 2
  • 5
  • 20
0
votes
1 answer

How to save contourf figure to image (.jpg) using matlab?

I want to save figure of contourf to image (.jpg). i tried using saveas(gcf, output, 'jpg') and the result is blank .jpg file. Can you help me so the plot contourf can saving in my computer? contourf(L, jml_level) colormap autumn figure This is…
0
votes
1 answer

How to create legend with proxy artist for contourf plot

I am trying to create a graphic where I overlay multiple contour plots on a single image. So I want to have colorbars for each of the plots, as well as a legend indicating what each contour represents. However Matplotlib will not allow me to create…
D. Lef
  • 239
  • 3
  • 13
0
votes
1 answer

Difference between matplotlib.countourf and matlab.contourf() - odd sharp edges in matplotlib

I am a recent migrant from Matlab to Python and have recently worked with Numpy and Matplotlib. I recoded one of my scripts from Matlab, which employs Matlab's contourf-function, into Python using matplotlib's corresponding contourf-function. I…
Jmgeon
  • 11
  • 3
0
votes
0 answers

Non-uniform label positioning in legend- contourf Python

I want to use a bigger scale to show my data! When I use: CS = plt.contourf(xi,yi,zi,vmin=6, vmax=9,cmap=plt.cm.jet) norm= matplotlib.colors.Normalize(vmin=CS.cvalues.min(), vmax=CS.cvalues.max()) the legend generated looks fine. (image1) (I know…
0
votes
1 answer

what's the difference between the colorbar of pcolor and contourf, considering a single colorbar in 2 different range subplots

I want to draw a figure of two subplots with one single colorbar. However, those two subplots are in different ranges. I tried to use contourf to make it, but failed. The colorbar of contourf always displays in the range of the last subplots, but…
Xu Shan
  • 175
  • 3
  • 11
0
votes
0 answers

Using manual explicit levels for overlay of tricontourf and scatter plot

I'm trying to overlay a scatter plot (showing observations) onto a filled contour plot (showing model data for the same variable) using exactly the same levels for mapping onto che colorscale. The main problem is that I'm not using the "common"…
Droid
  • 441
  • 1
  • 3
  • 18
0
votes
0 answers

issue of making a contour plot by matplotlib

I have an 11 x 11 data array and try to make a contour plot. fig3=plt.figure(3) contour_qe=plt.contourf(x_sqr,y_sqr,p_sqr,cmap=cm.coolwarm,shading='flat') fig3.colorbar(contour_qe,shrink=0.5,aspect=5) plt.show() the x_sqr, y_sqr and z_sqr are…
rfeynman
  • 97
  • 1
  • 9
0
votes
0 answers

basemap set_bad() for Nan values

I have tried to use numpy masked array and basemap module to plot raster data with no-data values. I defined a color map as cmap and then used cmap.set_bad(color='grey') to set no-data value to color gray. I then use contourf(...,cmap=cmap) to plot…
Tong Qiu
  • 123
  • 2
  • 10
0
votes
1 answer

Trouble plotting 2d contourf and 3d data using pd.DataFrames python

I am currently trying to produce a data viz of my experiment I did which involved xy scan files and then plotting them as a function of time. I have managed to get them into a pandas DataFrame that is (1027,281) in shape with the x axis as the…
h_god
  • 3
  • 4
0
votes
1 answer

How to fix the limits of color scale in matplotlib?

I am implementing a loop to produce contour plots using the function contourf in matplotlib. The objective of the study is to find out any moving patterns in the area. But, the plots produced are having different color scales. Some of them have -4…
navajyothmp
  • 85
  • 1
  • 11
0
votes
0 answers

add multiple colorbars to a subplot of polar contourf

My question is almost like this question. The difference is that i am wondering how to add the colorbar to each polar plot on a multiple contourf plot and not one for all the plots. I tried it this way : import numpy as np import matplotlib.pyplot…
0
votes
1 answer

How to specify rgb colors to contourf based on certain range of values

I have the following rgb color schema and a data array with the shape (500, 500), after each color there is the range of values in which a specific color should be used, so if one item of the array is lower than 5.0, I will use the 255 255 255…
i'mlaguiar
  • 21
  • 2
  • 7
0
votes
0 answers

How to increase the hatch density matplotlib?

I'm trying to increase the density of hatch marks I have for a map. This is how I'm currently doing it and I can't get anything to show up on my map when it should. I want to contour values less than 0.05 (sig p-valuea). And repeating the type of…
Alex Morrison
  • 149
  • 1
  • 13