-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
137 lines (103 loc) · 4.31 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# gg1d <a href="https://selkamand.github.io/gg1d/"><img src="man/figures/logo.png" align="right" height="138" alt="gg1d website" /></a>
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/gg1d)](https://CRAN.R-project.org/package=gg1d)
[![R-CMD-check](https://github.com/selkamand/gg1d/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/selkamand/gg1d/actions/workflows/R-CMD-check.yaml)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![Codecov test coverage](https://codecov.io/gh/selkamand/gg1d/branch/main/graph/badge.svg)](https://app.codecov.io/gh/selkamand/gg1d?branch=main)
![GitHub Issues or Pull Requests](https://img.shields.io/github/issues-closed/selkamand/gg1d)
[![code size](https://img.shields.io/github/languages/code-size/selkamand/gg1d.svg)](https://github.com/selkamand/gg1d)
![GitHub last commit](https://img.shields.io/github/last-commit/selkamand/gg1d)
<!-- badges: end -->
Effortlessly visualize all columns in a data frame with vertically aligned plots and automatic plot selection based on variable type. Plots are fully interactive, and custom tooltips can be added.
A graphical user interface to all gg1d visualisations is available at https://selkamand.github.io/EDA/
**Why 1 dimensional plots?**
To understand trends in your data, especially correlative relationships between 2 or more features, it can be useful to densely stack visual representations of each feature vertically, regardless of data type. By unifying the $x$-axis across each plot, **gg1d** turns a series of 1D plots into an $n\text{-dimensional}$ visualization where $n = \text{number of columns in dataset}$.
Note the key idea of gg1d is to 'preserve the individual.' **gg1d** does **NOT** plot distributions of properties, but rather each value of a feature for each subject/observation in the dataset.
gg1d can be used for exploratory data analysis (EDA) or to produce publication quality graphics summarizing a dataset.
## Installation
``` r
install.packages("gg1d")
```
### Development Version
You can install the development version of gg1d from [GitHub](https://github.com/) with:
``` r
if (!require("remotes"))
install.packages("remotes")
remotes::install_github("selkamand/gg1d")
```
## Quick Start
For examples of interactive gg1d plots see the [gg1d gallery](https://selkamand.github.io/gg1d/articles/gallery.html)
```{r, example, fig.width = 7, fig.height = 5}
# Load library
library(gg1d)
# Read data
path_gg1d <- system.file("example.csv", package = "gg1d")
df <- read.csv(path_gg1d, header = TRUE, na.strings = "")
# Plot data, sort by Glasses
gg1d(
df,
col_id = "ID",
col_sort = "Glasses",
interactive = FALSE,
verbose = FALSE,
options = gg1d_options(legend_nrow = 2)
)
```
## Customise Colours
Customise colours by supplying a named list to the `palettes` argument
```{r customise_colours, fig.width = 7, fig.height = 5}
gg1d(
df,
col_id = "ID",
col_sort = "Glasses",
palettes = list("EyeColour" = c(
Brown = "rosybrown4",
Blue = "steelblue",
Green = "seagreen"
)),
interactive = FALSE,
verbose = FALSE,
options = gg1d_options(legend_nrow = 2)
)
```
## Parallel Coordinate Plots
For datasets with many observations and mostly numeric features, parallel coordinate plots may be more appropriate.
```{r minibeans_class, fig.width = 7, fig.height = 5}
ggparallel(
data = minibeans,
col_colour = "Class",
order_columns_by = "auto",
interactive = FALSE
)
```
```{r minibeans_highlight, fig.width = 7, fig.height = 5}
ggparallel(
data = minibeans,
col_colour = "Class",
highlight = "DERMASON",
order_columns_by = "auto",
interactive = FALSE
)
```
```{r minibeans_noclass, fig.width = 7, fig.height = 5}
ggparallel(
data = minibeans,
order_columns_by = "auto",
interactive = FALSE
)
```
## Community Contributions
All types of contributions are encouraged and valued. See our [guide to
community contributions](https://selkamand.github.io/gg1d/CONTRIBUTING.html) for different ways to help.