Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 28 additions & 37 deletions vignettes/gallery.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,108 +22,99 @@ Click on a plot to get the link to its code.
```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_01.R){target='_blank'}"
#| file: "gallery_figs/gallery_01.R"
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/points-by-iris.R){target='_blank'}"
#| file: "gallery_figs/points-by-iris.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_02.R){target='_blank'}"
#| file: "gallery_figs/gallery_02.R"
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/points-by-facet-iris.R){target='_blank'}"
#| file: "gallery_figs/points-by-facet-iris.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_03.R){target='_blank'}"
#| file: "gallery_figs/gallery_03.R"
#| fig-asp: .5
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/hist-by-iris.R){target='_blank'}"
#| file: "gallery_figs/hist-by-iris.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_04.R){target='_blank'}"
#| file: "gallery_figs/gallery_04.R"
#| fig-asp: .5
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/bubble-penguins.R){target='_blank'}"
#| file: "gallery_figs/bubble-penguins.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_05.R){target='_blank'}"
#| file: "gallery_figs/gallery_05.R"
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/spineplot-titanic.R){target='_blank'}"
#| file: "gallery_figs/spineplot-titanic.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_06.R){target='_blank'}"
#| file: "gallery_figs/gallery_06.R"
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/ridge-aq.R){target='_blank'}"
#| file: "gallery_figs/ridge-aq.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_07.R){target='_blank'}"
#| file: "gallery_figs/gallery_07.R"
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/add-points-rug-faithful.R){target='_blank'}"
#| file: "gallery_figs/add-points-rug-faithful.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_08.R){target='_blank'}"
#| file: "gallery_figs/gallery_08.R"
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/errorbar-mtcars.R){target='_blank'}"
#| file: "gallery_figs/errorbar-mtcars.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_09.R){target='_blank'}"
#| file: "gallery_figs/gallery_09.R"
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/polygons.R){target='_blank'}"
#| file: "gallery_figs/polygons.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_10.R){target='_blank'}"
#| file: "gallery_figs/gallery_10.R"
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/rect-by.R){target='_blank'}"
#| file: "gallery_figs/rect-by.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_11.R){target='_blank'}"
#| file: "gallery_figs/gallery_11.R"
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/boxplot-by-penguins.R){target='_blank'}"
#| file: "gallery_figs/boxplot-by-penguins.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_12.R){target='_blank'}"
#| file: "gallery_figs/gallery_12.R"
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/add-text-mtcars.R){target='_blank'}"
#| file: "gallery_figs/add-text-mtcars.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_13.R){target='_blank'}"
#| file: "gallery_figs/gallery_13.R"
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/add-ablines.R){target='_blank'}"
#| file: "gallery_figs/add-ablines.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_14.R){target='_blank'}"
#| file: "gallery_figs/gallery_14.R"
```

```{r}
#| lightbox:
#| group: r-graph
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/gallery_15.R){target='_blank'}"
#| file: "gallery_figs/gallery_15.R"
#| description: "[Code](https://github.com/grantmcdermott/tinyplot/blob/main/vignettes/gallery_figs/density-part-shading.R){target='_blank'}"
#| file: "gallery_figs/density-part-shading.R"
```

:::
5 changes: 5 additions & 0 deletions vignettes/gallery_figs/add-ablines.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
library("tinyplot")

tinyplot(mpg ~ hp | cyl, facet = "by", data = mtcars)
tinyplot_add(type = type_hline(with(mtcars, tapply(mpg, cyl, mean))), lty = 2)
tinyplot_add(type = type_vline(with(mtcars, tapply(hp, cyl, mean))), lty = 2)
8 changes: 8 additions & 0 deletions vignettes/gallery_figs/add-lm-iris.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
library(tinyplot)

tinyplot(
Sepal.Width ~ Petal.Width | Species,
data = iris,
theme = "ipsum"
)
tinyplot_add(type = "lm")
6 changes: 6 additions & 0 deletions vignettes/gallery_figs/add-points-rug-faithful.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
library("tinyplot")
tinyplot(eruptions ~ waiting, data = faithful, type = "lm",
theme = "tufte", palette = c("darkcyan"))
tinyplot_add(type = "p", pch = 21, col = "white", fill = 0.3, cex = 1.5)
tinyplot_add(type = type_rug(jitter = TRUE, amount = 0.3))
tinyplot_add(type = type_rug(jitter = TRUE, amount = 0.1, side = 2))
14 changes: 14 additions & 0 deletions vignettes/gallery_figs/add-text-mtcars.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
library("tinyplot")

