Displaying 6 results from an estimated 6 matches similar to: "how to automatically select certain columns using for loop in dataframe"
2018 May 22
3
legend order in ggplot2
Hi,
I'd like to graph three lines on ggplot2 and I intend the lines to be
"solid", "dashed", and "dotted". The legend names are "name_b", "name_a",
"name_c". I'd like to legend to present in the order: the "name_b" at the
top, and "name_c" at the bottom.
As a consequence, the legend is indeed in the order:
2018 May 23
3
Change the legend order by order function
Hi,
I'd like to graph three lines on ggplot2 and I intend the lines to be
"solid", "dashed", and "dotted". The legend names are "name_b", "name_c",
"name_a". I'd like to legend to present in the order: the "name_b" at the
top, and "name_a" at the bottom.
Could it be done by order function or its inverse?
2018 May 23
0
Change the legend order by order function
There are two key concepts you seem to be unaware of regarding ggplot: 1) you really need to put your data in long format to work with multiple curves, and 2) the column containing the names of the curves should be a factor with levels in the order you wish them to be presented in the legend (bottom to top). I am not in a position at the moment to give you a full reprex, but Google can probably
2018 May 22
0
legend order in ggplot2
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=value))
p2+geom_line(aes(linetype=variable))+
2018 May 23
1
legend order in ggplot2
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<-melt(df)
dfm$variable<-factor(dfm$variable, levels=levels(dfm$variable)[c(2,1,3,4)])
2012 Feb 08
18
[PATCH 0 of 4] Prune outdated/impossible preprocessor symbols, and update VIOAPIC emulation
Patch 1 removes CONFIG_SMP
Patch 2 removes separate smp_{,r,w}mb()s as a result of patch 1
Patch 4 removes __ia64__ defines from the x86 arch tree
Patch 3 is related to patch 4 and changes the VIOAPIC to emulate
version 0x20 as a performance gain. It preceeds Patch 4 so as to be
more clear about the functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>