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

matplotlib contourf with extreme values

I have data I want to plot with extreme edge values, given below is a generic example: import matplotlib.pyplot as plt plt.style.use('seaborn-white') import numpy as np Z = np.random.rand(100,100) plt.contourf(Z, 100, cmap='RdGy', vmin=0,…
erap129
  • 910
  • 1
  • 8
  • 17
0
votes
1 answer

Smooth Contourf plot completely filled

I have the data with (X,Y,Z) values. I tried to make a density plot with Z values for intensity. However the plot I get is not smooth and and has polytope i.e not completely filled. The following is the code with the Data but I want to obtain smooth…
gfdsal
  • 651
  • 1
  • 8
  • 25
0
votes
1 answer

2D Density Plot with X Y Z data

I am trying to plot 2d terrain map with x,y and z (elevation). I followed the steps from the following link but I am getting very weird plot. Python : 2d contour plot from 3 lists : x, y and rho? I spent almost half day searching but got nowhere.…
gfdsal
  • 651
  • 1
  • 8
  • 25
0
votes
1 answer

How to make a Heatmap plot with log scale x axis

I have the following heatmap plot using contourf(): inclination = np.pi/6 def power(inclination,phi): h1=1.7 h2=0.5 D = np.arange(0.5, 12.0, 0.015) r = np.sqrt((h1-h2)**2 + D**2) freq = 865.7 lmb = 300/freq H =…
user1993416
  • 698
  • 1
  • 9
  • 28
0
votes
0 answers

Matplotlib contourf - Input z must be at least a 2x2 array?

I am using contourf to plot 3 points. The x values are (.5, 1.25, 1.75) and the y values are (1,1,1). I have my 3 z points to go along with this. So, I made: xlist = [[.5], [1.25], [1.75] ] ylist = [[1], [1], [1] …
Evan
  • 1,892
  • 2
  • 19
  • 40
0
votes
0 answers

Is possible to create "Tanaka contours" by Matplotlib?

I need to create graph which will look like this example. Now I am using very similar solution by this code: plt.contourf(xi, yi, zi,15, cmap=plt.cm.Reds,alpha=0.5, vmin=0, vmax=0.1) plt.contour(xi, yi, zi, 15, colors='k',alpha=1, linewidths=0.4,…
Roman Šimr
  • 81
  • 1
  • 10
0
votes
1 answer

Can someone explain how contourf in matplotlib works?

So basically, I need to make a contour map of a surface - I understand that if I have a function I can do something like this: x = np.linspace(0, 2, 101) y = np.linspace(0, 2, 101) x, y = np.meshgrid(x, y) fig,ax2 =…
user11555039
0
votes
1 answer

Problems with contourf and levels

I need to divide each range the blue and the coffee in two colors each, In my code below I am specifying in the levels but the division is not fulfilled lon_0 = lons.mean() lat_0 = lats.mean() m =…
0
votes
1 answer

Plotting unordered points as a contourf in matplotlib

I have a list of dictionaries containing unordered data points: print(data) [{'ID': 1, 'Longitude': 18.6081, 'Latitude': 50.0977, 'Cost': -1.0}, {'ID': 2, 'Longitude': 18.6091, 'Latitude': 50.197700000000005, 'Cost': 4}, {'ID': 3, 'Longitude':…
Bill2462
  • 81
  • 10
0
votes
1 answer

Python matplotlib contourf plot

I have one questions about matplotlib and contourf. I am using the last version of matplotlib with python3.7. Basically I have to matrix I want to plot on the same contour plot but using different colormap. One important aspect is that, for…
jdeJuan
  • 145
  • 4
  • 13
0
votes
1 answer

Logarithmic colorbar and colorscale for contourg

I have developed the following MWE with data that spreads into two very different scales. I would like to make a contourplot which allows nicely visualising the data. from matplotlib import ticker import numpy as np import…
FenryrMKIII
  • 1,068
  • 1
  • 13
  • 30
0
votes
0 answers

Change x axis on 1D contour plot

I've got an array of values I want to plot on a 1D heatmap in mmatplotlib. I'm using contourf for this. My current code is this: x = np.empty([2,values.shape[0]]) x[:,:] = values ax1.contourf(x) This plots a colourmap but using the position of each…
TIF
  • 191
  • 1
  • 2
  • 11
0
votes
0 answers

How to contour a 2D element mesh in MATLAB?

I'm trying to contour the output for some solution of groundwater diffusion in 2D finite element triangular mesh. This is the code which I used: %% 3d Surface plot of Ground water Head tri= delaunay(x,y); trisurf(tri,x,y,h); title('Head…
0
votes
0 answers

Making high quality overlapping inequality plots in Matlab?

I need to make publication quality plots showing domains in parameter space bounded by various inequalities (f1(x,y)>0, f2(x,y)>0, ...) where some regions will satisfy several inequalities and should have blended flat colours. There are various…
0
votes
1 answer

How could I plot an array with conditions over a contour map?

I have plotted a global map of GPP using the code below: ( 'lon' and 'lat' are both netCDF4 attributes and have a shape of (144, ) and (90, ) respectively, whilst 'gpp_avg' is a numpy array with a shape of (90, 144) ) import numpy as np import…