DescribeDisplay followup & wild speculation about R GUI

7 views
Skip to first unread message

Paul Johnson

unread,
Feb 7, 2008, 12:28:49 PM2/7/08
to gg...@googlegroups.com
I did not hear of DescribeDisplay until last night, and I've just been
messing with it for a couple of hours. So I think I'm missing
something.

One basic problem is that it works for some types of graphs, but not
others. I don't get success when the graph type is histogram/bar or
the rotation plot:

> myDDfig <- dd_load("myDDtest.R")
Error in source(path) :
myDDtest.R: unexpected numeric constant at
90: ),
91: params = list(F = c(0.987,-0.142,-0.0730.138
> myDDfig <- dd_load("myDDbars.R")
Error in source(path) :
myDDbars.R: unexpected numeric constant at
90: ),
91: params = list(F = c(0.987,-0.142,-0.0730.138

On the other hand, scatterplots come through just fine.

> myDDfig <- dd_load("myDDscatter.R")
> plot(myDDfig)

This is handy, but it also leaves me a little frustrated because I
don't know what to do in order to fix up the final graphs.
I need to put in x and y labels, maybe add a regression line, and so
forth, and I don't understand how to do that in R. I have some luck
with setting the graph title by a command like

myDDfig$title <- "My massive figure"

That works. But I can't figure how to do other stuff, like

1. center the label of the X axis below the axis
2. Eliminate the coloring in the background of the scatterplot
3. Fiddle the tick marks.
4. Can I add "text" labels to a few of the points?

How do you achieve details like that?

The really interesting part of this design you have, however, is that
it becomes plain that a graph is built up of a whole lot of smaller
objects. If there were an "object browser" with which to review the
contents of "myDDfig" and adjust them, it would be a big break
through. I was using the program Axum in 1989, before the S folks
bought that company and grafted the Axum GUI on top of S to make S+.
The original Axum was a DOS program, making graphs with it was rather
like R--type some commands, see what comes out. In 1993 or so,
Trimetrix decided to start on a graphical interface. One could create
the graph, click on components, adjust them easily. If an R user
could fiddle an object created by dd_load, then that same
functionality would be present. The GUI Axum (and early S+ 6.0, which
inherited the interface) had a nice kind of display where all of the
objects in the graph were shown in a tree (I guess it was XML or
something like) and the user could either click on those objects or
click on their representation in the figure in order to bring up a
customization menu. It did not feel like we "ran some commands to see
a graph". It felt more like we created a graph, adjusted some
details, until we liked it. In the guts of the program, it is
probably all the same.

Looking at some examples of objects saved with DescribeDisplay makes
me think you are very close to having a workable GUI for customization
of R plots. An object browser and we'd be golden.

I noticed a month ago that Fedora linux ships with an R GUI called
rkward. Have you seen it? It has been pretty stable in my
experience, more stable than Rcmdr or rattle.

--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

Michael Lawrence

unread,
Feb 7, 2008, 2:37:18 PM2/7/08
to gg...@googlegroups.com

These are very interesting ideas.

I'll say upfront I am not sure what sort of object representation is employed by DescribeDisplay, but I know that Hadley has been thinking about a GUI for ggplot2, which is object-based. But the design of ggplot is based on the grammar of graphics and so likely different from the Axum system, which sounds more like a low-level canvas (like powerpoint) where the user manipulates properties of each visual item. Having such a framework in R, at some level, would be useful for interactive graphics (ie for lazy updating).


I noticed a month ago that Fedora linux ships with an R GUI called
rkward.  Have you seen it?  It has been pretty stable in my
experience, more stable than Rcmdr or rattle.

I am not sure how this is relevant. Creating a GUI in R does not require a complete R GUI. A problem with rkward is that it is Linux (and KDE) specific. The gWidgets package provides an abstraction that allows GUIs to work out of the box on any platform (using tcl/tk or another toolkit like RGtk2, which tends to work a bit better and look a bit nicer) at the option of the user.
 

hadley wickham

unread,
Feb 7, 2008, 4:54:57 PM2/7/08
to gg...@googlegroups.com
> One basic problem is that it works for some types of graphs, but not
> others. I don't get success when the graph type is histogram/bar or
> the rotation plot:

That's definitely a bug and we'll try and get it fixed for the next
release (Debby is looking into it now).


> This is handy, but it also leaves me a little frustrated because I
> don't know what to do in order to fix up the final graphs.
> I need to put in x and y labels, maybe add a regression line, and so
> forth, and I don't understand how to do that in R. I have some luck
> with setting the graph title by a command like
>
> myDDfig$title <- "My massive figure"
>
> That works. But I can't figure how to do other stuff, like
>
> 1. center the label of the X axis below the axis
> 2. Eliminate the coloring in the background of the scatterplot
> 3. Fiddle the tick marks.
> 4. Can I add "text" labels to a few of the points?

Currently DescribeDisplay uses two plotting mechanism - drawing
everything by hand, and the ggplot package (which has since been
superseded by ggplot2). You can make all of your listed changes
fairly simply with ggplot2, but I need to convert the package to use
it instead of ggplot.

> How do you achieve details like that?

You can see some examples of modifying existing plots on the ggplot2
website - http://had.co.nz/ggplot2

> Looking at some examples of objects saved with DescribeDisplay makes
> me think you are very close to having a workable GUI for customization
> of R plots. An object browser and we'd be golden.

The difficulty is choosing the correct level of abstraction.
Currently I think it's too low, and we need the higher level plotting
tools made available by ggplot2. It doesn't like it will be too much
effort to change over - would you be interested in trying out an
updated package?

Hadley

--
http://had.co.nz/

hadley wickham

unread,
Feb 7, 2008, 5:24:29 PM2/7/08
to gg...@googlegroups.com
> The difficulty is choosing the correct level of abstraction.
> Currently I think it's too low, and we need the higher level plotting
> tools made available by ggplot2. It doesn't like it will be too much
> effort to change over - would you be interested in trying out an
> updated package?

Looking at the code in more detail, it's definitely not hard to change
all of the ggplot functions to ggplot2. However, this is mostly
because the ggplot side only supports scatterplots and parallel
coordinates. It will be a bit more work to support the others. I'll
see if I can get something working.

Hadley

--
http://had.co.nz/

Paul Johnson

unread,
Feb 7, 2008, 6:24:17 PM2/7/08
to gg...@googlegroups.com
On Feb 7, 2008 4:24 PM, hadley wickham <h.wi...@gmail.com> wrote:
>
> > The difficulty is choosing the correct level of abstraction.
> > Currently I think it's too low, and we need the higher level plotting
> > tools made available by ggplot2. It doesn't like it will be too much
> > effort to change over - would you be interested in trying out an
> > updated package?

Yes, that would be fine. I'm installing ggplot2 now from CRAN to see
what it does so far.

Having fun running your examples. qplot is nice.

I've not read your book draft for quite a while. I see it is very sharp now.

To my eye, the striking thing about ggplot is the syntax. It really
shows where plot() is not object-oriented. Careful reading of the
plot, lines, points, and text help pages clears up confusion, but I
don't think most students ever read them.

I see you are in a tough spot making this presentation. Should you
assume people will learn plot first, or not?

I found myself wishing you had side by side syntax comparisons. For
plot with colored points, in R I would do:
x<-rnorm(100); y<-rnorm(100)
plot( x, y, type="n", xlab="My Great Predictor", ylab="My Output",
main="The Great Plot", xlim=c(10,30), ylim=c(0,1))
points(x, y, col=as.integer(y), cex=0.5, pch=8)
legend ( whatever )

I can't remember the legend syntax off the top of my head.

Anyway, I've made plots like that, and I'm able to reposition the
legend to get it right, fiddle the colors. So I might end up with a
pretty elaborate block of code, maybe 10 lines. I can make that work
pretty well.

I see your point that you want people to have an easier time creating
basic graphs. But I'm not quite getting the point that your approach
will be easier or better once I want to change something about your
figures.

If you my R code on one side of the page, and then put your approach
on the other, it might make it easier to see what is going on. In
particular, we need to see how you get your "default" plot, and then
how a user is supposed to be able to change the colors, position of
the legend, and so forth.

the word "aesthetic" scares me. It implies I am supposed to have taste.

Reply all
Reply to author
Forward
0 new messages