-2

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: the 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

joran
  • 169,992
  • 32
  • 429
  • 468
upabove
  • 1,057
  • 3
  • 18
  • 29
  • Your question is answered in the sample chapter of Hadley's book which is available for free download: http://had.co.nz/ggplot2/book/qplot.pdf – Andrie Aug 23 '11 at 19:44

1 Answers1

4

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()

enter image description here

joran
  • 169,992
  • 32
  • 429
  • 468
  • +1 for linking to sensible starting points for some basic research – Andrie Aug 23 '11 at 19:29
  • @joran thank you so much for the help. THe reason why I asked this question and what is missing from my question is that I don't want to plot the two variables against each other but I would like to have a horizontal axis representing 1,2,3,4,5,5 and plotting both Proportion_Chosing_Message and Optimal for each row. So y should represent the value and x the number of rows in the dataset – upabove Aug 23 '11 at 21:41