Re: [R] bar plot add space to group data
August 17, 2018 10:24 PM, "Rolf Turner" wrote: > On 18/08/18 02:37, David L Carlson wrote: > >> Notice below that your message is substantially scrambled. R-Help is a >> plain text only list so you should set your email client to produce plain >> text messages. Apologies, forgot to change the default settings of the web-mail. > > If one struggles through the garbled html bumff, one sees that the OP *did* > indeed use the "space=" > argument. However it does not appear to have had the desired effect, and I > cannot see why. Since > the OP did not supply the data, I cannot experiment. > csv data below: year,grade,percentage 2014,A*,9 2014,A,23 2014,B,27 2014,C,19 2014,D,13 2014,E,7 2014,U,2 2015,A*,9 2015,A,23 2015,B,27 2015,C,19 2015,D,13 2015,E,7 2015,U,2 2016,A*,8 2016,A,23 2016,B,27 2016,C,19 2016,D,13 2016,E,7 2016,U,3 2017,A*,8 2017,A,23 2017,B,24 2017,C,20 2017,D,14 2017,E,8 2017,U,3 2018,A*,8 2018,A,22 2018,B,23 2018,C,20 2018,D,15 2018,E,8 2018,U,3 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] bar plot add space to group data
Hi citc, Try this: geac<-matrix(c(9,9,8,8,8,23,23,23,23,22,27,27,27,25,24, 19,19,19,20,20,17,17,17,18,19,8,8,8,9,9,2,2,3,3,3),ncol=5,byrow=TRUE) library(plotrix) barp(geac,names.arg=2014:2018,main="A level grades chemistry", xlab="Year",ylab="Percentage of each grade",ylim=c(0,30), col=c("white","lightblue","blue","orange","green","red","pink")) Jim On Fri, Aug 17, 2018 at 9:55 PM, wrote: > R-users, > > Can someone please advise how to improve the code below that was used to > produce the graph shown at the following hyperlink > (https://chemistryinthecity.neocities.org/content/entry1808.html#17)? The > request is to add space between the annual data groups. > > barplot(gceac[,3], xlab='year', ylab='percentage of each grade', > col=c('aliceblue', 'aquamarine', 'blue', 'chocolate', 'darkgreen', > 'firebrick', 'violet'), legend=gceac[1:7,2], args.legend = list(x = 40, y = > 30, title='grades'), main='A-level grades, chemistry', beside=T, > space=c(0,2), ylim=c(0,30)) > years<-c(2014,2015,2016,2017,2018) > mtext(years, side=1, at=c(5, 12, 19, 26, 33)) > R-users, Can someone please advise how to improve the code below that was > used to produce the graph shown at the following hyperlink > (https://chemistryinthecity.neocities.org/content/entry1808.html#17)? The > request is to add space between the annual data groups. barplot(gceac[,3], > xlab='year', ylab='percentage of each grade', col=c('aliceblue', > 'aquamarine', 'blue', 'chocolate', 'darkgreen', 'firebrick', 'violet'), > legend=gceac[1:7,2], args.legend = list(x = 40, y = 30, title='grades'), > main='A-level grades, chemistry', beside=T, space=c(0,2), ylim=c(0,30)) > years<-c(2014,2015,2016,2017,2018) mtext(years, side=1, at=c(5, 12, 19, 26, > 33)) > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] bar plot add space to group data
On 18/08/18 02:37, David L Carlson wrote: Notice below that your message is substantially scrambled. R-Help is a plain text only list so you should set your email client to produce plain text messages. The best place to start is with the manual page for the barplot() function: ?barplot or help(barplot) You will find the description of the space= argument useful. If one struggles through the garbled html bumff, one sees that the OP *did* indeed use the "space=" argument. However it does not appear to have had the desired effect, and I cannot see why. Since the OP did not supply the data, I cannot experiment. Perhaps someone else will have some insight. cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] bar plot add space to group data
Notice below that your message is substantially scrambled. R-Help is a plain text only list so you should set your email client to produce plain text messages. The best place to start is with the manual page for the barplot() function: ?barplot or help(barplot) You will find the description of the space= argument useful. David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of c...@disroot.org Sent: Friday, August 17, 2018 6:56 AM To: r-help@r-project.org Subject: [R] bar plot add space to group data R-users, Can someone please advise how to improve the code below that was used to produce the graph shown at the following hyperlink (https://chemistryinthecity.neocities.org/content/entry1808.html#17)? The request is to add space between the annual data groups. barplot(gceac[,3], xlab='year', ylab='percentage of each grade', col=c('aliceblue', 'aquamarine', 'blue', 'chocolate', 'darkgreen', 'firebrick', 'violet'), legend=gceac[1:7,2], args.legend = list(x = 40, y = 30, title='grades'), main='A-level grades, chemistry', beside=T, space=c(0,2), ylim=c(0,30)) years<-c(2014,2015,2016,2017,2018) mtext(years, side=1, at=c(5, 12, 19, 26, 33)) R-users, Can someone please advise how to improve the code below that was used to produce the graph shown at the following hyperlink (https://chemistryinthecity.neocities.org/content/entry1808.html#17)? The request is to add space between the annual data groups. barplot(gceac[,3], xlab='year', ylab='percentage of each grade', col=c('aliceblue', 'aquamarine', 'blue', 'chocolate', 'darkgreen', 'firebrick', 'violet'), legend=gceac[1:7,2], args.legend = list(x = 40, y = 30, title='grades'), main='A-level grades, chemistry', beside=T, space=c(0,2), ylim=c(0,30)) years<-c(2014,2015,2016,2017,2018) mtext(years, side=1, at=c(5, 12, 19, 26, 33)) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] bar plot add space to group data
Using the lattice package would provide an easy way to distinguish years, by putting them in different panels. Lattice would also help avoid some other features of this graph that, in my opinion, are suboptimal. See Tufte or Cleveland. Chris Ryan -- Sent from my Android device with K-9 Mail. Please excuse my brevity. On August 17, 2018 7:55:43 AM EDT, c...@disroot.org wrote: >R-users, > >Can someone please advise how to improve the code below that was used >to produce the graph shown at the following hyperlink >(https://chemistryinthecity.neocities.org/content/entry1808.html#17)? >The request is to add space between the annual data groups. > >barplot(gceac[,3], xlab='year', ylab='percentage of each grade', >col=c('aliceblue', 'aquamarine', 'blue', 'chocolate', 'darkgreen', >'firebrick', 'violet'), legend=gceac[1:7,2], args.legend = list(x = 40, >y = 30, title='grades'), main='A-level grades, chemistry', beside=T, >space=c(0,2), ylim=c(0,30)) >years<-c(2014,2015,2016,2017,2018) >mtext(years, side=1, at=c(5, 12, 19, 26, 33)) >R-users, Can someone please advise how to improve the code below that >was used to produce the graph shown at the following hyperlink >(https://chemistryinthecity.neocities.org/content/entry1808.html#17)? >The request is to add space between the annual data groups. >barplot(gceac[,3], xlab='year', ylab='percentage of each grade', >col=c('aliceblue', 'aquamarine', 'blue', 'chocolate', 'darkgreen', >'firebrick', 'violet'), legend=gceac[1:7,2], args.legend = list(x = 40, >y = 30, title='grades'), main='A-level grades, chemistry', beside=T, >space=c(0,2), ylim=c(0,30)) years<-c(2014,2015,2016,2017,2018) >mtext(years, side=1, at=c(5, 12, 19, 26, 33)) > > [[alternative HTML version deleted]] > >__ >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >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. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
[R] bar plot add space to group data
R-users, Can someone please advise how to improve the code below that was used to produce the graph shown at the following hyperlink (https://chemistryinthecity.neocities.org/content/entry1808.html#17)? The request is to add space between the annual data groups. barplot(gceac[,3], xlab='year', ylab='percentage of each grade', col=c('aliceblue', 'aquamarine', 'blue', 'chocolate', 'darkgreen', 'firebrick', 'violet'), legend=gceac[1:7,2], args.legend = list(x = 40, y = 30, title='grades'), main='A-level grades, chemistry', beside=T, space=c(0,2), ylim=c(0,30)) years<-c(2014,2015,2016,2017,2018) mtext(years, side=1, at=c(5, 12, 19, 26, 33)) R-users, Can someone please advise how to improve the code below that was used to produce the graph shown at the following hyperlink (https://chemistryinthecity.neocities.org/content/entry1808.html#17)? The request is to add space between the annual data groups. barplot(gceac[,3], xlab='year', ylab='percentage of each grade', col=c('aliceblue', 'aquamarine', 'blue', 'chocolate', 'darkgreen', 'firebrick', 'violet'), legend=gceac[1:7,2], args.legend = list(x = 40, y = 30, title='grades'), main='A-level grades, chemistry', beside=T, space=c(0,2), ylim=c(0,30)) years<-c(2014,2015,2016,2017,2018) mtext(years, side=1, at=c(5, 12, 19, 26, 33)) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.