This question already has an answer here:
- How can I use different color palettes for different layers in ggplot2? 2 answers
I have three data series which are composed of :
- X (float)
- Y (float)
- S (float)
- Class (discrete values)
All three data series are sharing the same X coordinate but every other component is different from each other data series. By using one geom_point() for each of my three data series (the library ggpplot2 in R) I would like to plot each of the data series with a color scale according to it specific S
as follow :
ggplot(data, aes(x=X)) + geom_point(aes(y=Y, colour=S, shape=Class))
This works if I am using only one data series. The problem is that if I define three geom_points()
as specified using their own Y
and S
, they all have the same color scale and this is a bit confusing on the plot.
As I am already using the shapes to distinguish between the Class
es I would really enjoy to have a specific color with its own color gradient for each of my data series .
Lets say for example :
- from dark blue to light blue for the data series 1
- from dark red to light red for the data series 2
- from dark yellow to light yellow for the data series 3
I looked around but I haven't found anything satisfying my needs. Some comments where saying that using ggplot2 it is not possible to have more than one color scale per plot... Is it true ?
If anyone has already figured out this kind of plot with or without ggplot2 I would greatly appreciate his or her solution.