search for: name_a

Displaying 6 results from an estimated 6 matches for "name_a".

Did you mean: name_r
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? Thanks, ##### source code library(ggplot2) od<-order(c("name_b", "name_c", "name_a&q...
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: name_b at the top and name_c at the bottom. However, I'd like name_b to corresponds to "s...
2018 May 23
0
Change the legend order by order function
...can probably help you find lots of examples... try keywords factor long ggplot. Regarding using order to do this, the answer is likely "yes" but your existing example order seems easier to do with an explicit listing of labels in sequence... I cannot fathom why you think name_b, name_c, name_a is a natural result of using the order function that people will want to see. Either be explicit or use an alphabetic order, either way does not need the order function. On May 23, 2018 10:27:14 AM GMT+02:00, John <miaojpm at gmail.com> wrote: >Hi, > > I'd like to graph three...
2009 Apr 09
2
how to automatically select certain columns using for loop in dataframe
Hi, I am trying to display / print certain columns in my data frame that share certain condition (for example, part of the column name). I am using for loop, as follow: # below is the sample data structure all.data <- data.frame( NUM_A = 1:5, NAME_A = c("Andy", "Andrew", "Angus", "Alex", "Argo"), NUM_B = 1:5, NAME_B = c(NA, "Barn", "Bolton", "Bravo", NA), NUM_C = 1:5, NAME_C = c("Candy", NA, "Cecil&quot...
2018 May 22
0
legend order in ggplot2
...able<-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))+ scale_linetype_manual(values=c("solid", "dashed", "dotted", "blank"), labels=c("name_b","name_a","name_c", "other")) Cheers Petr > -----Original Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of John > Sent: Tuesday, May 22, 2018 5:17 AM > To: r-help <r-help at r-project.org> > Subject: [R] legend order in ggplot2...
2018 May 23
1
legend order in ggplot2
...le, 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))+ scale_linetype_manual(values=c("solid", "dashed", "dotted", "blank"), labels=c("name_b","name_a","name_c", "other")) 2018-05-22 15:15 GMT+08:00 PIKAL Petr <petr.pikal at precheza.cz>: > 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 >...