Skip to content

Commit

Permalink
rename remaining remnants
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Oct 8, 2024
1 parent 249064e commit b25b129
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion R/utils-ggplot2.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ find_global <- function(name, env, mode = "any") {
if (exists(name, envir = env, mode = mode)) {
return(get(name, envir = env, mode = mode))
}
nsenv <- asNamespace("gguidance")
nsenv <- asNamespace("legendry")
if (exists(name, envir = nsenv, mode = mode)) {
return(get(name, envir = nsenv, mode = mode))
}
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
# * https://testthat.r-lib.org/articles/special-files.html

library(testthat)
library(gguidance)
library(legendry)

test_check("gguidance")
test_check("legendry")
10 changes: 5 additions & 5 deletions vignettes/articles/guide_composition.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ knitr::opts_chunk$set(
```

```{r setup}
library(gguidance)
library(legendry)
```

The expert's eye may have noticed that not all exported functionality are full blown [guides](https://teunbrand.github.io/gguidance/articles/tour.html) or [key constructors](https://teunbrand.github.io/gguidance/articles/keys.html).
The expert's eye may have noticed that not all exported functionality are full blown [guides](https://teunbrand.github.io/legendry/articles/tour.html) or [key constructors](https://teunbrand.github.io/legendry/articles/keys.html).
Besides aforementioned important components, let's talk a bit about the innards of guides.

## Stacking
Expand All @@ -37,7 +37,7 @@ standard <- ggplot(mpg, aes(displ, hwy)) +
standard + guides(x = guide_axis_stack("axis", "axis", "axis"))
```

In gguidance, we have the same composition operation: `compose_stack()`.
In legendry, we have the same composition operation: `compose_stack()`.
For your regular axis guides for the `x` and `y` aesthetics, it works the same way as `guide_axis_stack()`.
However, if the guides it stacks supports other aesthetics, like `colour`, it can also be used there.

Expand Down Expand Up @@ -67,7 +67,7 @@ So when we peel back the layers and see what is inside `guide_axis_base()`, will
No: all good things must come to an end and so too must guides have their building blocks.

If the composition is the skeleton then these building blocks are the flesh providing function.
These building blocks are called 'primitives' in gguidance.
These building blocks are called 'primitives' in legendry.
For example, the `guide_axis_base()` function is a stack of three primitives.
They respectively build the axis line, the ticks and the labels.
In the complete guide, they don't have any spacing between them, but let's exaggerate the spacing for clarity.
Expand All @@ -87,7 +87,7 @@ standard +
We've already met the more 'famous' primitives (lines, ticks, labels), so let's round out our acquaintances.
There is a spacer primitive that you can use to increase the spacing between the different pancakes in the stack, as it were.
Then there is also the 'ranged' triplet: brackets, boxes and fences.
These require a more niche [range key](https://teunbrand.github.io/gguidance/articles/keys.html#ranged-keys) and power the display of [nested axes](https://teunbrand.github.io/gguidance/articles/tour.html#nested-axes).
These require a more niche [range key](https://teunbrand.github.io/legendry/articles/keys.html#ranged-keys) and power the display of [nested axes](https://teunbrand.github.io/legendry/articles/tour.html#nested-axes).

```{r}
range_key <- key_range_manual(
Expand Down
12 changes: 6 additions & 6 deletions vignettes/articles/keys.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ knitr::opts_chunk$set(
```

```{r setup}
library(gguidance)
library(legendry)
```

Rather than information that is key, this article will discuss information about keys.
Expand Down Expand Up @@ -39,9 +39,9 @@ standard <- ggplot(mpg, aes(displ, hwy)) +
get_guide_data(standard, aesthetic = "x")
```

## Keys in gguidance
## Keys in legendry

The key difference between keys in gguidance and keys in ggplot2, is that gguidance exposes users to keys.
The key difference between keys in legendry and keys in ggplot2, is that legendry exposes users to keys.
At first, this can be an inconvenience, but it allows for a greater degree of customisation.

### Why use keys?
Expand Down Expand Up @@ -75,7 +75,7 @@ key_manual(aesthetic = c(2, 4, 6))
```

If you want custom labels, you can set the `label` argument.
Most guides in gguidance accept a `key` argument, which will cause the guide to display the information in the key, rather than the information automatically derived from the scale.
Most guides in legendry accept a `key` argument, which will cause the guide to display the information in the key, rather than the information automatically derived from the scale.

```{r}
my_key <- key_manual(aesthetic = c(2, 4, 6), label = c("two", "four", "six"))
Expand All @@ -92,7 +92,7 @@ standard + guides(x = guide_axis_base(key = "minor"))
```

Some keys don't directly return data frames, but return instructions on how these keys should interact with scales.
For example `key_auto()`, the default key for many guides in gguidance, needs to know the range in which to populate tickmarks.
For example `key_auto()`, the default key for many guides in legendry, needs to know the range in which to populate tickmarks.

```{r}
key <- key_auto()
Expand All @@ -108,7 +108,7 @@ key(template, "y")

### Ranged keys

A special type of guide you may find in gguidance are so called 'ranged' guides.
A special type of guide you may find in legendry are so called 'ranged' guides.
The only difference with regular guides is that they do not mark a single point for an aesthetic, but rather use a start- and end-point to mark a range of the aesthetic.
This can be convenient to annotate co-occurrances between the data you are plotting and other events.
For example, we can annotate the airtimes of TV shows in timeseries data.
Expand Down
14 changes: 7 additions & 7 deletions vignettes/articles/tour.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ knitr::opts_chunk$set(
```

```{r setup}
library(gguidance)
library(legendry)
library(scales)
```

This article walks through all full guide extensions to give a broad overview of the 'easy' way to make use of gguidance.
This article walks through all full guide extensions to give a broad overview of the 'easy' way to make use of legendry.
Rest assured, there are harder ways, but these will be covered in a separate article.

## Axes
Expand All @@ -24,7 +24,7 @@ Naturally, axes shine brightest as guides for positions like `x` and `y` but can

### Where (not) to apply

In gguidance, the staple axis is `guide_axis_base()`.
In legendry, the staple axis is `guide_axis_base()`.
At a first glance, these axes are utterly unremarkable and very much mirror `ggplot2::guide_axis()` by design.

```{r}
Expand Down Expand Up @@ -119,7 +119,7 @@ ggplot(df, aes(item, amount)) +
#### Brackets

To change the style of the range indicators, you can choose a different `bracket` setting.
The theme elements `gguidance.bracket` and `gguidance.bracket.size` control the styling and size of the line.
The theme elements `legendry.bracket` and `legendry.bracket.size` control the styling and size of the line.
These settings have a shortcut in `theme_guide()`.

```{r}
Expand Down Expand Up @@ -155,14 +155,14 @@ ggplot(brackets, aes(x, y)) +
coord_equal()
```

Quite possibly, there might be bracket shapes you want to use, but aren't built into gguidance.
Quite possibly, there might be bracket shapes you want to use, but aren't built into legendry.
Luckily, we can build custom brackets, using a numeric matrix that:

* Has 2 columns corresponding to the x and y coordinates.
* Has at least 2 rows.
* Only has values between 0 and 1.

The x-coordinate will be stretched along the axis, whereas y will be squished to fit the `gguidance.bracket.size` theme setting.
The x-coordinate will be stretched along the axis, whereas y will be squished to fit the `legendry.bracket.size` theme setting.
A custom bracket can just be provided to the `bracket` argument.

```{r}
Expand Down Expand Up @@ -233,7 +233,7 @@ First, we'll take a gander at some variants of colour bars before we gander at r

### Bars and steps

Two variants for colour guides exist in {gguidance}:
Two variants for colour guides exist in {legendry}:

1. `guide_colbar()` that reflects `guide_colourbar()`
2. `guide_colsteps()` that reflects `guide_coloursteps()`.
Expand Down

0 comments on commit b25b129

Please sign in to comment.