# Axis labeling Boxplot

#### Tom1980

##### New Member
Hello dears,

I would like to change the labelling of the axis in the following example. Instead of 0,1,2,3,4,5 I would like to have the corresponding model names "crude", "direct", "total", "bias1"... there. How do I do that? Can anyone help me? I would also like a legend for the red line with "true causal effect".

Code:
## Illustrating causal estimates --------------------------------------------------
# This function add points with confidence interval to an existing plot
add_estimate <- function(model, xpos) {
# Estimate for causal effect
estimate <- model$coefficients['dat$ZSpAttAnx_Emp']
# It's 95 % CI
ci <- confint(model)['dat\$ZSpAttAnx_Emp',]

# Draw CI in plot
arrows(x0 = xpos, x1 = xpos, y0 = ci[1], y1 = ci[2],
length = 0.05, angle = 90, code = 3)
# Draw point
points(xpos, estimate, pch = 16, bg = 'grey')
}

# Make plot
plot(0, xlim = c(0, 5), ylim = c(0.4, 0.8), pch = '', xlab = 'Model',
ylab = 'Causal estimate', main=" quality of prediction models \n burnout employees",)
# Add line at direct causal effect
lines(c(-1, 6), c(0.5, 0.5), lty = 5, col = 'red')

# Use function to add data points and error bars (95 % CIs)
add_estimate(crude, 0)
add_estimate(direct, 1)
add_estimate(total, 2)
add_estimate(bias1, 3)
add_estimate(bias2, 4)
add_estimate(bias3, 5)
## -----------------------------------------------------------------------------

#### hlsmith

##### Less is more. Stay pure. Stay poor.
You could work with mtext for the legend, just use ---- in red follow by your desired text.

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Side comment, this isn't a boxplot but a dot and whisker plot.