-1

I'm using RStudio 0.97.551 on Ubuntu 14.04.

I would like to add some color to my Box-plot. My data has a category and a value column.

g <- ggplot(data, aes(x = category, y = value))

How can I add same points to the boxplot? The points have the same category x values and the same y value used to draw the Box-plot.

Thanks Daniele

Barranka
  • 18,876
  • 13
  • 56
  • 79
daniele
  • 139
  • 1
  • 2
  • 9
  • Where is the data coming from for the points you wish to draw? Do you want to do something like this: http://stackoverflow.com/questions/23675735/how-to-add-boxplots-to-scatterplot-with-jitter – MrFlick Sep 24 '14 at 21:41
  • And knowing you are using RStudio 0.97.551 is not a useful information. –  Sep 25 '14 at 02:13

2 Answers2

2

Try:

ggplot(data, aes(x = category, y = value, color=category, group=category))+
    geom_point()+
    geom_boxplot(alpha=0.5)

enter image description here

rnso
  • 20,794
  • 19
  • 81
  • 167
0

Thank you for answering.

Your answer show me the way to plot some points in a different colour. Just add the following code to the Box-plot command:

+ geom_point(aes(x="1", y=1, colour ='red'), size=3)

I couldn't plot the point as I use the point command:

point(aes(x="1", y=1, colour ='red'))  
daniele
  • 139
  • 1
  • 2
  • 9