Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.1%) to scientific vocabulary
Last synced: 9 months ago
·
JSON representation
Repository
Package for generating common plots.
Basic Info
- Host: GitHub
- Owner: wkostelecki
- License: other
- Language: R
- Default Branch: main
- Size: 1.26 MB
Statistics
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 5
- Releases: 8
Created almost 11 years ago
· Last pushed 11 months ago
Metadata Files
Readme
Changelog
License
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
fig.width = 6,
fig.height = 3,
fig.align = "center"
)
```
# ezplot
[](https://app.codecov.io/github/wkostelecki/ezplot?branch=master)
[](https://cran.r-project.org/package=ezplot)
[](https://www.r-pkg.org:443/pkg/ezplot)
[](https://www.r-pkg.org:443/pkg/ezplot)
[](https://lifecycle.r-lib.org/articles/stages.html#maturing)
[](https://github.com/wkostelecki/ezplot/actions)
[](https://github.com/wkostelecki/ezplot/actions/workflows/R-CMD-check.yaml)
## Overview
ezplot provides high-level wrapper functions for common chart types with reduced typing and easy faceting. e.g.:
- `line_plot()`
- `area_plot()`
- `bar_plot()`
- `tile_plot()`
- `waterfall_plot()`
- `side_plot()`
- `secondary_plot()`
## Installation
You can install the released version of ezplot from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("ezplot")
```
And the development version from [GitHub](https://github.com/wkostelecki/ezplot) with:
``` r
# install.packages("devtools")
devtools::install_github("wkostelecki/ezplot")
```
## Usage
```{r load packages}
library(ezplot)
suppressPackageStartupMessages(library(tsibble))
library(tsibbledata)
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(lubridate))
suppressPackageStartupMessages(library(ggplot2))
library(patchwork)
suppressPackageStartupMessages(library(ROCR, warn.conflicts = FALSE))
```
### line_plot
Weekly aggregation:
```{r line_plot-1}
line_plot(ansett, x = "Week", y = "Passengers")
```
Add grouping:
```{r line_plot-2}
line_plot(ansett, x = "Week", y = "Passengers", group = "Class")
```
Add faceting:
```{r line_plot-3, fig.width = 8, fig.height = 5}
line_plot(ansett, x = "Week", y = "Passengers",
group = "Class", facet_x = "Airports",
facet_scales = "free_y") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.38, hjust = 1))
```
Plot YOY comparisons:
```{r line_plot-4, fig.width = 8, fig.height = 4}
line_plot(gafa_stock, "Date", c("Closing Stock Price" = "Close"),
facet_y = "Symbol",
facet_scales = "free_y",
reorder = NULL,
yoy = TRUE,
labels = function(x) ez_labels(x, prepend = "$"))
```
Plot multiple numeric columns:
```{r line_plot-5, fig.width = 7, fig.height = 4}
line_plot(hh_budget,
"Year",
c("DI", "Expenditure", "Savings"),
facet_x = "Country") +
theme(panel.spacing.x = unit(1, "lines")) +
ylab(NULL)
```
### area_plot
Weekly aggregation:
```{r area_plot-1}
area_plot(ansett, x = "as.Date(Week)", y = "Passengers")
```
Add grouping:
```{r area_plot-2}
area_plot(ansett, x = "as.Date(Week)",
y = c("Weekly Passengers" = "Passengers"),
"Class")
```
Add faceting:
```{r area_plot-3, fig.width = 8, fig.height = 4}
area_plot(ansett,
"year(Week) + (month(Week) - 1) / 12",
y = c("Monthly Passengers" = "Passengers"),
group = "substr(Airports, 5, 7)",
facet_x = "substr(Airports, 1, 3)", facet_y = "Class",
facet_scales = "free_y") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.38, hjust = 1))
```
### bar_plot
Yearly aggregation:
```{r bar_plot-1}
bar_plot(subset(aus_retail, year(Month) >= 2010),
x = "year(Month)",
y = "Turnover")
```
With grouping:
```{r bar_plot-2, fig.width = 7, fig.height = 4}
bar_plot(subset(aus_retail, year(Month) >= 2010),
x = "year(Month)",
y = "Turnover",
group = "State")
```
Share of turnover:
```{r bar_plot-3, fig.width = 7, fig.height = 4}
bar_plot(subset(aus_retail, year(Month) >= 2010),
x = "year(Month)",
y = "Turnover",
group = "State",
position = "fill")
```
### tile_plot
```{r tile_plot-1}
nyc_bikes %>%
mutate(duration = as.numeric(stop_time - start_time)) %>%
filter(between(duration, 0, 16)) %>%
tile_plot(c("Trip Start (Hour of Day)" = "lubridate::hour(start_time) + 0.5"),
c("Ride Duration (min)" = "duration - duration %% 2 + 1"))
```
```{r tile_plot-2, fig.width = 7}
tile_plot(vic_elec,
c("Temperature (C)" = "round(Temperature)"),
c("Half-Hourly Demand (MW)" = "round(Demand, -2)"),
labels_y = ez_labels, facet_x = "year(Time)")
```
### waterfall_plot
```{r waterfall_plot-1, fig.height = 4}
waterfall_plot(aus_retail,
"lubridate::year(Month)",
"Turnover",
"sub(' Territory', '\nTerritory', State)",
rotate_xlabel = TRUE)
```
### side_plot
```{r side_plot-1, fig.width = 8}
side_plot(PBS,
"paste(Concession, Type, sep = ' - ')",
c("Scripts", "Cost", "Average Cost" = "~ Cost / Scripts"))
```
### secondary_plot
Plot with secondary y-axis.
```{r secondary_plot-1}
secondary_plot(pelt, "Year",
c("Hare Population" = "Hare"), c("Lynx Population" = "Lynx"),
ylim1 = c(0, 160e3),
ylim2 = c(0, 80e3))
```
### density_plot
```{r density_plot-1}
nyc_bikes %>%
mutate(duration = as.numeric(stop_time - start_time)) %>%
density_plot(c("time of day" = "as.numeric(start_time) %% 86400 / 60 / 60"),
group = "ifelse(wday(start_time) %in% c(1, 7), 'week end', 'week day')")
```
### histogram_plot
```{r histogram_plot-1}
nyc_bikes %>%
mutate(duration = as.numeric(stop_time - start_time)) %>%
histogram_plot(c("time of day" = "as.numeric(start_time) %% 86400 / 60 / 60"),
"density",
group = "ifelse(wday(start_time) %in% c(1, 7), 'week end', 'week day')",
position = "identity",
bins = 48)
```
### Classification data
```{r classification data}
data(ROCR.simple)
df = data.frame(pred = ROCR.simple$predictions,
lab = ROCR.simple$labels)
set.seed(4)
```
### roc_plot
```{r roc_plot-1}
set.seed(4)
roc_plot(df, "pred", "lab") +
roc_plot(df, "pred", "lab", group = "sample(c(0, 1), n(), replace = TRUE)")
```
### pr_plot
Precision-Recall plot
```{r pr_plot-1}
set.seed(4)
pr_plot(df, "pred", "lab") +
pr_plot(df, "pred", "lab", group = "sample(c(0, 1), n(), replace = TRUE)")
```
### lift_plot
```{r lift_plot-1}
set.seed(4)
performance_plot(df, "pred", "lab", x = "rpp", y = "lift") +
performance_plot(df, "pred", "lab", group = "sample(c(0, 1), n(), replace = TRUE)", x = "rpp", y = "lift")
```
Owner
- Name: Wojtek Kostelecki
- Login: wkostelecki
- Kind: user
- Location: London, UK
- Repositories: 12
- Profile: https://github.com/wkostelecki
GitHub Events
Total
- Push event: 3
- Pull request event: 1
- Pull request review event: 1
- Fork event: 1
Last Year
- Push event: 3
- Pull request event: 1
- Pull request review event: 1
- Fork event: 1
Packages
- Total packages: 1
-
Total downloads:
- cran 424 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 19
- Total maintainers: 1
cran.r-project.org: ezplot
Functions for Common Chart Types
- Homepage: https://github.com/wkostelecki/ezplot
- Documentation: http://cran.r-project.org/web/packages/ezplot/ezplot.pdf
- License: MIT + file LICENSE
-
Latest release: 0.8.2
published 10 months ago
Rankings
Dependent repos count: 23.9%
Average: 26.7%
Downloads: 27.6%
Dependent packages count: 28.7%
Maintainers (1)
Last synced:
10 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.3 depends
- dplyr * imports
- forcats * imports
- ggplot2 * imports
- lubridate * imports
- rlang * imports
- DT * suggests
- ROCR * suggests
- covr * suggests
- e1071 * suggests
- knitr * suggests
- methods * suggests
- miniUI * suggests
- rmarkdown * suggests
- shiny * suggests
- stats * suggests
- testthat * suggests
- tibble * suggests
- tidyr * suggests
- tsibble * suggests
- tsibbledata * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/cache v2 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v1 composite
- r-lib/actions/setup-r v1 composite