Skip to content

Commit

Permalink
Iris plots, code and typo correction on README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
DiabbZegpi committed Apr 19, 2020
1 parent db7f3d8 commit b9b560a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions R code/plots.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
library(tidyverse)
library(patchwork)
library(ggforce)

data(iris)
theme_set(theme_ligth())
descrp <- "The smallest specie among virginica and versicolor"


p <-
ggplot(iris,
aes(x = Petal.Width, y = Petal.Length)) +
geom_point() +
geom_mark_ellipse(show.legend = FALSE,
aes(fill = Species,
filter = Species == "setosa",
label = "Iris setosa",
description = descrp)) +
labs(title = "Iris on default Windows PNG engine",
x = "Petal width (cm)", y = "Petal length (cm)")

ggsave(filename = "images/iris_default.png", plot = p,
height = 5, width = 7, units = "in", dpi = 500)


q <- p + labs(title = "Now with Cairo's PNG engine")

ggsave(filename = "images/iris_cairo.png", plot = q,
height = 5, width = 7, units = "in", dpi = 500, type = "cairo")
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

*Why you should prefer Cairo's png engine; visual proof.*

In the past, copying plots from RStudio Plots pane to some document was a pain in the ass, having to deal with horrible graphics quality. I thought that problem was caused by my RStudio version, some issue with my pc or even by Windows. Turns out it's a mix, because **RStudio's default PGN engine for Windows** produces ugly plots.
In the past, copying plots from RStudio Plots pane to some document was a pain in the ass, having to deal with horrible graphics quality. I thought that problem was caused by my RStudio version, some issue with my pc or even by Windows. Turns out it's a mix, because **RStudio's default PNG engine for Windows** produces ugly plots.

Here's what I mean
Binary file added images/iris_cairo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/iris_default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b9b560a

Please sign in to comment.