Dear R users, I need a produce a plot with a single panel and a few lines on it. Each line represents a different data set. The line types must be "h", i.e. ?histogram? like (or ?high-density?) vertical lines. The problem is that the vertical lines comprising a plot line of type="h" are drawn from the y=0 line to the (x, y) locations. What I need is vertical lines drawn from the line y="value that I specify" to the (x, y) locations. Is there a way for me to achieve that? Thank you very much for your responsiveness and attention. Regards, Martin
Create your own using 'segments'. On Sun, May 24, 2009 at 8:08 AM, Martin Ivanov <tramni@abv.bg> wrote:> Dear R users, > I need a produce a plot with a single panel and a few lines on it. Each > line represents a different data set. The line types must be "h", i.e. > ‘histogram’ like (or ‘high-density’) vertical lines. The problem is that the > vertical lines comprising a plot line of type="h" are drawn from the y=0 > line to the (x, y) locations. What I need is vertical lines drawn from the > line y="value that I specify" to the (x, y) locations. Is there a way for me > to achieve that? > > Thank you very much for your responsiveness and attention. > > Regards, > Martin > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]]
Martin Ivanov wrote:> Dear R users, > I need a produce a plot with a single panel and a few lines on it. Each line represents a different data set. The line types must be "h", i.e. ?histogram? like (or ?high-density?) vertical lines. The problem is that the vertical lines comprising a plot line of type="h" are drawn from the y=0 line to the (x, y) locations. What I need is vertical lines drawn from the line y="value that I specify" to the (x, y) locations. Is there a way for me to achieve that? > >Hi Martin, If you want a constant "value that you specify", you can just use the "clip" function: plot(x,y,type="n",...) xylim<-par("usr") clip(xylim[1],xylim[2],"value that I specify",xylim[4]) points(x,y,type="h") If you want different "values that you specify", I defer to the other Jim. Jim