>>> Michal Blazejczyk <michal.blazejczyk at gmail.com> 11/23/04
09:21AM
>>>
> Hi all,
>
> As part of a research project we are creating a statistical software
> tool and will be using R as the computational engine. I was
wandering> whether we should also use R for plotting. R has a good plotting
> flexibility and an extensive library of available plot types.
However,> our application is supposed to give our users an advanced
> look-and-feel as well.
R allows you quite a bit of flexibility and customization in plotting,
but you will
have to decide if the look and feel matches with what you want. I
address your
individual questions below.
> For the plotting we will therefore need things
> like:
> - interactivity (the possibility to interact with the plot using a
> mouse, e.g. select data points or data bars)
The identify command will identify points (optionally label them on the
plot, then tell you which point(s) were selected).
The locator command will give you the location where the user clicked
on the plot, you could use this with the output from barplot to figure
out which bar was clicked on. If you imediatly replot the graph with
the selected bar/point drawn differently then it will show the
selecection any way you want.
The one thing I don't know how to make it do, is to differentiate
selection by clicking vs.
ctrl-clicking like some packages allow.
> - zoom / scroll
This is not automatic, but easily implemented. One of the easiest ways
is using the tcltk
package. I have code (most of it modified from code at
http://www.wiwi.uni-bielefeld.de/~wolf/) that will plot a 3d surface,
then pop up a window
with sliders, moving the sliders will change the viewing angles, light
angles, etc. of the plot.
You can also easily write code that has the user click on the plot,
then you redraw the plot
zoomed or panned (R is quick enough that I don't notice the redraw).
> - custom colors for lines, data points etc.
There are 657 named colors, or you can specify the color you want using
rgb, or hsv values.
see the col option on the help page for "par", you can specify a
different color for each
line/point if you really want to.
> - conditional formatting (e.g. data points above a given threshold
> are red and bigger while others are regular)
simple, use something like:
plot(x,y, col=ifelse( z>M, 'red','black'), cex=ifelse(
z>M, 1.5, 1) )
now points corresponding to variable z being greater than the value in
M will
be plotted 50% larger and red, others will be normal size and black.
> - possibility to draw marker lines, custom-color bands and areas
Functions points, abline, lines, segments, arrows, polygon, text (and
maybe some others) will
plot additions to the current plot, use these to create bands, areas,
or whatever you want.
> - flexible axes, titles and legends
The defaults are usually pretty good, but you can specify anything you
want (including
math markup like fractions, integral signs, greek letters, etc. see
the help on plotmath).
You can suppress the initial axis, then use the axis command to
customize the axis, telling it
exactly where to draw tickmarks and how to label them (or let it figure
out something that looks nice).
> - axis grids
see the tck option under the help for "par". The command:
axis(side=2, tck=1, col='lightgrey', lty=4)
box()
will draw horizontal grid lines that are light grey and dashed, more
options are available to
further customize this.
> - export to image files (e.g. BMP) in high resolution
see the bmp and dev.copy functions (also can save to postscript, pdf,
jpeg, png, and other formats).
>
> Does anyone know how many of these things are achievable with R, to
> what extent and using which package?
>
> Thanks in advance,
>
> Michal Blazejczyk
> Lead Programmer
> Genome Quebec
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
Greg Snow, Ph.D.
Statistical Data Center
greg.snow at ihc.com
(801) 408-8111