[R] Origin of coordinate system

Ben Tupper btupper at bigelow.org
Thu Aug 23 13:03:59 CEST 2012


Hello,

On Aug 23, 2012, at 6:08 AM, Richard Müller wrote:

> Thank you for your answer. That's the workaround I use - but that's
> not what I intended: the resulting graph looks correct. I used this
> approach a hundred times. But the ugly thing remains: the x-values
> (independent variables) are treated as y-values, and the y-values
> (dependent variables, f(x)) as if they were x-values.But what if I
> have several f(x) values for one x-value, and want to create an error
> bar or similar? Therefore my question: How can I plot x-values from
> top to bottom an y-values from left to right _without_ "masquerading"
> them as y resp. x?
> 

I think I know what you mean. I suppose that you have already set up a suite of wrapper functions around base graphics for your convenience?  That's the direction I would go, but it sounds you may have done so already.  Like the following?

myDepthPlot <- function(depth, value, value2, ylim = rev(range(depth)), ...) 
  plot(value, depth, ylim = ylim, ...)
  if (!missing(value2)) myDepthPoints(depth, value2, ...)
}

myDepthPoints <- function(depth, value, ...) { points(value, depth, ...) }

Also, you may want to look into Dan Kelley's most excellent OCE package: http://dankelley.github.com/oce/

Neither of the above reconfigures the coordinate system, but they allow the user to access functionality as if it were.

Cheers,
Ben






> Richard
> 
> 2012/8/23 S Ellison <S.Ellison at lgcgroup.com>:
>> See ?par etc
>> 
>> Setting ylim  sets the bottom and top of the plot respectively, so
>> plot(1:10, ylim=c(11,0), xlim=c(0,11), ylab='depth')
> 
> -- 
> Richard Müller . Am Spring 9 . D-58802 Balve
> www.oeko-sorpe.de
> 
> ______________________________________________
> 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.

Ben Tupper
Bigelow Laboratory for Ocean Sciences
180 McKown Point Rd. P.O. Box 475
West Boothbay Harbor, Maine   04575-0475 
http://www.bigelow.org




More information about the R-help mailing list