[R] Cutom graphing : Which package (Base, Grid or Lattice package) ?
r_stuff_online at hotmail.com
Sat May 11 04:59:57 CEST 2002
Over the years, I have written a number of custom time series graphing
modules (in ANSI C). I want to make these graphs available in R. After
considerable thought (as well as feedback fom this NG), I have decided to
re-write (atleast some of the routines in R).
Basically, this is what my R function needs to do:
1. create a parent (container) frame
2. Define n (vertically stacked) child windows within the parent (where n is
1,2 or 3)
So the object factory (creator function) would look something like this :
custom.graph.create<- function (win1_perc_size, win2_perc_size, backcolor )
where win*N_perc_size is the % of the HEIGHT of the parent screen assigned
to the Nth child window
The three child windows should share the same x axis (the calender date),
but they would each have
seperate y axis.
In addition the returned object should;
1. allows you to add data to a specified window
( e.g. fooAddSeries(custom_graph_obj, dataset, child_win_number) )
2. Redraw the parent (and all children) when the parent window is resized
3. Be able to respond to mouse movements over a child window
(so I can display info like date : value etc)
4. Be able to "scroll" through *LARGE* time series
(approx 20,000 datapoints in certain cases) - using a "scrolling" window
5. Be able to "zoom in/out" to a specified granularity
(daily, weekly etc) - maybe use the window function ?
As I'm sure you'll appreciate, this is a lot of work, and before I actually
sat down to do some coding, I thought it would be prudent to solicit some
advice from someone who had done something similar or had experience with
custom plotting/graphing in R.
I have learnt the hard way, that as far as R is concerened, it's very easy
to waste several weeks re-inventing the wheel, since it is such a
functionally rich environment.
There appear to be several competing (but not entirely compatable)
"graphing" packages/extensions for R. The base package, which seems to be
the most robust, does not appear to have all the features I need (I may be
wrong though ...), The grid package which appears to have the functionality,
I need is not well documented, and is full of internal functions ..., and
I'm not too sure about the lattice package.
I would be most grateful for any help on:
1. Recommendation on which package to use (base, grid or lattice ?)
2. General guidline (pref with skeleton code/stubs) on
how to proceed - I haven't written any graphing functions in R before !
3. Pointers to more information
Many Thanks in Advance
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help