3 by 2 plot in ggplot2
I have a dataset with the following variables:
condition: 1,2,3
type: friend, foe
Proportion_Choosing_Message: represents the number of participants choosing a particular response
Optimal: t开发者_StackOverflowhe optimal probability of choosing each case
I would like create a 3 by 2 plot, where the two columns represents type and the rows represent condition.
SO I would like to have separate plots for:
type:friend & condition 1, type:friend&condition2, type:friend&condition3
type:foe & condition1, type:foe&condition2, type:foe&condition3
The values to be plotted are Proportion_Choosing_Message and Optimal
Here's the dataset: http://dl.dropbox.com/u/22681355/ggplot.csv
Have looked at the documentation and example on Hadley's site? Have you read through the first few chapters of his book? I ask, because this is a very basic question that is easily answered from even a minimal amount of effort with the documentation.
Here's some code for your example, but in the future, I suggest you do more research before turning to SO for help.
dat <- read.csv("ggplot.csv")
ggplot(dat, aes(x = Optimal, y = Proportion_Choosing_Message)) +
facet_grid(condition~type) +
geom_point()
精彩评论