An open API service indexing awesome lists of open source software.

https://github.com/mfcovington/hearts


https://github.com/mfcovington/hearts

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# The Random Heart Generator

I made [The Random Heart Generator][RANDOM_HEART_GENERATOR] for Valentine's Day as part of a weekly class I help teach on R and ggplot.

## Defaults

The default parameters of The Random Heart Generator are:

```{r eval = FALSE}
hearts(n = 5, up = TRUE, free.love = FALSE)
```

## Usage

The Random Heart Generator plots five hearts of random size, position, and color (from the [rainbow color palette][COLOR_PALETTE]):

```{r default_hearts}
source("random_heart_generator.R")
hearts()
```

By changing `n`, you can plot any number of hearts:

```{r ten_hearts}
hearts(n = 10)
```

However, if you try to plot too many (100+), you will get a warning to help prevent R from becoming non-responsive:

```{r}
hearts(n = 150)
```

This safeguard can be bypassed with the `free.love` option:

```{r lots_of_hearts}
hearts(n = 150, free.love = TRUE)
```

Since love can be messy, you can make your plot a bit more chaotic by changing the `up` option:

```{r up+down_hearts}
hearts(up = FALSE)
```

[COLOR_PALETTE]: http://stat.ethz.ch/R-manual/R-patched/library/grDevices/html/palettes.html
[RANDOM_HEART_GENERATOR]: random_heart_generator.R