Ideas for cooking ggplot2

by Nacho

Ideas para ggplot2

#####
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)
 
fig1 = 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))
fig1

############################ In Grey scale
 
fig2 = 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))
 
fig2

#################Grey scale2 y conservar  grid lines
 
fig3 = 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() 
fig3

Fuente: Ideas for converting a colour to a gray graph

10 Responses to “Ideas for cooking ggplot2”

  1. window messanger Says:

    window messanger…

    Grupo R : RMyP » Blog Archive » Ideas for cooking ggplot2…

  2. spanish courses brighton food ma Says:

    spanish courses brighton food ma…

    Grupo R : RMyP » Blog Archive » Ideas for cooking ggplot2…

  3. tallernaturally Says:

    tallernaturally…

    [...]Grupo R : RMyP » Blog Archive » Ideas for cooking ggplot2[...]…

  4. web design Says:

    web design…

    [...]Grupo R : RMyP » Blog Archive » Ideas for cooking ggplot2[...]…

  5. learn spain spanish online Says:

    learn spain spanish online…

    [...]Grupo R : RMyP » Blog Archive » Ideas for cooking ggplot2[...]…

  6. FREE ENCRYPTION SERVICE, CODE ENCRYPTOR, INTERNET PRIVACY, HIDE HTML, html encrypt, protect your website, md5 hash, steganography, hashing, cryptography, ascii, decrypt, computer security, encrypted, algorithms, encryption software, data encryption, netwo Says:

    FREE ENCRYPTION SERVICE, CODE ENCRYPTOR, INTERNET PRIVACY, HIDE HTML, html encrypt, protect your website, md5 hash, steganography, hashing, cryptography, ascii, decrypt, computer security, encrypted, algorithms, encryption software, data encryption, …

    [...]Grupo R : RMyP » Blog Archive » Ideas for cooking ggplot2[...]…

  7. pencil drawings Says:

    pencil drawings…

    Grupo R : RMyP » Blog Archive » Ideas for cooking ggplot2…

  8. lesbian porn Says:

    lesbian porn…

    Grupo R : RMyP » Blog Archive » Ideas for cooking ggplot2…

  9. web design in melbourne Says:

    web design in melbourne…

    [...]Grupo R : RMyP » Blog Archive » Ideas for cooking ggplot2[...]…

  10. e-ticaret Says:

    e-ticaret…

    [...]Grupo R : RMyP » Blog Archive » Ideas for cooking ggplot2[...]…

Leave a Reply

You must be logged in to post a comment.