search for: valuex

Displaying 4 results from an estimated 4 matches for "valuex".

Did you mean: value
2017 Jun 27
4
ggplot2 geom_bar arrangement
Hi, I was trying to draw a geom_bar plot. However, by default, the bars are arranged according to the label, which I don't want. I want the bars to appear exactly as they appear in the data frame. For example in the code: Lab=c(letters[4:6],letters[1:3]) valuex = c(3.1,2.3,0.4,-0.4,-1.2,-4.4) df <- data.frame(Lab,valuex) px <- ggplot(df,aes(Lab,valuex,label=Lab)) + geom_text(aes(y=0)) + geom_bar(stat = "identity") px The default arranges the bars in order 'a' through 'f', but I want them arranged as per df. How can I...
2017 Jun 27
0
ggplot2 geom_bar arrangement
You just have to change the levels of the factor ... library(ggplot2) Lab = c(letters[4:6], letters[1:3]) valuex = c(3.1,2.3,0.4,-0.4,-1.2,-4.4) df <- data.frame(Lab,valuex) # set the factor levels to the same order as observed in the data frame df$Lab <- factor(df$Lab, levels=unique(df$Lab)) px <- ggplot(df,aes(Lab,valuex,label=Lab)) + geom_text(aes(y=0)) + geom_bar(stat = "identity"...
2017 Jun 27
0
ggplot2 geom_bar label justification
...get staggered in plot py. ######### Lab1 = c("Tom","Harry","Brad","Helen","Julie","Steve") Lab2=c('abracadabra','rumplestiltskin','adadf','asddsdfsdsfsds','sdfsdfsfsfs','sddf') valuex = c(3.1,2.3,0.4,-0.4,-1.2,-4.4) df1 <- data.frame(Lab1,Lab2,valuex) df1$hjust <- ifelse(df1$valuex > 0, 1.3, -0.3) df1$Lab1 <- factor(df1$Lab1, levels = unique(df1$Lab1)) df1$Lab2 <- factor(df1$Lab2, levels = unique(df1$Lab2)) ## plot 1 px <- g...
2012 Apr 13
2
Long command in Sweave
Dear useRs, I am writing a vignette for a package, which contains long command like this, >reduce(Lipset_cs,"SURVIVAL",c("GNPCAP", "URBANIZA", "LITERACY", "INDLAB", "GOVSTAB"),explain="positive",remainder="exclude",case="CASEID") It is longer than the width a page and part of it will become