r - Implenting multiple colors on axis line based on axis values in ggplot2 -


i know if possible create plot using ggplot2 e.g. x axis line black 0 5 , white 5 8?

i working on plot there column of text on right side of plot. currently, x axis goes 8. using

plot + scale_x_continuous(limits=c(0, 8)) 

if change upper limit in above 5, lose text on right side. therefore, thinking coloring x axis white 5 8 easiest solution.

something this?

library(ggplot2)  df = data.frame(    x = runif(10),    y = runif(10) )  ggplot(df) +     geom_point(aes(x = x, y = y)) +     geom_segment(aes(y = 0, yend = 0, x = 0, xend = 0.5), color = 'blue') +     geom_segment(aes(y = 0, yend = 0, x = 0.5, xend = 1), color = 'red') 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -