a simple approach is to use NAs, i.e.,
x <- seq(0,4*pi,by=0.1) y <- sin(x) ########## x. <- x; x.[!abs(y) < 0.5] <- NA y. <- y; y.[!abs(y) < 0.5] <- NA
plot(x., y., type="l")
I hope it helps.
Best, Dimitris
---- Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
----- Original Message ----- From: "Joakim Hove" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, January 25, 2005 2:57 PM
Subject: [R] Plotting only masked part of data
Hello,
I have x and y data to plot (synthetic example):
x <- seq(0,4*pi,by=0.1) y <- sin(x)
I then want to plot (x,y) in those points where abs(y) is smaller than
0.5. As a first approximation
plot(x[abs(y) < 0.5],y[abs(y) < 0.5])
is quite close - however I want to plot with lines, i.e. type="l", and
then I get solid lines connecting the endpoint of one "active" region
to the start of the next active region, I would prefer to get rid of
those.
Lineart: -------
_____ ____ / (1) \ / (3)\ / \ / \ / \ / \ \ / \ \_____/ (2)
The problem is the horisontal lines shown as (1), (2) and (3) in the schematic figure above, I would like to get rid of those, i.e. retaining only four disconnected segments. I have started on a programming based solution, plotting one piece at a time, but it is *very* ugly!
Is there a simple general solution to my problem?
Regards
Joakim Hove
-- Joakim Hove hove AT ift uib no Tlf: +47 (55 5)8 27 90 Fax: +47 (55 5)8 94 40 http://www.ift.uib.no/~hove/
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
