Matlab: Fill contour plot with contour lines


Dave

I am trying to create a filled contour plot from an image in MATLAB. However, the command imcontourdoesn't seem to have an option for filling the outline. If used contourf, it will draw all outlines black. Since the image has many outlines, it appears almost entirely in black.

Does anyone know how to do the padding imcontouror how to apply it to the image meaningfully contourf?

Suever

There is no padded version imcontourbecause, in theory, the image itself is a padded version.

data = load('clown');
img = ind2rgb(data.X, data.map);

imshow(img);
hold on
imcontour(img(:,:,1), 3);

enter image description here

contourfHowever, you can use and specify the line color . By specifying no value, 'none'no rows will be displayed.

c = contourf(data, 2, 'LineColor', 'none')

enter image description here

Related


Plot contour lines of a function in MATLAB

Tomer I want to use MATLAB to plot the height line of a function (represented by a matrix). I'm familiar with contours, but contours draw lines at equidistant heights, whereas I'd like to see lines drawn with constant distances (with height labels). This means

Matlab contour plot smooth color

lead Can you tell me how to draw the following figure (smooth transition of colors) in Matlab graphics? The function countouronly allows to create plots with contour lines, and contour lines do not give me enough information. Luis Mendo You can use it with a c

Contour plot in Matlab - always needed

