John,
The order of legends in ggplot2 depends on the order of factor levels in the
data frame. The linetype can be matched to the factor levels using a named
vector (ggplot2 basically does a lookup).
The biggest problem you have here is that you’re not passing data in the right
form or format
eza.cz/01-dovetek/ | This email and any documents attached to
it may be confidential and are subject to the legally binding disclaimer:
https://www.precheza.cz/en/01-disclaimer/
From: John [mailto:miao...@gmail.com]
Sent: Wednesday, May 23, 2018 3:25 AM
To: PIKAL Petr
Cc: r-help
Subject: Re: [R] lege
Hi,
I ran your code, but the results were not as expected. After I ran the
code by "source", it return
No id variables; using all as measure variables
> p2
and no line or legend is on the graph (as attached)
Am I doing anything wrong?
John
library(ggplot2)
library(reshape2)
dfm<-mel
Hi
Your approach seems to me rather complicated. I would reshape data before
plotting and maybe also change order of levels in resulting variable factor
library(reshape2)
dfm<-melt(df)
dfm$variable<-factor(dfm$variable, levels=levels(dfm$variable)[c(2,1,3,4)])
p2<-ggplot(dfm, aes(x=rep(1:2,4), y
4 matches
Mail list logo