0

I am using this code to produce the picture:

ggplot() + 
stat_density(kernel = "biweight",aes(x=fd, colour='red'), data=dw,position="identity",geom="line") + 
stat_density(kernel = "biweight",aes(x=fd, colour='blue'), data=ds,position="identity",geom="line")+
stat_density(kernel = "biweight",aes(x=fd, colour='orange'), data=dmw,position="identity",geom="line")+
stat_density(kernel = "biweight", aes(x=fd, colour='green'), data=dne,position="identity",geom="line")+
scale_colour_manual(name='Regions',values=c('red'='red', 'blue'='blue', 'orange'='orange', 'green'='green'), labels=c('West','South','Midwest','Northeast'))+
scale_y_continuous(expand = c(0,0),limits = c(0,0.025)) +
coord_cartesian(xlim = c(0, 200))

Now,

  1. How do I remove the green line in the y and x-axis? I am not sure why it is there. (Solved)
  2. How do I change the legend box to just a dot of the color?
  3. How can I make the bottom of the figure to start from y=0 instead of empty space there? (Solved)

Thank you.

P.S. Not able to use MELT for the dataframes because they are of different lengths but same name 'fd'.

enter image description here

Geekuna Matata
  • 1,349
  • 5
  • 19
  • 38
  • 2
    Your first question is an easily found [duplicate](http://stackoverflow.com/q/17006956/324364). – joran Mar 24 '14 at 20:43
  • Could you please give a link here? I am not sure what keyword to search. – Geekuna Matata Mar 24 '14 at 20:44
  • There's a link embedded in my comment. I simply searched for "ggplot2 geom_density bottom line", and that question was the first result. Your third question is answered either the same way you achieved that result for the x axis, or by noticing the `expand` argument in the docs. – joran Mar 24 '14 at 20:48
  • - http://stackoverflow.com/q/17006956/324364 - http://stackoverflow.com/questions/19456816/ggplot2-change-legend-symbol - http://stackoverflow.com/questions/20220424/ggplot2-bar-plot-no-space-between-bottom-of-geom-and-x-axis-keep-space-above – hrbrmstr Mar 24 '14 at 20:49
  • Thank you. Now I can get a line in there. But still not sure, how to get a dot. – Geekuna Matata Mar 24 '14 at 21:19
  • I have solved 1 and 3. Thank you. But not 2. – Geekuna Matata Mar 24 '14 at 21:27
  • For 2 - you can maybe get a workaround from here http://stackoverflow.com/questions/16356052/control-ggplot2-legend-look-without-affecting-the-plot – user20650 Mar 25 '14 at 00:59

0 Answers0