r - axis break/gap with error bars -
There are easy ways to create a break / gap plot of the axis, to create a brake / gap plot of an axis with error bars Is an easy easy way? (I only know Fidelly methods)
# install.packages ("PlotTricks", Dependency = TRUE) is required (PlotTricks) x
errorbar & Lt; - Function (x, y, error, width) {x0 = x; Y0 = (y-err) x1 = x; Y1 = (y + err) arrows (x0, y0, x1, y1, code = 3, angle = 90, length = width)} err & lt; - Representative (1,20) plot (X, Y) errorbar (X, Y, gal, 0.05)
I will suggest a solution where you put it on the logarithmic scale. This way (see below for code). On the left side there is a logarithmic scale and on the right is a standard linear scale to compare.
# install Package ("ggplot2", Dependency = TRUE) is required (ggplot2) #Data (MTCAR) # If you call it net `mtcars` mtcars $ cyl2 & lt; - Ifelse (mtcars $ cyl> 10x cylinders 10 Mtrr mpg [MTCARS $ CIL2 == 'B'] for C ('A'), C ('B') # B - MTCAR $ MPG [MTCARA $ CIL2 == 'B'] * 10 p & lt; - ggplot (mtcars, aes (factor), mpg) p1 and lt; - p + gom_boxplot () + facet_grid (.cil2 , Scale = "free", space = "free") + scale_y_log10 () + laboratories (title = "on a logarithmic scale") P2 and LT; - P + GOM_boxplot () + facet_grid (. ~ Cyl2 , Scales = "Free "Gridxtra" grid. ("Space" "free") + Labs (title = "on a standard linear scale") # Install.packages ("gridExtra", dependency = TRUE). (P1, p2, Ncol = 2)
Comments
Post a Comment