[R] Hyperspec package: need to change spectra names in a stacked plot

beleites,claudia claudia.beleites at ipht-jena.de
Sun Apr 29 13:16:24 CEST 2012


Ciao Roberto,

welcome to hyperSpec!

1. reproducible example
You can use the example data sets coming with hyperSpec to create examples that everyone can easily reproduce.

2. there's a hyperSpec-help mailing list which you may want to join. 
You can subscribe at 
http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/hyperspec-help
It'S VERY low traffic (few emails / month)

3. stacked spectra with name
Instead of stacked = TRUE, give a factor to define the stacking. In that case, the levels will be used as labels. There's an example in hyperSpec's "plotting" vignette (bottom of p. 9 in the most current version at http://hyperspec.r-forge.r-project.org/plotting.pdf).

You'll probably want to adjust margin width and axis label rotation, see ?par.

Best,

Claudia





________________________________________
Von: r-help-bounces at r-project.org [r-help-bounces at r-project.org] im Auftrag von Peter Ehlers [ehlers at ucalgary.ca]
Gesendet: Samstag, 28. April 2012 19:47
An: Roberto
Cc: r-help at r-project.org
Betreff: Re: [R] Hyperspec package: need to change spectra names in a stacked plot

On 2012-04-27 13:24, Roberto wrote:
> Hi all,
> I need to insert the name of spectra in a stacked plot obtained with
> hyperspec.
>
> I use this command
> plot(spectra [c(-1:-4, -6:-8, -10:-12, -14:-16)], stacked = T)
>
> but, in this way R draw  nameless spectra on the Y axis.
>
> How can I solve the problem?

Your code is not reproducible. (And do use TRUE instead of T; sooner
or later it *will* bite you.)

I think that you might be able to accomplish what I think you
want by setting the argument axis.args, e.g.

   plot(x, stacked=TRUE,
        axis.args = list(y = list(c("apple", "banana", ....))))

Peter Ehlers

>
> Thank you for any suggestion.
> Best regards,
> Roberto

______________________________________________
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