Skip to content

Commit

Permalink
README revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
evanbiederstedt committed Sep 15, 2020
1 parent c22e92a commit 7548025
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# ggrastr

Provides a set of ggplot2 [geoms](https://ggplot2.tidyverse.org/reference/#section-geoms) to rasterize only specific layers of the plot (e.g. large scatterplots with many points), while keeping all labels and text in vector format. This allows users to keep plots within a reasonable size limit without losing the vector properties of scale-sensitive information.
Provides a set of ggplot2 [geoms](https://ggplot2.tidyverse.org/reference/#section-geoms) to rasterize only specific layers of the plot (e.g. large scatter plots with many points), while keeping all labels and text in vector format. This allows users to keep plots within a reasonable size limit without losing the vector properties of scale-sensitive information.

## Installation

Expand All @@ -23,23 +23,24 @@ devtools::install_github('VPetukhov/ggrastr', build_vignettes = TRUE)

## Rasterize any ggplot2 layer

Note that with ggrastr version 0.2.0, any ggplot2 geom provided by the user can be rasterized with the function `rasterise()`. Furthermore, when the aspect ratio is distorted, points are rendered without distortion.
Note that with `ggrastr` version 0.2.0, any ggplot2 geom provided by the user can be rasterized with the function `rasterise()`. Furthermore, when the aspect ratio is distorted, points are rendered without distortion.

For more details and examples, see the [vignettes](https://htmlpreview.github.io/?https://raw.githubusercontent.com/VPetukhov/ggrastr/master/doc/Raster_geoms.html).

## Geoms provided

We alo provide wrappers for several geoms to guarantee compatibility with an older version of `ggrast`. Though we encourage to use the `rasterise` function instead.
We alo provide wrappers for several geoms to guarantee compatibility with an older version of `ggrastr`. However, we encourage users to use the `rasterise()` function instead.

* `geom_point_rast`: raster scatterplots
* `geom_jitter_rast`: raster jittered scatterplots
* `geom_point_rast`: raster scatter plots
* `geom_jitter_rast`: raster jittered scatter plots
* `geom_boxplot_jitter`: boxplots that allows to jitter and rasterize outlier points
* `geom_tile_rast`: raster heatmap
* `geom_beeswarm_rast`: raster [bee swarm plots](https://github.com/eclarke/ggbeeswarm#geom_beeswarm)
* `geom_quasirandom_rast`: raster [quasirandom scatterplot](https://github.com/eclarke/ggbeeswarm#geom_quasirandom)
* `geom_quasirandom_rast`: raster [quasirandom scatter plot](https://github.com/eclarke/ggbeeswarm#geom_quasirandom)


## Troubleshooting

If your R session crashes when you try to render a rasterized plot, it's probably the case that your version of Cairo was built for another
version of R (see [Upgrading to a new version of R](https://shiny.rstudio.com/articles/upgrade-R.html)). To check if
you are using a proper version, run the command below and ensure that the "Built" version is the same as your R version.
Expand All @@ -51,10 +52,11 @@ pkgs[pkgs$Package == 'Cairo', c("Package", "LibPath", "Version", "Built")]
To ensure that Cairo works, try running `Cairo::Cairo(type='raster'); dev.off()` and check if it crashes your R session.

## Citation

If you find `ggrastr` useful for your publication, please cite:

```
Viktor Petukhov, Teun van den Brand and Evan Biederstedt (2020).
ggrastr: Raster Layers for 'ggplot2'. R package version 0.1.9.
ggrastr: Raster Layers for 'ggplot2'. R package version 0.2.1.
https://CRAN.R-project.org/package=ggrastr
```
6 changes: 3 additions & 3 deletions vignettes/Raster_geoms.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ plot + rasterise(geom_point(), dpi = 300) + facet_wrap(~ sample(1:3, nrow(diamon



### Points: Rasterize scatterplots with geom_point_rast()
### Points: Rasterize scatter plots with geom_point_rast()
Sometimes you need to publish a figure in a vector format:
```{r, fig.width=4, fig.height=4}
library(ggplot2)
Expand Down Expand Up @@ -124,9 +124,9 @@ PrintFileSize(gg_rast, 'Raster')
PrintFileSize(gg_vec, 'Vector')
```

### Jitter: Rasterize jittered scatterplots with geom_jitter_rast()
### Jitter: Rasterize jittered scatter plots with geom_jitter_rast()

Just like the example above with`geom_point_rast()`, users may also opt to create rasterized scatterplots with jitter. The geom `geom_jitter_rast()` is similar to `ggplot2::geom_jitter()`, but it creates a rasterized layer:
Just like the example above with`geom_point_rast()`, users may also opt to create rasterized scatter plots with jitter. The geom `geom_jitter_rast()` is similar to `ggplot2::geom_jitter()`, but it creates a rasterized layer:


```{r, fig.width=4, fig.height=4}
Expand Down

0 comments on commit 7548025

Please sign in to comment.