8000 GitHub - teunbrand/legendry at attempt_v1
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A 'ggplot2' extension that focusses on expanding the plotter's arsenal of guides, such as axes, legends and colour bars. It brings various improvements to existing guides by re-implementation, as well as adding novel guides.

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

teunbrand/legendry

 
 

Repository files navigation

gguidance

CRAN status Lifecycle: experimental R-CMD-check Codecov test coverage

Warning Don’t rely on current functionality for important scripts 8000 yet. It is very likely that ggplot2 changes their implementation of guides in the release after 3.4.0. At that point, the current functionality will cease to work.

The goal of gguidance is to provide additional guides to the ggplot2 ecosystem. Guides are re-implemented within the ggproto system to make use of the flexible extension framework.

Please note that this repo is still being worked on and, while probably usable, isn’t finished.

Installation

You can install the development version of gguidance from GitHub with:

# install.packages("devtools")
devtools::install_github("teunbrand/gguidance")

Examples

Here is a simple example of how to use an axis guide and a colour bar guide.

library(gguidance)
#> Loading required package: ggplot2

ggplot(msleep, aes(bodywt, sleep_total)) +
  geom_point(aes(colour = sleep_rem)) +
  scale_colour_viridis_c(guide = "colourbar_cap") +
  scale_x_log10(guide = "axis_log")
#> Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
#> Please use the `linewidth` argument instead.
#> Warning: The `size` argument of `element_rect()` is deprecated as of ggplot2 3.4.0.
#> Please use the `linewidth` argument instead.

Demonstrating a cross legend and axis subtitles.

ggplot(mpg, aes(displ, hwy)) +
  geom_point(aes(colour = paste(cyl, year))) +
  guides(colour = "legend_cross",
         x = guide_axis_ext(subtitle = "litres"),
         y = guide_axis_ext(subtitle = "miles per gallon"))

Progress

So far, the following has been implemented:

  • Axis guides
    • guide_axis_vanilla(): A re-implementation of guide_axis().
    • guide_axis_ext(): Extended options for axes.
    • guide_axis_minor(): Axes with minor ticks.
    • guide_axis_trunc(): Axes with truncated axis lines.
    • guide_axis_log(): Axes with log10-based tickmarks.
    • guide_axis_table(): Place a table at tickmarks.
  • Legend guides
    • guide_legend_vanilla(): A re-implementation of guide_legend().
    • guide_legend_cross(): Combining two sets of labels in one legend.
  • Colour bar guides
    • guide_colourbar_vanilla(): A re-implementation of guide_colourbar().
    • guide_colourbar_cap(): With cap decorations at the ends.
  • Coordinate guides (a new feature in coord_guided())
    • guide_grid_vanilla(): A re-implementation of default panel grids.
    • guide_grid_zebra(): Alternating stripes at/between breaks.
    • guide_grid_swap(): Displaying major grid as minor and minor grid as major. Convenient for separating places in discrete scales.

Notes

A medium-term goal is to move and refactor guides from the {ggh4x} package to {gguidance}. A longer-term goal is to make this package a hub for additional axes, legends and other guides.

About

A 'ggplot2' extension that focusses on expanding the plotter's arsenal of guides, such as axes, legends and colour bars. It brings various improvements to existing guides by re-implementation, as well as adding novel guides.

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Code of conduct

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages

0