Ideas for converting a colour to a gray graph.

97 views
Skip to first unread message

Guillaume T.R.

unread,
Dec 1, 2010, 2:52:19 PM12/1/10
to ggplot2
Hi list!

I have made a colour graph for a poster this summer and, in order to
avoid 800$ per colour figure charged by the editor of the journal we
want to submit, I would like to convert it to a gray scale graph.
(Someone had the same issue on this list in the last few weeks, and we
want to include 3 similar figures.) I have tried to do it, but I'm not
satisfied as I find that I'm losing in easy identification of factors.
So I would like to have your advice to improve this plot in order to
be easily distinguishable in gray scale.

About my plot: I have 2 levels - Treatment (Trt - 2 levels) and Clone
(8 levels). My issue is with Clone as it was difficult to distinguish
between the 8 levels in the plots I tried in gray scale. I have also
used an increase point size (scale_size_manual) for some clones as I
want to point out some of them, while showing all the clones I
measured.

Thank you for your help and suggestions!

guillaume

#####
library(ggplot2)

data = structure(list(Trt = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("A",
"B"), class = "factor"), Clone = structure(c(1L, 2L,
3L, 4L, 5L, 6L, 7L, 8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L), .Label =
c("1",
"2", "3", "4", "5", "6", "7", "8",
"Mean"), class = "factor"), x = c(-27.5996, -27.5333, -27.0267,
-27.6467, -26.7667, -28.07, -27.4608, -28.1867, -29.3833, -28.2196,
-29.6567, -28.9608, -29.6167, -30.1892, -28.5633, -30.2208),
x.SE = c(0.3603, 0.3085, 0.3085, 0.3085, 0.3085, 0.3085,
0.4831, 0.3085, 0.3085, 0.3601, 0.3085, 0.3603, 0.3085, 0.2402,
0.3085, 0.3686), y = c(98.12, 69.84, 78.47, 68.03, 58.2,
33.39, 46.57, 65.75, 40.01, 38.23, 34.09, 44.37, 31.92, 39.85,
34.37, 41.27), y.SE = c(15.32, 12.51, 12.51, 12.51, 12.51,
12.51, 15.32, 12.51, 12.51, 15.32, 12.51, 15.32, 12.51, 12.51,
12.51, 15.32)), .Names = c("Trt", "Clone", "x", "x.SE",
"y", "y.SE"), class = "data.frame", row.names = 3:18)

# x and ylim for geom_errorbar with standard error
fig.xlim = aes(xmin = x - x.SE, xmax = x + x.SE, height=0)
fig.ylim = aes(ymin=y-y.SE, ymax=y+y.SE, height=0)

fig = ggplot(data, aes(x, y, shape=factor(Trt), fill=factor(Clone),
size=factor(Clone)) ) +
scale_shape_manual(values=c(23,21), "Treatment") +
scale_fill_brewer(palette="Set1", "Clone") +
theme_bw() +
coord_cartesian(xlim= c(-31,-26), ylim=c(0,120) ) +
scale_y_continuous(limits=c(0,120)) +
scale_x_continuous(limits=c(-31,-26)) +
geom_errorbar(fig.ylim, width=0, size=0.3,colour="black") +
geom_errorbarh(fig.xlim, size=0.3, colour="black") +
geom_point(aes(size=factor(Clone))) +
scale_size_manual(values=c(2,2,4,2,4,4,2,2), "Clone") +
opts(panel.grid.minor=theme_line(colour = NA, size = 0.0),
panel.grid.major=theme_line(colour = NA, size = 0.0),
strip.background = theme_rect(col="black",fill=NA))

fig

Kohske Takahashi

unread,
Dec 1, 2010, 10:59:23 PM12/1/10
to Guillaume T.R., ggplot2
hi, I don't know if this is good or bad, but label would help

fig = ggplot(data, aes(x, y, shape=factor(Trt))) +
scale_shape_manual(values=c(23,21), "Treatment") +


theme_bw() +
coord_cartesian(xlim= c(-31,-26), ylim=c(0,120) ) +
scale_y_continuous(limits=c(0,120)) +
scale_x_continuous(limits=c(-31,-26)) +
geom_errorbar(fig.ylim, width=0, size=0.3,colour="black") +
geom_errorbarh(fig.xlim, size=0.3, colour="black") +

geom_point(size=6, fill="white") +
geom_text(aes(label=Clone),size=4) +


opts(panel.grid.minor=theme_line(colour = NA, size = 0.0),
panel.grid.major=theme_line(colour = NA, size = 0.0),
strip.background = theme_rect(col="black",fill=NA))

fig


--
Kohske Takahashi <takahash...@gmail.com>

Research Center for Advanced Science and Technology,
The University of  Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>

Hadley Wickham

unread,
Dec 2, 2010, 10:45:53 AM12/2/10
to Kohske Takahashi, Guillaume T.R., ggplot2
Kohske is right that the display of clones is currently too prominent,
and distracts from the main message of the plot, which the difference
between treatments. My version tries to keep the clone labelling so
you can read it if you really try, and to make it easier to see the
difference between the treatments.

Also, unless the journal style forbids it, I think it's a bad idea to
get rid of the grid lines - they considerably improve perceptual
accuracy.

ggplot(data, aes(x, y, shape=factor(Trt), colour = factor(Trt))) +
geom_errorbar(fig.ylim, width=0, size=0.3) +
geom_errorbarh(fig.xlim, size=0.3) +


geom_point(size=6, fill="white") +

geom_text(aes(label=Clone),size=3, colour = "grey50") +
scale_shape_manual(values=c(23,21), "Treatment") +
scale_colour_grey("Treatment", end = 0.6) +
theme_bw()

Hadley

--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

Reply all
Reply to author
Forward
0 new messages