[R] automatically adjusting axis limits
John Kane
jrkrideau at yahoo.ca
Tue Oct 27 20:00:28 CET 2009
PLEASE provide commented, minimal, self-contained, reproducible code.
particularly a sample data.set. At the moment it sounds like you have one variable (Wavelength) with a length of 56 and Reflectance with a length of 5,000. What format(s) are the data in? Data.frames?
Clearly this is not the case but I don't understand the data layout at all
--- On Tue, 10/27/09, Servet Ahmet Cizmeli <sa.cizmeli at usherbrooke.ca> wrote:
> From: Servet Ahmet Cizmeli <sa.cizmeli at usherbrooke.ca>
> Subject: [R] automatically adjusting axis limits
> To: r-help at r-project.org
> Received: Tuesday, October 27, 2009, 2:12 PM
> Dear R users,
>
> I am a newbie. Just switched from MATLAB. So thanks a lot
> for your
> patience.
>
> I have 50000 spectra collected in field. Each spectra has
> two columns :
> Wavelength (56) and the actual measurement.
>
> Each measurement came in a different .txt file on disk
> (50000 files in
> total). I wrote a script that reads every spectra in a for
> loop and
> constructs two variables :
>
> Wavelength (56) and Reflectance (56x50000). I would like to
> plot
> Reflectance vs Wavelength i.e. overlay 50000 spectra one
> one top of the
> other.
>
> plot(Wavelength, Reflectance) does not work (Matlab would
> do it):
>
> Error in xy.coords(x, y, xlabel, ylabel, log) :
> 'x' and 'y' lengths differ
>
>
> I then tried to construct the two matrices so that they
> have the same size
> (56x50000) and plot it all at once with the command "plot".
> This works but
> it is such a computationally inefficient way that I do not
> want to do this
> Why redundantly store wavelength data? Later I will have to
> process much
> more spectra so this is not a good practice for me.
>
> I then decided to draw the first spectra on the first run
> of the for loop
> with the command "plot" and add the subsequent graphs with
> the command
> "lines". This works but the y-axes limits do not adjust
> automatically,
> leaving many spectra out of the axis limits ;(
>
> I don't want to set the axis limits by hand as I need this
> script to be
> completely autonomous. I don't want to program lines of
> code to calculate
> those limits myself either.... I am sure the mighty R can
> do it... BUT
> HOW???? (Matlab would easily do it with a single command)
>
> What I need is a command that will redraw the graph by
> automatically
> adjusting the axis limits. I have been searching for many
> days on the web,
> forums and mailing list archives but I still don't know how
> to do it.
> Please help
>
> thanks a lot from advance for your kindly help
> Servet
>
> ______________________________________________
> 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.
>
__________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!
http://www.flickr.com/gift/
More information about the R-help
mailing list