How to generate 3-D bar graph in R?


This is my data.frame,

> head(dat)
  word value number         name
1   10 0.001     30 gi|378283288
2   15 0.001     17 gi|378283288
3   20 0.001     16 gi|378283288
4   25 0.001     14 gi|378283288
5   30 0.001     12 gi|378283288
6   10 0.010     38 gi|378283288

> tail(dat)
    word value number         name
120   30   0.5     27 gi|378285158
121   10   1.0     34 gi|378285158
122   15   1.0     31 gi|378285158
123   20   1.0     27 gi|378285158
124   25   1.0     27 gi|378285158
125   30   1.0     27 gi|378285158

I want to present it in a bar graph. I explored the options, but not succeeded yet, because I want to present all the four columns. value can be used as X-axis, word can be used as y-axis and the name can be used as Z-axis. Then how to use number here?
May be a graph like this will be helpful, I can represent number by using color scale in legend.
example Now, my question is, how to generate this plot in R? and is it a right way to present my data?


Answers:


I would do something like this:

library(ggplot2)
theme_set(theme_bw())
theme_update(strip.background=element_rect(colour="white"))

cities <- c("Beijing", "Hong Kong", "Macau", "Nanjing")
measures <- sprintf("Particle %s", toupper(letters[1:8]))
df <- data.frame(expand.grid(city=cities, measure=measures))
df$value <- rexp(nrow(df))

p <- (ggplot(df, aes(x=measure, y=value, color=measure, group=city)) +
      scale_color_discrete(guide=FALSE) +
      geom_point() + facet_wrap(~ city) +
      geom_line(color="grey", alpha=0.5) +
      xlab(""))
p

...which isn't so different from what shadow suggested in the comments.

I'm giving my (subjective) answer to your last question, "is [a 3D barplot a good] way to present my data." I'd prefer a faceted 2D plot to something 3D.