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

How to use contourf (basemap-python) with a series of random lat/lon/value pairs that aren't spatially continuous

I have a data series (weather radar) that I am trying to plot with basemap in python. Plotting the raw data is easy; I use meshgrid with the lat/lon points, feed these 2-d data arrays into the first two parameters of contourf and put the data matrix…
WXMan
  • 310
  • 1
  • 12
3
votes
1 answer

How to make custom hatching range in matplotlib?

The Issue I have two 100x100 arrays- one with data (which I'll call array1) and one with some smaller, scaled data (which I'll call array2). I created a test array to see where array2 + array1 is above or below certain thresholds, and the results…
Cebbie
  • 1,741
  • 6
  • 23
  • 37
3
votes
0 answers

Matlab: Colorbar in GUIDE

I have been trying for a while to input a colorbar beside my contour maps in guide with no luck. axes(handles.firstcontouraxes); contourf(Y,X,z1) title('First population'); set(gca,'YDir',yinverse,'XDir',xinverse,'clim',[cmin cmax]); colorbar The…
Mosawi
  • 197
  • 2
  • 16
3
votes
1 answer

Meaning of cmap in contourf

I have two questions regarding usage of the contourf plotting function. I have been searching for answers but haven't found them. In the contourf function, there is a variable named cmap. What is this used for and what is its meaning? And what is…
inquiries
  • 385
  • 2
  • 7
  • 20
3
votes
1 answer

Removing the edge line on a contour plot

I used Matlab to create a polar coordinate and converted it into Cartesian coordinate. [th,r] = meshgrid((0:0.5:360)*pi/180,0:.02:1); [X,Y] = pol2cart(th,r); I get data on this mesh and produce a contourf plot over it. My problem is that I get a…
Bow
  • 445
  • 1
  • 6
  • 17
3
votes
1 answer

How to setup the 'renderer'?

I want to save a figure in EPS format with: saveas(gca, 'test.eps','epsc'); The figure is plotted with 'contourf' and a self-defined functions for plotting arrows. (I am using a package written by others, and I am not totally familiar with all of…
Eren
  • 159
  • 1
  • 12
2
votes
0 answers

Filling between to contour curves

By using ax.contour I plotted three contour curves and I would like to fill the under and or upper space of these curves with a specific color. Could you please let me know how I can do this? Here is the code for one of the curves and you can find…
2
votes
1 answer

sum distribution of points on 2d graph

I have a 10,000 2d points in a pytorch tensor. The points are between between -1 and 1. i.e. x ∈ {-1, 1}^2 I want to output a heat map to show the distribution of the points. In order to print the graph I am using matplotlib like…
Yedidya kfir
  • 1,419
  • 3
  • 17
  • 32
2
votes
1 answer

contourf plots with streamline numbers

I am trying to generate a contour plot with line numbers inside! I used plt.contourf to draw the contour plot and plt.clabel to draw the lines on my contour plot! The numbers in my plot are incorrect as shown in the figure! Contour plot with lines…
2
votes
1 answer

How to properly set labels in contourf subplots?

I am trying to get rid of these purple points on the picture below. Here is my code: p_values = [0., 0.05, 0.25, 0.5, 1, 1.5, 2, 5, 10, np.inf] xx, yy = np.meshgrid(np.linspace(-3, 3, num = 101), np.linspace(-3, 3, num =…
dmasny99
  • 21
  • 3
2
votes
1 answer

Spatial interpolation of discrete points onto x/y coordinate mesh grid in Python

I'm still very new to programming and trying to create a contour plot of alkalinity across Hawaii using Cartopy. I will need to interpolate the point values called MODIFIED_TA against an x-y mesh grid but have not been able to figure out how to do…
2
votes
1 answer

Ticks in colorbar of matplotlib (Python) are not positioned correctly when I add an arbitrary value

I have plotted a contourf (and contour to plot lines on top) graph with colorbar and equispaced data levels and it is ok. However, when I add an arbitrary level value(1.1 in the example), it is not representd correctly in the colorbar. In the…
user536696
  • 77
  • 5
2
votes
1 answer

Slices across Contourf plots at different angles to get 2D line plots

I am trying to generate 2D line plots at different angles or slices of a matplotlib contourf plot. As an example from the matplotlib contourf demo example below import numpy as np import matplotlib.pyplot as plt origin = 'lower' delta = 0.025 x =…
ssj
  • 35
  • 7
2
votes
1 answer

Problem adding features overlay to matplotlib plot after interpolation

I have to confess I still have problems understanding the proper setup and relation of the plots and the parts of it with matplotlib, is still confusing how fig with plt with ax relates each other so I just has gone trial and error, docs are…
neavilag
  • 609
  • 1
  • 8
  • 20
2
votes
1 answer

Crop extended marker in colorbar

I had to use extend='min' in using contourf to include coloring the values below my given range (negative values). I'd like to ask if how do I crop this extended marker (pointed by the arrow) import matplotlib.pyplot as plt fig =…
kiyas
  • 145
  • 10
1 2
3
24 25