lucky I am trying to draw contour plots in Matlab. However, the syntax seems to be correct, but since the matrix can be quite large, matlab takes a lot of time to plot it. Please suggest what should I do. Below is my code: s = 10000000; eta_gamma = zeros(s/100

legend fill contour plot

pier I'm trying to create a contour plot using fill.contour and I want to change the size of the legend title and labels as well as the size of the legend itself. I already have code for the data which is very similar to the volcano example (easier to reproduc

Fill matplotlib contour plot

Joan Carl Montero Jimenez With the following code, I get the following contour plot: fig, ax = plt.subplots() x = np.arange(431) y = np.arange(225) Y, X = np.meshgrid(y, x) values = df["Appearance_percentage"].values values2d = np.reshape(values, (431, 225)) a

Fill matplotlib contour plot

Joan Carl Montero Jimenez With the following code, I get the following contour plot: fig, ax = plt.subplots() x = np.arange(431) y = np.arange(225) Y, X = np.meshgrid(y, x) values = df["Appearance_percentage"].values values2d = np.reshape(values, (431, 225)) a

Plot contour lines of a function in MATLAB

Tomer I want to use MATLAB to plot the height line of a function (represented by a matrix). I'm familiar with contours, but contours draw lines at equidistant heights, whereas I'd like to see lines drawn with constant distances (with height labels). This means

How to fill contour lines using opencv?

Li Genmao For example, the center of this rectangle is the hole. (white per pixel value = 255, black value = 0) However, I want to fill this hole. (As shown below) How to fill holes by rectangle using OpenCV. drug First find its convex hull, then fill its inne

Add Lines to Contour Plot

Kutra I'm trying y=1to add a horizontal line and a vertical line to a x=1contour plot , how can I do that? My code looks like this: library(plotly) library("mvtnorm") cov=matrix(c(2,1,1,2),2,2) x1=seq(-4,4,by=0.1) x2=seq(-4,4,by=0.1) d<-expand.grid(x1,x2)

Matlab: Fill contour plot with contour lines

Dave I am trying to create a filled contour plot from an image in MATLAB. However, the command imcontourdoesn't seem to have an option for filling the outline. If used contourf, it will draw all outlines black. Since the image has many outlines, it appears alm

Smooth contour plot in Matlab

Delkov I want to draw smooth contour plot from XYZ matrix. sf = fit([X Y] Z, 'poly23'); plot(sf); I don't have enough smooth curves. What do I need? Chief Pavel Mestre You can use functions like griddata and csaps . Together they will lead you to the smoothin

Fill matplotlib contour plot

Joan Carl Montero Jimenez With the following code, I get the following contour plot: fig, ax = plt.subplots() x = np.arange(431) y = np.arange(225) Y, X = np.meshgrid(y, x) values = df["Appearance_percentage"].values values2d = np.reshape(values, (431, 225)) a

Contour plot with constant fill color between contour lines

or I also followed the example here to generate filled contour plots using gnuplot. The gnuplot command and output are: reset f(x,y)=sin(1.3*x)*cos(.9*y)+cos(.8*x)*sin(1.9*y)+cos(y*.2*x) set xrange [-5:5] set yrange [-5:5] set isosample 250, 250 set table 'tes

Contour plot in Matlab - always needed

lucky I am trying to draw contour plots in Matlab. However, the syntax seems to be correct, but since the matrix can be quite large, matlab takes a lot of time to plot it. Please suggest what should I do. Below is my code: s = 10000000; eta_gamma = zeros(s/100

Matlab contour plot smooth color

lead Can you tell me how to draw the following figure (smooth transition of colors) in Matlab graphics? The function countouronly allows to create plots with contour lines, and contour lines do not give me enough information. Luis Mendo You can use it with a c

Contour plot fails with Matlab

Badshah I am trying to make a contour plot using the following matlab code: x=linspace(-10,10); y=linspace(-10,10); [X,Y]=meshgrid(x,y); Z=X.^3-Y.^3; figure [c,h]=contour(X,Y,Z,[3]); clabel(c,h) This actually gives me the wrong picture: I don't really underst

Matlab: Fill contour plot with contour lines

Dave I am trying to create a filled contour plot from an image in MATLAB. However, the command imcontourdoesn't seem to have an option for filling the outline. If used contourf, it will draw all outlines black. Since the image has many outlines, it appears alm

Plot contour lines of a function in MATLAB

Tomer I want to use MATLAB to plot the height line of a function (represented by a matrix). I'm familiar with contours, but contours draw lines at equidistant heights, whereas I'd like to see lines drawn with constant distances (with height labels). This means

Fill matplotlib contour plot

Joan Carl Montero Jimenez With the following code, I get the following contour plot: fig, ax = plt.subplots() x = np.arange(431) y = np.arange(225) Y, X = np.meshgrid(y, x) values = df["Appearance_percentage"].values values2d = np.reshape(values, (431, 225)) a

How to fill contour lines using opencv?

Li Genmao For example, the center of this rectangle is the hole. (white per pixel value = 255, black value = 0) However, I want to fill this hole. (As shown below) How to fill holes by rectangle using OpenCV. drug First find its convex hull, then fill its inne

legend fill contour plot

pier I'm trying to create a contour plot using fill.contour and I want to change the size of the legend title and labels as well as the size of the legend itself. I already have code for the data which is very similar to the volcano example (easier to reproduc

Add Lines to Contour Plot

Kutra I'm trying y=1to add a horizontal line and a vertical line to a x=1contour plot , how can I do that? My code looks like this: library(plotly) library("mvtnorm") cov=matrix(c(2,1,1,2),2,2) x1=seq(-4,4,by=0.1) x2=seq(-4,4,by=0.1) d<-expand.grid(x1,x2)

How to fill contour lines using opencv?

Li Genmao For example, the center of this rectangle is the hole. (white per pixel value = 255, black value = 0) However, I want to fill this hole. (As shown below) How to fill holes by rectangle using OpenCV. drug First find its convex hull, then fill its inne

Fill matplotlib contour plot

Joan Carl Montero Jimenez With the following code, I get the following contour plot: fig, ax = plt.subplots() x = np.arange(431) y = np.arange(225) Y, X = np.meshgrid(y, x) values = df["Appearance_percentage"].values values2d = np.reshape(values, (431, 225)) a

Fill matplotlib contour plot

Joan Carl Montero Jimenez With the following code, I get the following contour plot: fig, ax = plt.subplots() x = np.arange(431) y = np.arange(225) Y, X = np.meshgrid(y, x) values = df["Appearance_percentage"].values values2d = np.reshape(values, (431, 225)) a

Smooth contour plot in Matlab

Delkov I want to draw smooth contour plot from XYZ matrix. sf = fit([X Y] Z, 'poly23'); plot(sf); I don't have enough smooth curves. What do I need? Chief Pavel Mestre You can use functions like griddata and csaps . Together they will lead you to the smoothin

Contour plot fails with Matlab

Badshah I am trying to make a contour plot using the following matlab code: x=linspace(-10,10); y=linspace(-10,10); [X,Y]=meshgrid(x,y); Z=X.^3-Y.^3; figure [c,h]=contour(X,Y,Z,[3]); clabel(c,h) This actually gives me the wrong picture: I don't really underst