Using ggplot2 how can I represent a dot and a line in the legend?

See below for a solution. The main idea is the following: imagine the points having an invisible line under them, and the lines having invisible points. So each "series" gets color and shape and linetype attributes, and at the end we will manually set them to invisible values (0 for lines, NA for points) as necessary.

Ggplot2 will merge the legends for the three attributes automatically.

See below for a solution. The main idea is the following: imagine the points having an invisible line under them, and the lines having invisible points. So each "series" gets color and shape and linetype attributes, and at the end we will manually set them to invisible values (0 for lines, NA for points) as necessary.

Ggplot2 will merge the legends for the three attributes automatically. # make plot p.

Congratulations! – gd047 Feb 19 '10 at 8:50 Thank you - that is what I wanted to achieve. – celenius Feb 20 '10 at 16:43.

Setting the colour aesthetic for each geom to a constant may help. Here is a small example: require(ggplot2) set. Seed(666) NFrame(x=1:N,y=runif(N),z=runif(N)) p.

I was hoping to just have the dot in the legend for the 'practice' category. Thanks. – celenius Feb 15 '10 at 12:05 Set the colour as an option rather than as a mapped aesthetic for the line, i.e.

Change the three lines before the print to: pThank you for the suggestion, though. – celenius Feb 16 '10 at 17:26.

This isn't supported natively in ggplot2, but I'm hoping I'll figure out how for a future version.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions