https://github.com/mfcovington/hearts
https://github.com/mfcovington/hearts
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mfcovington/hearts
- Owner: mfcovington
- Created: 2013-02-18T22:39:39.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-02-19T02:37:50.000Z (over 13 years ago)
- Last Synced: 2025-10-06T22:57:51.490Z (10 months ago)
- Size: 203 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
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