contour

Plotting a function curve in R with 2 or more variables

对着背影说爱祢 提交于 2019-12-02 03:02:54
How can I draw a curve for a function like vpd = function(k,D){exp(-k*D)} in R? I want a plot of D vs vpd (0:1) assuming k is constant. The only question I could find was How to plot a function curve in R . I've tried both of: plot.function(vpd, from=0, to=1, n=101) curve(vpd, from=0, to=1, n=101, add=FALSE, type = "l") but only get Error in -k * D : 'D' is missing UPDATE: solved it! vpd <- function(D,k=0.05){exp(-k*D)} # D is the x axis plot(vpd, from=1, to=100, ylim=0:1) While Mamoun Benghezal's answer works for functions you define yourself, there may be cases where you want to plot a

Matlab 2D contour using X-Y coordinate data

你。 提交于 2019-12-02 02:44:27
I have a set of data that looks likes the following: !Sr.# x-coord. y-coord potential at (x,y) 1 0.0000 1.0000 0.3508 2 0.7071 0.7071 2.0806 . .... .... .... . .... .... .... 1000 0.0000 -1.0000 0.5688 I need to generate a 2D contour for the above data where the value of the potential will be plotted at the corresponding (x,y) location on the 2D contour map. I believe that in order to be able to plot a 2D contour using the contour command in Matlab, I will have to use a 2D matrix (which will essentially contain potential values in my case). How do I create a 2D matrix for this case? Or is

How to plot 4D contour lines (XYZ-V) in MATLAB?

人盡茶涼 提交于 2019-12-02 02:21:37
I have dataset of XYZ as the coordinates and V as the value at each point (100x4 matrix). I plot the 3D surface using patch. (by faces & vertices) How can I plot the contour lines of V (NOT Z) over the 3D surface !? ( The Contour3 function plots 3D contour lines of Z ; But I need contour lines of V. ) Actually I want something like this or this . Thanks a billion for your help. Well actually I found out that the isosurface command is exactly what I want. However, this command requires the V data to be a 3D matrix. But my V is a vector. And the data in it is completely non-uniform and irregular

Matlab 2D contour using X-Y coordinate data

杀马特。学长 韩版系。学妹 提交于 2019-12-02 02:10:59
问题 I have a set of data that looks likes the following: !Sr.# x-coord. y-coord potential at (x,y) 1 0.0000 1.0000 0.3508 2 0.7071 0.7071 2.0806 . .... .... .... . .... .... .... 1000 0.0000 -1.0000 0.5688 I need to generate a 2D contour for the above data where the value of the potential will be plotted at the corresponding (x,y) location on the 2D contour map. I believe that in order to be able to plot a 2D contour using the contour command in Matlab, I will have to use a 2D matrix (which will

Matlab - surf and contour3, clipping order?

那年仲夏 提交于 2019-12-02 01:29:25
I am plotting data as a surface in matlab. I have three data matrices, x,y,z. The values of z may not be outside the range 0~1. I generate plots with the following: surf(x,y,z); [c,h] = contour3(x,y,z,'LevelList',[0 : 0.1 : 1],'Color','k'); clabel(c,h,[0 : 0.1 : 1]); I also do some modifications to the surface, such as setting shading interp . As you can see, the result image clips the contours with the underlying surface. How can I ensure that the contour and labels are plotted above the surface? After some digging in the doc, I have found the best solution. The clipping order is specified at

Contour lines in ggplot2

喜欢而已 提交于 2019-12-01 22:15:31
问题 I am wondering how to change the scale of my contour lines using stat_contour in ggplot2. Right now I am using this bit of code (below) to make contour plot of PAR to 30m, but my plot only shows contour lines in the top 10m and only shows lines that go to a minimum value of 10^-5. However, I have z data for up to 30 m and which range from values from 4*10^-9 to 1.4*10^-3 . How do I get my contour lines to reflect this? require(ggplot2) library(directlabels) Depth<- c(0,0,0,0,0,0,0,0,0,0,0,0,0

Contour lines in ggplot2

為{幸葍}努か 提交于 2019-12-01 21:24:11
I am wondering how to change the scale of my contour lines using stat_contour in ggplot2. Right now I am using this bit of code (below) to make contour plot of PAR to 30m, but my plot only shows contour lines in the top 10m and only shows lines that go to a minimum value of 10^-5. However, I have z data for up to 30 m and which range from values from 4*10^-9 to 1.4*10^-3 . How do I get my contour lines to reflect this? require(ggplot2) library(directlabels) Depth<- c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4

Calculate the center of a contour/Area

倾然丶 夕夏残阳落幕 提交于 2019-12-01 21:03:11
问题 I'm working on a Image-processing chain that seperates a single object by color and contour and then calculates the y-position of this object. How do I calculate the center of a contour or area with OpenCV? Opencv links: http://opencv.willowgarage.com/wiki/ http://en.wikipedia.org/wiki/OpenCV 回答1: You can get the center of mass in the y direction by first calculating the Moments. Then the center of mass is given by yc = M01 / M00 , where M01 and M00 are fields in the structure returned by the

Calculate the center of a contour/Area

蓝咒 提交于 2019-12-01 18:46:58
I'm working on a Image-processing chain that seperates a single object by color and contour and then calculates the y-position of this object. How do I calculate the center of a contour or area with OpenCV? Opencv links: http://opencv.willowgarage.com/wiki/ http://en.wikipedia.org/wiki/OpenCV You can get the center of mass in the y direction by first calculating the Moments . Then the center of mass is given by yc = M01 / M00 , where M01 and M00 are fields in the structure returned by the Moments call. If you just want the center of the bounding rectangle, that is also easy to do with

OpenCV TypeError: contour is not a numpy array, neither a scalar

拜拜、爱过 提交于 2019-12-01 15:11:09
问题 I'm trying to use OpenCV to extract tags from Nike images. This is a tutorial code taken from: http://opencv-code.com/tutorials/ocr-ing-nikes-new-rsvp-program/ I've modified few lines of code though and there is no error in that part (not sure if it's working because I haven't been able to successfully completely run it.) When I run command 'python a.py'. This error is displayed:- Traceback (most recent call last): File "a.py", line 42, in <module> otcnt = [c for c in cnt if cv2.contourArea(c