Hi All I have data like this tom randy mike dan doug height 150 152 155 134 141 I am trying to create a line plot, with names on X-axis and height measure on Y. how can i get it through R. I could get several versions which are close (dotchart, bargraph), but not quite the same thing. I am looking for something like http://www.statsoft.com/Portals/0/blog/line_plot.jpg with option to add more lines, such as weight measurement for above data. Thanks, A [[alternative HTML version deleted]]
dat<-c(150,152,155,134,141) plot(dat,type="o",ylim=c(100,160),xlab="Names",ylab="Height") On Thu, Feb 17, 2011 at 7:45 PM, world peace <buysellrentoffer at gmail.com> wrote:> Hi All > > I have data like this > > ? ? ? ? ? ? ?tom ? randy mike dan doug > height ? ? ? 150 ? 152 ? ? 155 ?134 141 > > I am trying to create a line plot, with names on X-axis and height measure > on Y. how can i get it through R. > I could get several versions which are close (dotchart, bargraph), but not > quite the same thing. > > I am looking for something like > http://www.statsoft.com/Portals/0/blog/line_plot.jpg > with option to add more lines, such as weight measurement for above data. > > Thanks, > A > > ? ? ? ?[[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. >
The reason that it's easy to produce dotcharts or barplots in R with data like yours, and difficult to produce a line plot, is because dotcharts and barplots are appropriate for your data, whereas a line plot is not. Since the values on the x-axis represent names, and those names are not measured on any kind of ordinal scale, connecting the points on a plot would be at best meaningless and at worst deceptive. Of course, one of R's charms is that it provides ample rope to hang yourself it that's what you really want to do. You could create a line plot with a custom axis labeled in what ever way you want, to produce a whatever sort of plot you wanted. I'll leave it to you to figure out the details. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spector at stat.berkeley.edu On Thu, 17 Feb 2011, world peace wrote:> Hi All > > I have data like this > > tom randy mike dan doug > height 150 152 155 134 141 > > I am trying to create a line plot, with names on X-axis and height measure > on Y. how can i get it through R. > I could get several versions which are close (dotchart, bargraph), but not > quite the same thing. > > I am looking for something like > http://www.statsoft.com/Portals/0/blog/line_plot.jpg > with option to add more lines, such as weight measurement for above data. > > Thanks, > A > > [[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. >