I have read similar posts, yet the problem still persists. I rather prefer R-base as in the MRE below:
mu <- 0
sigma <- 1
x <- seq(-4, 4, length=1000)
y <- dnorm(x, mean=mu, sd=sigma)
Plot the normal curve
plot(x, y, type="l", lwd=2, col="black",
xlab="Desviaciones estándard (σ)",
ylab="Densidad",
main="", xaxt="n") # Suppress default x-axis labels with xaxt="n"
Add vertical lines for each sigma
abline(v = seq(-3, 3, by=1), col="gray", lty=2)
Add sigma labels cleanly without overlap
sigma_labels <- c("-3σ", "-2σ", "-1σ", "μ", "+1σ", "+2σ", "+3σ")
axis(1, at=seq(-3, 3, by=1), labels=sigma_labels)
FJCC
April 4, 2025, 12:24am
2
The following content of an .Rmd renders with the correct Greek letters on the x axis.
---
output:
pdf_document:
latex_engine: pdflatex
---
```{r echo=FALSE}
mu <- 0
sigma <- 1
x <- seq(-4, 4, length=1000)
y <- dnorm(x, mean=mu, sd=sigma)
#Plot the normal curve
plot(x, y, type="l", lwd=2, col="black",
xlab="Desviaciones estándard (σ)",
ylab="Densidad",
main="", xaxt="n") # Suppress default x-axis labels with xaxt="n"
#Add vertical lines for each sigma
abline(v = seq(-3, 3, by=1), col="gray", lty=2)
#Add sigma labels cleanly without overlap
sigma_labels <- c(expression(paste("-3", sigma)),
expression(paste("-2", sigma)),
expression(paste("-1", sigma)),
expression(mu),
expression(paste("+1", sigma)),
expression(paste("+2", sigma)),
expression(paste("+3", sigma)))
axis(1, at=seq(-3, 3, by=1), labels=sigma_labels)
Thanks FJCC.
It turns out that the simplest solution to the "problem" is to mark the option "Use cairo device" when saving the plot.
Best wishes
heRiberto!
system
Closed
July 6, 2025, 6:49pm
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.