Kroepfl, Julia (julia.kroepfl@uni-graz.at)
2010-Jul-01 11:18 UTC
[R] possible to plot number line in R?
Hallo! Is there a possibility to plot a number line in R? I would like to display 3 different Intervals on the same number line. Ideally, it would be possible to add a name to each number (e.g. Interval 1, lower cut-off...and so on). I have not found a command for this. Thank you for your help. Julia [[alternative HTML version deleted]]
?segments Do provide an example of the data and what you what to do with it. On Thu, Jul 1, 2010 at 7:18 AM, Kroepfl, Julia (julia.kroepfl at uni-graz.at) <julia.kroepfl at uni-graz.at> wrote:> Hallo! > > Is there a possibility to plot a number line in R? > I would like to display 3 different Intervals on the same number line. Ideally, it would be possible to add a name to each number (e.g. Interval 1, lower cut-off...and so on). I have not found a command for this. > > Thank you for your help. > > Julia > > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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 > 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?
Here is a simple 'brute force' way to do it (assuming I understand what you want) =================================================================text1 <- "Interval 1" text2 <- "Inteval 2" text3 <- "Interval 3" ycord <- 3.3 plot(1:21, rep(3,21), type="l", xlab="Number Line", ylab="",yaxt="n") arrows(c(7.5,14.5),c(2.8,2.8), c(7.5,14.5),c(3.2,3.2), length=0) text(4, ycord, labels=text1, cex=.75) text(11, ycord, labels=text1, cex=.75) text(18, ycord, labels=text1, cex=.75) ===================================================================== --- On Thu, 7/1/10, Kroepfl, Julia (julia.kroepfl at uni-graz.at) <julia.kroepfl at uni-graz.at> wrote:> From: Kroepfl, Julia (julia.kroepfl at uni-graz.at) <julia.kroepfl at uni-graz.at> > Subject: [R] possible to plot number line in R? > To: "'r-help at r-project.org'" <r-help at r-project.org> > Received: Thursday, July 1, 2010, 7:18 AM > Hallo! > > Is there a possibility to plot a number line in R? > I would like to display 3 different Intervals on the same > number line. Ideally, it would be possible to add a name to > each number (e.g. Interval 1, lower cut-off...and so on). I > have not found a command for this. > > Thank you for your help. > > Julia > > > ??? [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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 > and provide commented, minimal, self-contained, > reproducible code. >
On 07/01/2010 09:18 PM, Kroepfl, Julia (julia.kroepfl at uni-graz.at) wrote:> Hallo! > > Is there a possibility to plot a number line in R? > I would like to display 3 different Intervals on the same number line. Ideally, it would be possible to add a name to each number (e.g. Interval 1, lower cut-off...and so on). I have not found a command for this. >Hi Julia, I had to do a tweak on the spread.labels function (attached). Try this: library(plotrix) source("spread.labels.R") plot(0:100,axes=FALSE,type="n",xlab="",ylab="") axis(1,pos=0) spread.labels(c(5,20,50,60,70,90),rep(0,6),ony=FALSE, labels=c("Bottom1","Top1","Bottom2","Top2","Bottom3","Top3"), offsets=rep(20,6)) Jim
Kroepfl, Julia (julia.kroepfl@uni-graz.at)
2010-Jul-02 08:40 UTC
[R] possible to plot number line in R?
Thank you very much for your answers, but I think I did not explain thoroughly enough what I needed. I attached a demo of the plot. I need the number line between 2 and 3, both values being shown on the line, interval values should be printed next to the dashes and lines should connect the intervals. Is this possible to do in R? Best Regards, Julia -------------- next part -------------- A non-text attachment was scrubbed... Name: Demo.PNG Type: image/png Size: 11078 bytes Desc: Demo.PNG URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100702/0330ea9b/attachment.png>