Closed fmmattioni closed 3 years ago
This happens because the pattern [...] (...)
is interpreted as a link in markdown. One workaround is to use the html entities representing [ and ]:
library(ggplot2)
library(ggtext)
ggplot(mtcars, aes(mpg, hp)) +
geom_point() +
labs(x = "[La<sup>-</sup>] (mmol·L<sup>-1</sup>)") +
theme(axis.title.x = element_markdown())
Created on 2020-06-06 by the reprex package (v0.3.0)
The other is to use a non-breaking space. While element_markdown()
doesn't actually handle non-breaking spaces correctly, it's sufficient here to stop the markdown interpreter from inserting a link:
library(ggplot2)
library(ggtext)
ggplot(mtcars, aes(mpg, hp)) +
geom_point() +
labs(x = "[La<sup>-</sup>] (mmol·L<sup>-1</sup>)") +
theme(axis.title.x = element_markdown())
Created on 2020-06-06 by the reprex package (v0.3.0)
Oohh, that is true.. I am so sorry, I have completed overlooked this.. thank you, @clauswilke!
I have been trying to place the following label on my axis: [La-] (mmol·L-1).
The problem is that it seems the use of
[ ]
and( )
is causing a bug.reprex with bug:
Created on 2020-06-06 by the reprex package (v0.3.0)
When I use
( )
instead of[ ]
, the bug seems to disappear:Created on 2020-06-06 by the reprex package (v0.3.0)
Any thoughts on this?