Rmarkdown generating image with unreadable x and y axis Ask Question

Please ask your questions about R Markdown here.

I am trying to run rmarkdown render in Linux machine, I am getting the following image when converted to HTML.

Does anyone know what is the issue? I am running the following code from R terminal, not Rstduio.

rmarkdown::render("corona.Rmd")

image

I think the axes look normal, so I must be misunderstanding something. What do you expect to see that is not there?

If you are talking about the use of scientific notation on your y-axis, you can add a labels = argument taking a labeling function from the scales package to format the labels to your liking.

library(tidyverse)
n <- 1000
set.seed(123)
x <- runif(n, 1, 15)
y <- exp(x) + rnorm(length(x))
df <- data.frame(x = x, y = y)

ggplot(df) +
  geom_line(aes(x = x, y = y)) +
  scale_y_log10()


ggplot(df) +
  geom_line(aes(x = x, y = y)) +
  scale_y_log10(labels = scales::label_number(big.mark = ","))

Created on 2020-09-05 by the reprex package (v0.3.0)

1 Like

This topic was automatically closed 21 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.