John
2008-May-21 18:56 UTC
[R] Labeling a plot's x-axis with 12 strings, vertically oriented.
Hello, I really enjoy using R for my plotting. I have a modest plot, containing 24 data points, across 2 lines,12 points each. Ideally, the x-axis would be labeled with a series of strings, oriented vertically. Here is the R container holding the Search strings: > Search [1] Route To: NCENGR Status: Open CR Route To: NCENGR [3] Status: Cancel Route To: TEST1 Status: ENG REQ Route To: TDELLE [5] (*) Customer Name: * (*) Customer Name: S*IT* [7] (*) Customer Name: SMITH (*) Address: 1*** [9] (*) Address: 1** S**** ST Route To: NCS [11] Route To: NCS From Date: 01/01/2000 Name: SMITH 12 Levels: (*) Address: 1** S**** ST (*) Address: 1*** ... Status: Open CR Route To: NCENGR Is there a function to define the x-axis, using the above 12 strings as axis tick labels, from 1 - 12, vertically oriented? Any help would be appreciated, as my current work around is tedious, and not asthetically pleasing. Cheers, John
Greg Snow
2008-May-21 19:03 UTC
[R] Labeling a plot's x-axis with 12 strings, vertically oriented.
Here is one example:> y <- rnorm(12) > x <- 1:12 > > par(mar=c(10, 4, 4, 1)+0.1) > plot(x,y, xlab='', xaxt='n') > axis(1, at=x, labels=month.name, las=2) >See help on par and axis for details. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of John > Sent: Wednesday, May 21, 2008 12:56 PM > To: r-help at r-project.org > Subject: [R] Labeling a plot's x-axis with 12 strings, > vertically oriented. > > Hello, > > I really enjoy using R for my plotting. I have a modest plot, > containing > 24 data points, across 2 lines,12 points each. Ideally, the > x-axis would be labeled with a series of strings, oriented > vertically. Here is the R container holding the Search strings: > > > Search > [1] Route To: NCENGR > Status: Open > CR Route To: NCENGR > [3] Status: Cancel Route To: TEST1 Status: ENG REQ > Route To: TDELLE > [5] (*) Customer Name: * (*) > Customer Name: S*IT* > [7] (*) Customer Name: SMITH (*) Address: > 1*** > [9] (*) Address: 1** S**** ST Route To: > NCS > [11] Route To: NCS From Date: 01/01/2000 Name: > SMITH > 12 Levels: (*) Address: 1** S**** ST (*) Address: > 1*** ... Status: Open CR Route To: NCENGR > > > Is there a function to define the x-axis, using the above 12 > strings as axis tick labels, from 1 - 12, vertically > oriented? Any help would be appreciated, as my current work > around is tedious, and not asthetically pleasing. > > Cheers, > > John > > ______________________________________________ > 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. >
Duncan Murdoch
2008-May-21 19:11 UTC
[R] Labeling a plot's x-axis with 12 strings, vertically oriented.
On 5/21/2008 2:56 PM, John wrote:> Hello, > > I really enjoy using R for my plotting. I have a modest plot, containing > 24 data points, across 2 lines,12 points each. Ideally, the x-axis would > be labeled with a series of strings, oriented vertically. Here is the R > container holding the Search strings: > > > Search > [1] Route To: NCENGR Status: Open > CR Route To: NCENGR > [3] Status: Cancel Route To: TEST1 Status: ENG REQ > Route To: TDELLE > [5] (*) Customer Name: * (*) > Customer Name: S*IT* > [7] (*) Customer Name: SMITH (*) Address: > 1*** > [9] (*) Address: 1** S**** ST Route To: > NCS > [11] Route To: NCS From Date: 01/01/2000 Name: > SMITH > 12 Levels: (*) Address: 1** S**** ST (*) Address: > 1*** ... Status: Open CR Route To: NCENGR > > > Is there a function to define the x-axis, using the above 12 strings as > axis tick labels, from 1 - 12, vertically oriented? Any help would be > appreciated, as my current work around is tedious, and not asthetically > pleasing.plot(1:12, axes=F) axis(1, at=1:12, labels=c('one','two','three','four','five','six', 'seven', 'eight', 'nine','ten','eleven','twelve'), las=2) axis(2) box() You'll probably need bigger margins for your longer strings. Duncan Murdoch