Home > Software engineering >  Plots not loading in R console, using ggplot
Plots not loading in R console, using ggplot

Time:07-06

Whenever I run code chunks containing plots within my project, it fails to load but doesn't display any error message, as if the console is frozen and then eventually times out. I have ran this code script 20 times or more and it all worked fine, but now for some reason unknown it just won't work.

I have tried:

  • Restarting R
  • Reinstalling R
  • Updating and installing packages again
  • Running different Rmd's/projects which have been run before, (they don't work either)

Any other code chunk will execute fine and other packages all seem to be operating as usual. I am currently running the latest Rstudio 4.1.3 build 492.

Here is my code anyway:

budget_revenue <- ggplot(data = filtered_movies2)   
  geom_point(mapping = aes(x = budget, y = revenue, colour = genre_1))   
  facet_wrap(~ genre_1, nrow = 2)  
  labs(title = "Budget and Revenue by Genre", x = "Movie Budget", y = "Gross Revenue")  
  scale_y_continuous("Gross Revenue", 
                       breaks = scales::breaks_extended(8),
                       labels = scales::label_dollar())   
  scale_x_continuous("Movie Budget",
                     breaks = scales::breaks_extended(5),
                     labels = scales::label_dollar())  
  theme_minimal()  
   theme(axis.text.x = element_text(angle = 45, vjust = 0.5))  
  theme(legend.position = "none")
  
  
  budget_revenue  
    scale_colour_viridis_d() 

CodePudding user response:

With closing down and rebooting my machine, it allowed for all updates and reinstallation's to take effect and the issue was solved.

  • Related