Hi
I am plotting line chart using ggplot and want to use geom_line and
geom_point simultaneously.
I get the plot but now I have two legends.  None of the legend is
representing the true values. I need the legend with shape and color both.
Thanks



> con = textConnection("inputs  var1    var2    var3+ 100       10      5       
> 2+ 1000 20      10      4+ 5000 30      15      8+ 10000        40      20    
>   16+ 30000       50      25      32")> data = read.table(con, header=TRUE)> 
> data  inputs var1 var2 var3
1    100   10    5    2
2   1000   20   10    4
3   5000   30   15    8
4  10000   40   20   16
5  30000   50   25   32> data = melt(data, id="inputs")> data   inputs
variable value
1     100     var1    10
2    1000     var1    20
3    5000     var1    30
4   10000     var1    40
5   30000     var1    50
6     100     var2     5
7    1000     var2    10
8    5000     var2    15
9   10000     var2    20
10  30000     var2    25
11    100     var3     2
12   1000     var3     4
13   5000     var3     8
14  10000     var3    16
15  30000     var3    32> g <- ggplot(data,aes(x=inputs, value,
colour=variable, fill = variable))> g <- g +
geom_point(aes(shape=variable), size=3) > g <- g +  geom_line(lwd=1) +
ylab("time") + xlab("inputs") +  labs(colour="MyLegend",  fill =
"MyLegend")> g

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to