Displaying 20 results from an estimated 8000 matches similar to: "area between two curves, but one is not continuous"
2008 Aug 15
6
continuous coloring of a polygon
R2.7.1, WinXP
Hi,
I have a polygon inside a circle as follows:
radius <- 3
x <- seq(-radius,radius,length=2000)
y <- sqrt(radius^2-x^2)
xx <- c(x,-x)
yy <- c(y,-y)
plot(xx,yy, xlim=c(-radius,radius),ylim=c(-radius,radius), type="l",
ylab="", xlab="", axes=F)
radius <- 2.7
x1 <- seq(-radius,radius,length=2000)
y1 <- sqrt(radius^2-x1^2)
2007 Oct 03
2
Shading area under density curves
Hello,
I have a question regarding shading regions under curves to display
95% confidence intervals. I generated bootstrap results for the slope
and intercept of a simple linear regression model using the following
code (borrowed from JJ Faraway 2005):
> attach(allposs.nine.d)
> x<-model.matrix(~log(d.dist,10))[,-1]
> bcoef<-matrix(0,1000,2)
> for(i in 1:1000){
+
2007 Aug 05
1
Selectively shading areas under two density curves
Dear Listers,
I am drawing a plot of two density curves, for male and female incomes. I would
like to shade/hatch/color (whatever) the areas under the curves which are
distinctive for each gender. This is the code I have tried so far:
m <- density(topmal.d$y, bw = "sj")
f <- density(topfem.d$y, bw = "sj")
par(mfrow = c(1,1))
plot(x = c(0,400), y = c(0,0.02), type =
2007 Mar 13
3
Highlight overlapping area between two curves
Dear R helpers,
I have a graph as following; I would like to highlight the overlapping area
between the two curves. Do you know how to do this?
Thank you in advance for your help.
Nguyen
###START
x1 <- rnorm(10000, 0.70,0.12)
x2 <- rnorm(10000, 0.90,0.12)
d1 <- density(x1)
d2 <- density(x2)
plot(range(d1$x,d2$x), range(d1$y, d2$y), type = "n",
xlab = "X
2007 Jun 25
3
How to shadow 'power' area?
Dear all,
Suppose I plot two normal distributions (A and B) side by side and add
vertical line which hipotheticaly represent alpha value; e.g.:
x <- seq(-3.5,5, length=1000)
y <- dnorm(x)
# Plot distribution A
plot(y~x, type='l',axes=F,xlab="",ylab="",lwd=2)
# Plot distribution B
y2 <- dnorm(x-1.5)
lines(y2~x,lwd=2)
# Plot vertical line for alpha value
2003 Jul 22
3
curves with shaded areas?
Hi,
I want to make a plot with abline where the area below or above the
curve is shaded. I can't find any documentation on that. Can anybody
help me with that?
thanks, Juffi
2007 Oct 29
1
shading of curves with polygon
Hello again
With the poylgon function it's possible to plot shaded areas under a curve.
But somehow it connects the start and the endpoint of a line and fills whats between them. I would actually like to set the boarders of the shading by two min and max curves, but I failed.
i tried stl like:
polygon(min, max, border=0), where min and max are my curves plotet by plot(max)
lines(min)
2010 Sep 06
1
calculating area between plot lines
Hi everyone. I have these data:
probClass<-seq(0,0.9,0.1)
prob1<-c(0.0070,0.0911,0.1973,0.2949,0.3936,0.5030,0.5985,0.6869,0.7820,0.8822)
prob2<-c(0.0066,0.0791,0.2358,0.3478,0.3714,0.3860,0.6667,0.6400,0.7000,1.0000)
# which I'm plotting as follows:
plot(probClass,prob1,xlim=c(0,1),ylim=c(0,1),xaxs='i',yaxs='i',type="n")
lines(probClass,prob1)
2009 Dec 15
1
shading between to curves that intersect repeatedly
Dear R-Community,
I have the following problem and was wondering whether someone could help
me out. I have a number of time series of discharge (up to 3000 data
points in some cases) which I would like to compare on the same line plot
by shading the area between some of them. Can anyone tell me how to do
that? I have tried to fiddle around with the polygon function, but the
curves interact a
2007 Sep 26
1
Area of overlap between polygon and circle
R-listers,
Given a polygon and a circle defined by its center coordinates and a
radius, I would like to calculate the area of overlap. I know that I
can create a polygon from the circle and then use available packages to
get the area of the intersection. However, because the polygon is of a
fixed size and I will be doing this for circles of varying sizes, I'm
concerned about
2008 Feb 25
1
color area between two time-series via polygon()?
Hi all,
I would like to color the area between two time-series. I tried it by
using the polygon() function but I keeps drawing lines between beginning
and end points.
Is there another more appropriate function or how could I close the
polygon at the end en the beginning of the time series (e.g., drawing a
straight line)?
The following doesn't plot a polygon between the two
2013 Sep 19
3
How do I ensure that the polygon in spatstat::owin(poly=<polygon>) does not have “negative area”
I am a new user of the R spatstat package and am having problems creating a
polygonal observation window with owin(). Code follows:
library("maps")
library ("sp")`
library("spatstat")
mass.map <- map("state", "massachusetts:main", fill=T) # This returns
a data frame includding x and y components that form a polygon of
massachusetts mainland`
2008 Jul 08
1
shading an area in a edf
Hi,
I've got the following edf:
***
x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
F2.5 <- ecdf(x)
plot(F2.5,
verticals= TRUE,
do.p = TRUE,
lwd=3,
ylab = "",
xlab = "",
xlim = c(1,5.5))
abline(h= (0:5)*0.2)
#mean
abline(v=mean(x), lwd=2)
mtext(text=expression(bar(x) == 3.07), side=1, adj=0.462, padj=3, cex=1)
***
Now I would like to
2009 Mar 10
2
How to color certain area under curve
For a given random variable rv, for instance, rv = rnorm(1000),
I plot its density curve and calculate some quantiles:
plot(density(rv))
P10P50P90 = = quantile(rv,probs = c(10,50,90)/100)
I would like to color the area between P10 and P90 and under the curve
and mark the P50 on the curve.
> rv = rnorm(1000)
> plot(density(rv))
> P10P50P90 = = quantile(rv,probs = c(10,50,90)/100)
Could
2007 Sep 13
4
how to plot shaded area under a curve?
say, I am plotting
x=seq(0,5,len=100)
y=-(x-5)^2
plot(x,y)
how can I put some color or verticle lines below the plotted curve?
[[alternative HTML version deleted]]
2010 Sep 22
1
Multiple Lorenz curves in one diagram
Hi group,
I would like to draw multiple Lorenz curves in a single plot using
data already prepared. Here is a simple example:
require("lawstat")
lorenz.curve(c(1,2,3),c(4,5,4))
lorenz.curve(c(1,2,3),c(4,2,1))
This example draws two separate graphs. How can I combine them in a
distinguishable way? I tried ?polygon without success...
Ralf
2012 Aug 02
6
Polygon shaded area
Hi all,
I have two vectors (columns) called "efinal" and "efinal 2".
I want to plot them on the same plot and "draw" a shaded area beween the
two lines using function polygon
I have tried all but I don ?t understand the polygon area, can you help me
with examples?
plot(efinal,type="l",ylim=range(min(efinal2),
2006 Oct 23
1
calculate area of outer polygon
Dear all,
Does anyone know of a function that calculates the area of the outer
polygon constructed from a data frame with co-ordinates? For example,
library(splancs)
test = rbind(c(0,0), c(10,0),c(10,10),c(0,20))
plot(test)
areapl(test)
[1] 150
This is OK, but I want the same area to be returned (150) when adding
yet another co-ordinate in the middle of the polygon:
test = rbind(c(0,0),
2008 Feb 12
2
shaded area graph and extra plot
R-help,
I'm using the code below to plot a shaded area graph.
At the same time I want to plot a second series on the y-axis (from
par(new=T) on)
but as the two series have different x-axis range (first 1994:2007 and
second 1996:2007)
the corresponding x's do not match.
How can this be sorted out?
Thanks in advance
#############################################
plot.new()
2010 Aug 15
2
Adding colored background area to a time series plot
Hi,
I am trying to add a rectangular colored background area to a plot of a time series of relative price changes. I believe that what I'm trying to do is very similar to the question and example given here:
http://www.mail-archive.com/r-help at stat.math.ethz.ch/msg73948.html
http://www.mayin.org/ajayshah/KB/R/html/g5.html
My problem/difference is that my time series looks like so:
>