plt(
mpg ~ hp | factor(cyl),
data = mtcars,
legend = list("topright!", bty = "o"),
theme = "classic"
)
plt_add(type = type_text(
labels = row.names(mtcars),
adj = -0.05,
srt = 15,
xpd = NA
))
9 changes: 9 additions & 0 deletions vignettes/gallery_figs/boxplot-by-penguins.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
library("tinyplot")

plt(
body_mass ~ species | sex, data = penguins,
type = type_boxplot(boxwex = 0.6, staplewex = 0, outline = FALSE),
lty = 1,
flip = TRUE, yaxl = ",",
grid = TRUE
)
14 changes: 14 additions & 0 deletions vignettes/gallery_figs/bubble-penguins.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
library(tinyplot)

with(
na.omit(penguins),
plt(
y = bill_len, x = bill_dep, by = sex,
facet = species,
cex = body_mass, clim = c(0.5, 4.5),
col = 'white', fill = 0.5, pch = 21,
legend = list(labeller = ","),
type = "p",
theme = "clean2"
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ tinyplot(
type = "density",
fill = "by",
main = "Distribution of petal lengths",
sub = "Grouped by species"
sub = "Grouped by species",
theme = "bw"
)
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
library(tinyplot)
tinytheme("minimal")

# fit a model and extract coefficients
mod = lm(mpg ~ wt * factor(am), mtcars)
coefs = data.frame(names(coef(mod)), coef(mod), confint(mod))
colnames(coefs) = c("term", "est", "lwr", "upr")

# plot the coefficients with error bars
with(
coefs,
tinyplot(
x = term, y = est, ymin = lwr, ymax = upr,
type = type_errorbar(length = 0.1)
)
tinyplot(
est ~ term, data = coefs,
ymin = lwr, ymax = upr,
type = "errorbar",
flip = TRUE,
draw = abline(v = 0, lty = 2, col = "grey50"),
theme = "classic"
)


tinytheme() # reset theme (optional)
9 changes: 0 additions & 9 deletions vignettes/gallery_figs/gallery_05.R

This file was deleted.

6 changes: 0 additions & 6 deletions vignettes/gallery_figs/gallery_09.R

This file was deleted.

9 changes: 0 additions & 9 deletions vignettes/gallery_figs/gallery_10.R

This file was deleted.

10 changes: 0 additions & 10 deletions vignettes/gallery_figs/gallery_11.R

This file was deleted.

8 changes: 0 additions & 8 deletions vignettes/gallery_figs/gallery_13.R

This file was deleted.

5 changes: 0 additions & 5 deletions vignettes/gallery_figs/gallery_14.R

This file was deleted.

11 changes: 11 additions & 0 deletions vignettes/gallery_figs/hist-by-iris.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
library("tinyplot")

tinyplot(
~Petal.Length | Species,
data = iris,
type = "histogram",
breaks = 30,
main = "Histogram of petal lengths",
sub = "Grouped by species",
theme = "bw"
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ tinyplot(
Sepal.Length ~ Petal.Length | Sepal.Length,
data = iris,
facet = ~Species,
pch = 19,
main = "Faceted flowers",
sub = "Brought to you by tinyplot"
pch = 19
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
library("tinyplot")

tinyplot(
plt(
x = 1:9,
y = c(2,1,2,1,NA,2,1,2,1),
type = type_polygon(density = c(10, 20)))
type = type_polygon(density = c(10, 20))
)
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
library("tinyplot")
tinytheme("clean")

i = 4*(0:10)

tinyplot(
xmin = 100+i, ymin = 300+i, xmax = 150+i, ymax = 380+i,
by = i, fill = 0.2,
type = "rect",
palette = "viridis"
theme = "clean"
)

tinytheme() # reset theme (optional)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ aq = transform(

tinyplot(Month ~ Temp | Temp,
data = aq,
type = type_ridge(col = "white")
type = type_ridge(col = "white"),
theme = "ridge2"
)

tinytheme() # reset theme (optional)