Quantcast

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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

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

Roberto
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?

Thank you for any suggestion.
Best regards,
Roberto

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hyperspec package: need to change spectra names in a stacked plot

Peter Ehlers
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hyperspec package: need to change spectra names in a stacked plot

beleites,claudia
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: [hidden email] [[hidden email]] im Auftrag von Peter Ehlers [[hidden email]]
Gesendet: Samstag, 28. April 2012 19:47
An: Roberto
Cc: [hidden email]
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

______________________________________________
[hidden email] 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.

______________________________________________
[hidden email] 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.
Loading...