STAT545-UBC / Discussion

Public discussion
38 stars 20 forks source link

Low quality plots #475

Open jdmartinez89 opened 7 years ago

jdmartinez89 commented 7 years ago

Hi I am getting strange low quality plots, I tried the code from the homework for the graph relating population and time to see if it was a mistake in mine. But happens with every plot.

ggplot(subset(gapminder, continent != "Oceania"),
       aes(x = year, y = pop, group = country, color = country)) +
  geom_line(lwd = 1, show.legend = FALSE) + facet_wrap(~ continent) +
  scale_color_manual(values = country_colors) + theme_bw() +
  theme(strip.text = element_text(size = rel(1.1))) + scale_y_log10()

unnamed-chunk-9-1

sessionInfo()

R version 3.3.2 (2016-10-31) Platform: i386-w64-mingw32/i386 (32-bit) Running under: Windows >= 8 x64 (build 9200)

locale: [1] LC_COLLATE=Spanish_Colombia.1252 LC_CTYPE=Spanish_Colombia.1252
[3] LC_MONETARY=Spanish_Colombia.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Colombia.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] dplyr_0.5.0 purrr_0.2.2 readr_1.0.0 tidyr_0.6.0 tibble_1.2
[6] ggplot2_2.1.0 tidyverse_1.0.0 gapminder_0.2.0

loaded via a namespace (and not attached): [1] Rcpp_0.12.7 digest_0.6.10 assertthat_0.1 R6_2.2.0
[5] grid_3.3.2 plyr_1.8.4 DBI_0.5-1 gtable_0.2.0
[9] magrittr_1.5 scales_0.4.0 labeling_0.3 tools_3.3.2
[13] munsell_0.4.3 rsconnect_0.4.3 colorspace_1.2-7 knitr_1.14

jennybc commented 7 years ago

Maybe this helps?

https://github.com/STAT545-UBC/Discussion/issues/383

jdmartinez89 commented 7 years ago

I was really hoping it would, seemed like that would based on Ogans plot on #383 but there is no difference and it is weird because that had never happened. And now if I try to Knit my document I get this error: Error in parse_block(g[-1], g[1], params.src) : duplicate label 'CairoPlot' Calls: ... process_file -> split_file -> lapply -> FUN -> parse_block

jennybc commented 7 years ago

duplicate label 'CairoPlot'

OK don't label all the chunks as 'CairoPlot'. But do include the chunk option dev='CairoPNG'. Those are two separate issues.

jdmartinez89 commented 7 years ago

Thanks for that tip, so now that I was able to Knit I get the .md file with better looking plots, but during visualization in RStudio I still see the low quality versions

samhinshaw commented 7 years ago

This gets into the more complex topic of "graphics devices". Jeff Leek & Roger Peng have a fantastic explanation of this, but basically it means that [Preview Plot] != [Saved Plot].