Browse Source

vignettes this time, perhaps

master
boB Rudis 5 years ago
parent
commit
e66a6e2fa0
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 2
      DESCRIPTION
  2. 39
      inst/LICENSE
  3. 9
      vignettes/building-pictograms.Rmd
  4. 12
      vignettes/building-waffle-charts.Rmd

2
DESCRIPTION

@ -25,12 +25,12 @@ Description: Square pie charts (a.k.a. waffle charts) can be used
Encoding: UTF-8
URL: https://gitlab.com/hrbrmstr/waffle
BugReports: https://gitlab.com/hrbrmstr/waffle/issues
Copyright: file inst/COPYRIGHTS
Suggests:
testthat,
knitr,
rmarkdown,
dplyr,
hrbrthemes,
ggthemes
Depends:
R (>= 3.5.0),

39
inst/LICENSE

@ -0,0 +1,39 @@
The {waffle} pacakge is GPL-2 as stated in the DESCRIPTION.
The included Font Awesome 5 fonts in inst/json along with the JSON representation
of them in inst/json have the following license coverage:
Font Awesome Free License
-------------------------
Font Awesome Free is free, open source, and GPL friendly. You can use it for
commercial projects, open source projects, or really almost whatever you want.
Full Font Awesome Free license: https://fontawesome.com/license/free.
# Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)
In the Font Awesome Free download, the CC BY 4.0 license applies to all icons
packaged as SVG and JS file types.
# Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL)
In the Font Awesome Free download, the SIL OFL license applies to all icons
packaged as web and desktop font files.
# Code: MIT License (https://opensource.org/licenses/MIT)
In the Font Awesome Free download, the MIT license applies to all non-font and
non-icon files.
# Attribution
Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font
Awesome Free files already contain embedded comments with sufficient
attribution, so you shouldn't need to do anything additional when using these
files normally.
We've kept attribution comments terse, so we ask that you do not actively work
to remove them from files, especially code. They're a great way for folks to
learn about Font Awesome.
# Brand Icons
All brand icons are trademarks of their respective owners. The use of these
trademarks does not indicate endorsement of the trademark holder by Font
Awesome, nor vice versa. **Please do not use brand logos for any purpose except
to represent the company, product, or service to which they refer.**

9
vignettes/building-pictograms.Rmd

@ -18,7 +18,6 @@ knitr::opts_chunk$set(
```{r libs}
library(waffle)
library(hrbrthemes)
library(extrafont)
library(dplyr)
```
@ -78,7 +77,7 @@ Here's what a traditional waffle chart might look like for that:
ggplot(xdf, aes(fill = food_group, values = consumption)) +
geom_waffle() +
coord_equal() +
theme_ipsum_rc(grid="") +
theme_minimal() +
theme_enhance_waffle()
```
@ -88,7 +87,7 @@ Really, you should be making proportional waffle charts since the whole point is
ggplot(xdf, aes(fill = food_group, values = consumption)) +
geom_waffle(n_rows = 10, make_proportional = TRUE) +
coord_equal() +
theme_ipsum_rc(grid="") +
theme_minimal() +
theme_enhance_waffle()
```
@ -111,7 +110,7 @@ ggplot(xdf, aes(label = food_group, values = consumption)) +
)
) +
coord_equal() +
theme_ipsum_rc(grid="") +
theme_minimal() +
theme_enhance_waffle() +
theme(legend.key.height = unit(2.25, "line")) +
theme(legend.text = element_text(size = 10, hjust = 0, vjust = 0.75))
@ -141,7 +140,7 @@ ggplot(xdf, aes(label = food_group, values = consumption, color = food_group)) +
)
) +
coord_equal() +
theme_ipsum_rc(grid="") +
theme_minimal() +
theme_enhance_waffle() +
theme(legend.key.height = unit(2.25, "line")) +
theme(legend.text = element_text(size = 10, hjust = 0, vjust = 0.75))

12
vignettes/building-waffle-charts.Rmd

@ -3,8 +3,10 @@ title: "Building Waffle Charts"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Building Waffle Charts}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{knitr::rmarkdown}
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
@ -15,7 +17,6 @@ knitr::opts_chunk$set(
```
```{r libs}
library(hrbrthemes)
library(waffle)
library(ggplot2)
library(dplyr)
@ -47,7 +48,7 @@ xdf %>%
expand_limits(x=c(0,0), y=c(0,0)) +
coord_equal() +
labs(fill = NULL, colour = NULL) +
theme_ipsum_rc(grid="") +
theme_minimal() +
theme_enhance_waffle() -> waf
```
@ -218,6 +219,7 @@ waf +
n_rows = 5, color = "white", show.legend = FALSE, flip = TRUE
) +
facet_wrap(~states) +
theme_minimal() +
theme(panel.spacing.x = unit(0, "npc")) +
theme(strip.text.x = element_text(hjust = 0.5))
```
@ -232,7 +234,7 @@ xdf %>%
expand_limits(x=c(0,0), y=c(0,0)) +
coord_equal() +
labs(fill = NULL, colour = NULL) +
theme_ipsum_rc(grid="") +
theme_minimal() +
theme_enhance_waffle() -> buf
```
@ -246,7 +248,7 @@ buf +
color = "white", size = 0.33
) +
facet_wrap(~fct) +
theme(strip.text.x = element_text(hjust = 0.5))
theme(strip.text.x = element_text(hjust = 0.5))
```
Again, waffles generally work better when they are square and each one sums to 100 and this is even more true in a buffet grid of waffles:

Loading…
Cancel
Save