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

How to rotate each contourf contour differently matplotlib

I am wondering if it is possible to rotate each matplotlib contourf contour in my plot to a different angle. For example, the first plot I have is: and I want to rotate some of the contours based on an angle. I have attached a new sketch I made of…
MAJ
  • 437
  • 5
  • 17
2
votes
1 answer

Matplotlib plot contourf on 3d surface

I am trying to use the colormap feature of a 3d-surface plot in matplotlib to color the surface based on values from another array instead of the z-values. The surface plot is created and displayed as follows: import numpy as np import…
sunnytown
  • 1,844
  • 1
  • 6
  • 13
2
votes
1 answer

Is there a Matlab function to reproject rho and theta to projected lat lon?

I want to plot a map of rho(range) and theta(degrees) data around a center point at a map point of lat and long coordinates, where i later include basemaps, depth information and so on. Is there a matlab function already available for this problem,…
2
votes
1 answer

How do I combine multiple contour plots?

I am trying to combine multiple contourf plots into one, I managed to do this using alpha=0.5 but the fill element means that not all plots are visible. My code is: fig,ax = plt.subplots(figsize = (20,16)) b=ax.contourf(dfE,4,cmap='Greens',…
Haj Sai
  • 291
  • 3
  • 13
2
votes
1 answer

Basemap contourf inside multiple shapes

I am trying to plot interpolated weather data on a map only within the bounds of the towns contained in a shapefile. The following is the unclipped contourf over the Basemap with imported shapefile: Contourf overlaid on Basemap with Shapefile I have…
Stef Marais
  • 81
  • 1
  • 8
2
votes
2 answers

pyplot contourf with custom colormap repeats color instead of changing

I want to plot some data with a logarithmic color code where a decade limit is indicated by a white/black interface. Grey levels are used to show some subdivisions of a decade. My problem is that there are two white neighboring regions in each…
FraWa
  • 63
  • 10
2
votes
0 answers

Missing filled contours when using contourf

I am trying to plot plot a function over a 2D domain using contourf. Unfortunately, my first attempt did not work out very well. There was a region in the plot that was unexpectedly not covered by any contours. For debugging purposes, I have reduced…
Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174
2
votes
0 answers

How to make colorbar on Contourf in a semilog scale

So I'm creating contour plots of electric fields for some school work, and the variations are pretty extreme (1e-6 to 1e+8), and I want to show the contour in a logarithmic scale. The issue is that there are both positive and negative electric…
superspartan999
  • 191
  • 4
  • 14
2
votes
1 answer

Turn off white background around text labels for contour plot in Matlab

I have a contour plot to which I have added labels along the contour lines in Matlab. The labels have a white box around them that I would like to turn off. All matlab tutorials show their result with not background and when I check the background…
2
votes
1 answer

matplotlib tricontourf ploblem when I give more data point

I have got a problem when i try to plot the stress. import numpy as np import matplotlib.pyplot as plt import matplotlib.tri as mtri import matplotlib.cm as cm def plot(x_plot, y_plot, a_plot): x = np.array(x_plot) y = np.array(y_plot) …
YONG BAGJNS
  • 501
  • 2
  • 8
  • 21
2
votes
1 answer

Adding gridlines onto polar contour plot

I have the following code that produces the following image. How can I add polar gridlines? I would like to add 100, 200, 300, and 400. Note that the radius is 400. It might not look the best but I'd like to add them. Perhaps if this is possible,…
Jack
  • 307
  • 2
  • 13
2
votes
1 answer

Matplotlib contour lines are not closing up

I would need some help with my Matplotlib contour plots. The problem is, that the lines of my contour plot (shown beneath) are not closing up and that I have an image kind of cut in half. I am wondering if I can force Matplotlib to close the…
firefly2517
  • 115
  • 2
  • 15
2
votes
0 answers

Using extended color bar with logscale on pyplot

In the following example (modified from here) I get an error regarding the use of the extended keyword when using a log scale: import matplotlib.pyplot as plt import numpy as np from numpy import ma from matplotlib import colors, ticker, cm from…
TomCho
  • 3,204
  • 6
  • 32
  • 83
2
votes
1 answer

Changing Transparency of/Remove Contour Lines in Matplotlib

I am using contourf to plot some data but am having trouble when it comes to setting the transparency. I want to be able to set the transparency of both the fill AND the lines, but cannot seem to do this. A simplified version of my code is as…
tda
  • 2,045
  • 1
  • 17
  • 42
2
votes
1 answer

Overlay the data points which make-up a contour plot matrix on the same plot in MATLAB

Hope the title gave an adequate description of my problem. Basically, I am generating a contour plot in MATLAB using the contourf (x,y,z) function, where x and y are vectors of different lengths and z is a matrix of data with dimensions of x times…
Sanka
  • 177
  • 1
  • 4