forked from csgillespie/efficientR
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path06-visualisation.Rmd
47 lines (35 loc) · 1.13 KB
/
06-visualisation.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
knit: bookdown::preview_chapter
---
# Efficient visualisation
## Rough outline
* Efficient base graphics
* Set up par function
* Custom palettes
* ggplot2
* Interactive graphics
* plotly, shiny, leaflet, htmlwidgets
## Cairo type
These are just some thoughts/observations
When you use `cairo` to save plots, we get anti-aliasing. The standard
graphic devices, `png`,and `jpeg` save graphics as either `c("cairo", "Xlib", "quartz")`.
By default, it goes for `getOption("bitmapType")`. Under a proper OS, such as Linux,
this will default to `cairo`. Under windows, it seems to go for `NULL`, which results in using
`X11`
For example, compare
```{r eval=FALSE}
set.seed(1)
x = rnorm(100)
png("fig1.png", type="cairo")
plot(x)
dev.off()
png("fig2.png", type="Xlib")
plot(x)
dev.off()
```
* Can you just force `type="cairo"` in Windows - probably not.
* If you use the `cairo` package under Windows, can you then access `type="cairo"`.
Or do you need to use the `cairo::` functions.
* No idea about Macs.
Search the web brings up a few out of date pages:
* http://gforge.se/2013/02/exporting-nice-plots-in-r/