Hello!
I have done a plot and I would like to put a and b letters outside the black box but I am not able to do it in R. When I put the coordinates outside the plot the letters do not appear... Does someone know how to fix it?
This is my code plot:
PlotCon <- ggplot(df_combined, aes(x = Time, y = Intensity, color = Tau)) +
geom_line(linewidth = 0.7) +
facet_wrap(~ Source, ncol = 2) +
scale_x_log10(
limits = c(1e-3, 1e1),
breaks = 10^(seq(-3, 2, by = 1)),
labels = trans_format("log10", math_format(10^.x)),
expand = c(0, 0)
) +
scale_y_continuous(limits = c(0, 2), breaks = seq(0, 2, by = 0.5), expand = c(0, 0)) +
scale_color_manual(values = tau_colors) +
labs(
x = "Time (s)",
y = expression("Intensity a.u."),
color = "Tau Values"
) +
theme_classic(base_size = 13, base_family = "Times") +
theme(
panel.border = element_rect(color = "black", fill = NA, linewidth = 0.2),
axis.line = element_line(color = "black", linewidth = 0.2),
axis.ticks = element_line(color = "black"),
panel.grid = element_blank(),
axis.text = element_text(size = 12),
panel.spacing = unit(1.5, "cm"),
strip.text = element_blank(),
legend.position = "right"
)
print(PlotCon)
What I would like:
I have tried - but does not work
PlotCon <- PlotCon +
coord_cartesian(ylim = c(0, 2.3), clip = "off") # extra space above 2
PlotCon <- PlotCon +
coord_cartesian(clip = "off") +
theme(panel.overflow = "visible") # new in ggplot2 3.4+
