Dear users, I'm trying to get a dot plot but always end up with a boxplot. Can someone please tell me what I am doing wrong? df <- structure(list(FACETTE = structure(c(1L, 1L, 1L, 1L, 2L, 2L, + 2L, 2L), .Label = c("base", "tip"), class = "factor"), Sq = c(274836, + 0.74182, 0.709205, 0.984552, 279869, 255712, 26566, 301464)), .Names = c("FACETTE", + "Sq"), class = "data.frame", row.names = c(1L, 2L, 3L, 4L, 6L, + 7L, 8L, 9L)) with(df, plot(Sq~FACETTE, type="p")) with(df, plot(Sq~FACETTE, type="n")) I get boxplots in both cases. What should I do to get points instead of boxes? Thanks in advance for your help, Ivan -- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Museum Abt. S?ugetiere Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 ivan.calandra at uni-hamburg.de ********** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php
On 26 April 2011 12:08, Ivan Calandra <ivan.calandra@uni-hamburg.de> wrote:> Dear users, > > I'm trying to get a dot plot but always end up with a boxplot. Can someone > please tell me what I am doing wrong? > > df <- structure(list(FACETTE = structure(c(1L, 1L, 1L, 1L, 2L, 2L, > + 2L, 2L), .Label = c("base", "tip"), class = "factor"), Sq = c(274836, > + 0.74182, 0.709205, 0.984552, 279869, 255712, 26566, 301464)), .Names > c("FACETTE", > + "Sq"), class = "data.frame", row.names = c(1L, 2L, 3L, 4L, 6L, > + 7L, 8L, 9L)) > > with(df, plot(Sq~FACETTE, type="p")) > with(df, plot(Sq~FACETTE, type="n")) > > I get boxplots in both cases. What should I do to get points instead of > boxes? > > Don't use a factor?with(df, plot(Sq~as.numeric(FACETTE), type="p")) works, but you then need to play a bit with the x axis to get the labels etc. right: with(df, plot(Sq~as.numeric(FACETTE), type="p", xaxt="n")) axis(1, c("base", "tip"), at=c(1,2)) Bob -- Bob O'Hara Biodiversity and Climate Research Centre Senckenberganlage 25 D-60325 Frankfurt am Main, Germany Tel: +49 69 798 40216 Mobile: +49 1515 888 5440 WWW: http://www.bik-f.de/root/index.php?page_id=219 Blog: http://blogs.nature.com/boboh Journal of Negative Results - EEB: www.jnr-eeb.org [[alternative HTML version deleted]]
On 2011-04-26 03:08, Ivan Calandra wrote:> Dear users, > > I'm trying to get a dot plot but always end up with a boxplot. Can > someone please tell me what I am doing wrong? > > df<- structure(list(FACETTE = structure(c(1L, 1L, 1L, 1L, 2L, 2L, > + 2L, 2L), .Label = c("base", "tip"), class = "factor"), Sq = c(274836, > + 0.74182, 0.709205, 0.984552, 279869, 255712, 26566, 301464)), .Names > c("FACETTE", > + "Sq"), class = "data.frame", row.names = c(1L, 2L, 3L, 4L, 6L, > + 7L, 8L, 9L)) > > with(df, plot(Sq~FACETTE, type="p")) > with(df, plot(Sq~FACETTE, type="n")) > > I get boxplots in both cases. What should I do to get points instead of > boxes? > > Thanks in advance for your help, > Ivan >Are you looking for stripchart()? Peter Ehlers