Skip to content

possible to plot number line in R?

2 messages · Kroepfl, Julia (julia.kroepfl@uni-graz.at), Greg Snow

#
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>
5 days later
#
Here is some code to get you started:


plot.new()
plot.window( c(0,10), c(-1, 1) )

axis(1, at=0:10, pos=0)

lines( c(2,2,5,5), c( -0.25, -0.5, -0.5, -0.25 ) )
text( 3, -0.6, 'Interval 1' )  # the plotrix package has a function for text in a box

lines( c(3,3,6,6), c( 0.1, 0.3, 0.3, 0.1) )
text( 4.5, 0.4, 'Interval 2' )

lines( c(4,4,7,7), c( -0.4, -0.6, -0.6, -0.4 ) )
text( 5.5, -0.7, 'Interval 3' )


pieces could be placed in functions to automate the parts that you want.


hope this helps,