[R] Put short string labels vertically near tick marks on bottom axis

Frede Aakmann Tøgersen frtog at vestas.com
Wed May 14 13:48:55 CEST 2014


So the error you get when trying to install the plotrix package says:

Error in install.packages(plotrix) : object 'plotrix' not found

So install.packages thinks that you provided an R object as an argument. But the object cannot be founded.

Did you then read ?install.packages to see what types of argument you need to provide to that function?


     install.packages(pkgs, lib, repos = getOption("repos"),
                      contriburl = contrib.url(repos, type),
                      method, available = NULL, destdir = NULL,
                      dependencies = NA, type = getOption("pkgType"),
                      configure.args = getOption("configure.args"),
                      configure.vars = getOption("configure.vars"),
                      clean = FALSE, Ncpus = getOption("Ncpus", 1L),
                      verbose = getOption("verbose"),
                      libs_only = FALSE, INSTALL_opts, quiet = FALSE,
                      keep_outputs = FALSE, ...)
     
Arguments:

    pkgs: character vector of the names of packages whose current
          versions should be downloaded from the repositories.

So the first argument to install.packages() should be a string or a vector of strings. In the first case you install one package, in the latter you install a list of packages.

So you will probably get plotrix installed if you do

install.packages("plotrix") 

Or 

install.packages('plotrix')

 

Yours sincerely / Med venlig hilsen


Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling

Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
frtog at vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender. 


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Hurr
> Sent: 14. maj 2014 13:37
> To: r-help at r-project.org
> Subject: Re: [R] Put short string labels vertically near tick marks on bottom
> axis
> 
> Ok, I want to try to avoid the miscommunications that
> you all seem to think I cause.
> The following code works now because
> I use the single apostrophe-type of quote.
> It gives the the horLabels at the bottom.
> 
> horAxisLims=c(0,7200)
> verData=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,612
> 8,6564,7000)
> #not fussy
> horData=c(1,300,800,1200,1700,2100,2900,3400,3800,4300,4800,5200,5600,610
> 0,6500,7000)
> #not at tics
> horTicLocs=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6
> 128,6564,7000)
> horLabels=c('1Yr','1Da','10.8Hr','7Hr','5Hr','4Hr','3Hr','2.57Hr','2.25Hr','2Hr','1.82
> Hr','1.67Hr','1.54Hr','1.43Hr','1.34Hr','1.25Hr')
> plot(horData,verData,xaxt='n',xlim=horAxisLims)
> axis(1,tick=TRUE,at=horTicLocs,labels=horLabels)
> 
> To deal with the desirables:
> 1) labels should be vertical
> 2) the bottom of the labels should line up with the ticks
> it was suggested that I try:
> 
> install.packages(plotrix)
> axis(1,tick=TRUE,at= horTicLocs,labels=rep("",length(horLabels)))
> library(plotrix)
> staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0))
> 
> So I tried this code:
> 
> install.packages(plotrix)
> horAxisLims=c(0,7200)
> verData=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,612
> 8,6564,7000)
> #not fussy
> horData=c(1,300,800,1200,1700,2100,2900,3400,3800,4300,4800,5200,5600,610
> 0,6500,7000)
> #not at tics
> horTicLocs=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6
> 128,6564,7000)
> horLabels=c('1Yr','1Da','10.8Hr','7Hr','5Hr','4Hr','3Hr','2.57Hr','2.25Hr','2Hr','1.82
> Hr','1.67Hr','1.54Hr','1.43Hr','1.34Hr','1.25Hr')
> plot(horData,verData,xaxt='n',xlim=horAxisLims)
> axis(1,tick=TRUE,at= horTicLocs,labels=rep("",length(horLabels)))
> library(plotrix)
> staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0))
> 
> I get:
> > install.packages(plotrix)
> Error in install.packages(plotrix) : object 'plotrix' not found
> 
> Thanks,
> Hurr
> 
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Put-short-
> string-labels-vertically-near-tick-marks-on-bottom-axis-
> tp4690452p4690514.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.



More information about the R-help mailing list