diff --git a/articles/keys.html b/articles/keys.html index 14116db..7246d48 100644 --- a/articles/keys.html +++ b/articles/keys.html @@ -188,8 +188,8 @@

Regular keys#> class(df) <- c("key_standard", "key_guide", class(df)) #> df #> } -#> <bytecode: 0x556cceacdeb8> -#> <environment: 0x556ccead2ba0> +#> <bytecode: 0x55d384551cf0> +#> <environment: 0x55d384554ab8>

We can preview what values they’d label by letting the key absorb a scale with known limits.

diff --git a/pkgdown.yml b/pkgdown.yml
index c58580b..103b933 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -5,7 +5,7 @@ articles:
   articles/guide_composition: guide_composition.html
   articles/keys: keys.html
   articles/tour: tour.html
-last_built: 2024-12-13T19:12Z
+last_built: 2024-12-13T20:00Z
 urls:
   reference: https://teunbrand.github.io/legendry/reference
   article: https://teunbrand.github.io/legendry/articles
diff --git a/reference/guide_axis_nested.html b/reference/guide_axis_nested.html
index afa362e..2bb281e 100644
--- a/reference/guide_axis_nested.html
+++ b/reference/guide_axis_nested.html
@@ -77,9 +77,12 @@ 

Argumentskey -

A range key specification. If not -key = "range_auto", additional labels will be inserted to represent -point values.

+

One of the following:

  • A range key specification. If not key = "range_auto", +additional labels will be inserted to represent point values.

  • +
  • A <character[1]> passed to the key_range_auto(sep) +argument. An exception is made when the string is a valid key +specification.

  • +
regular_key
diff --git a/search.json b/search.json index 17295c0..7735d72 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":[]},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement tahvdbrand@gmail.com. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.1, available https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines inspired [Mozilla’s code conduct enforcement ladder][https://github.com/mozilla/inclusion]. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https://www.contributor-covenant.org/translations.","code":""},{"path":"https://teunbrand.github.io/legendry/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 Teun van den Brand Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"stacking","dir":"Articles","previous_headings":"","what":"Stacking","title":"A guide to guide composition","text":"cut open guide examine innards spilling , eyes first meets skeleton holds guide together. skeleton composition guide: guide whose task render compose guides. composition guide may entirely foreign ggplot2-user. vanilla ggplot2 also contains composition guide, namely guide_axis_stack(). accepts input guide specifications stacks guides top one another. legendry, composition operation: compose_stack(). regular axis guides x y aesthetics, works way guide_axis_stack(). However, guides stacks supports aesthetics, like colour, can also used .","code":"standard <- ggplot(mpg, aes(displ, hwy)) + geom_point() + labs( x = \"Engine displacement (litres)\", y = \"Highway Miles per Gallon\" ) + theme(axis.line = element_line()) standard + guides(x = guide_axis_stack(\"axis\", \"axis\", \"axis\")) staxis <- compose_stack(\"axis_base\", \"axis_base\", \"axis_base\") standard + aes(colour = cty) + guides( x = staxis, colour = guide_colbar(first_guide = staxis, second_guide = \"none\") ) + theme(legend.axis.line = element_line())"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"primitives","dir":"Articles","previous_headings":"","what":"Primitives","title":"A guide to guide composition","text":"point, might wise take closer look exactly guide_axis_base() . pull threads class , mystery starts unravel: Indeed, using compose_stack(\"axis_base\", \"axis_base\", ...) stacking stack! peel back layers see inside guide_axis_base(), find stacks? : good things must come end must guides building blocks. composition skeleton building blocks flesh providing function. building blocks called ‘primitives’ legendry. example, guide_axis_base() function stack three primitives. respectively build axis line, ticks labels. complete guide, don’t spacing , let’s exaggerate spacing clarity.","code":"class(guide_axis_base()) #> [1] \"ComposeStack\" \"Compose\" \"Guide\" \"ggproto\" \"gg\" standard + guides(x = compose_stack( primitive_line(), primitive_ticks(), primitive_labels(), theme = theme_guide(spacing = unit(5, \"pt\")) ))"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"introducing-the-rest-of-the-family","dir":"Articles","previous_headings":"Primitives","what":"Introducing the rest of the family","title":"A guide to guide composition","text":"’ve already met ‘famous’ primitives (lines, ticks, labels), let’s round acquaintances. spacer primitive can use increase spacing different pancakes stack, . also ‘ranged’ triplet: brackets, boxes fences. require niche range key power display nested axes. last member family primitive_title(). Aside just displaying text, three things: >1 title, distribute titles along range. makes convenient label lower higher ends scale. ‘absorbs’ regular axis title turning . title primitive guide actual title, makes slightly easier prevent unwanted double titles. implemented guide, take place regular axis titles. also means titles repeat facets.","code":"range_key <- key_range_manual( start = c(2, 4), end = c(5, 6), name = c(\"First\", \"Second\") ) standard + guides(x = compose_stack( \"axis_base\", primitive_bracket(range_key, \"curvy\"), primitive_spacer(unit(0.5, \"cm\")), primitive_box(range_key), primitive_spacer(unit(0.5, \"cm\")), primitive_fence(range_key, rail = \"outer\") )) standard + scale_x_continuous(guide = compose_stack( primitive_title(c( \"Sneaky little displacementses\", \"We needs it. Must have the displament\") ), primitive_title(\"Gollum explains engine displacement to you\") )) + labs(x = \"A normal person explains engine displacement\") last_plot() + facet_grid(~ year)"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"dont-use-primitives-directly","dir":"Articles","previous_headings":"Primitives","what":"Don’t use primitives directly","title":"A guide to guide composition","text":"giving primitive_-prefix, made impossible use name inside function don’t expect . acts little bit discouragement using primitives complete guides. However, can use primitives name inside guide composition functions, use full constructor function.","code":"standard + guides(x.sec = \"ticks\") #> Error in `validate_guide()`: #> ! Unknown guide: ticks standard + guides(x.sec = compose_stack(\"ticks\")) # Looks identical to the above standard + guides(x.sec = primitive_ticks())"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"sandwiching","dir":"Articles","previous_headings":"","what":"Sandwiching","title":"A guide to guide composition","text":"Aside making stack primitives, can also build sandwich primitives. Analogous two pieces bread outside good bits inside, sandwich composition guides often sees centrepiece flanked two guides. Similar naively believed guide_axis_stack() little snowflake guide, guide_colbar() fact composition: Focussing ‘bread’ part first, two guides can use flanking innards. One called ‘text’ one called ‘opposite’. called ‘text’ ‘opposite’ ‘text’-guide take position indicated legend.text.position theme element. Perhaps unsurprisingly; guide end called ‘opposite’ guide. can expose swapping theme element. also noted guide label-supression mechanism, ‘opposite’ guide drawn surpressed labels. mechanism place guides like guide_axis()/guide_axis_base() display example facet_grid(axis.labels = \"margins\"). thing guide_colbar() , compose_sandwich() , adjust theme settings match ggplot2::guide_colourbar() closely. Alright, fine, get ‘bread’ part sandwich! inside? ’m glad asked.","code":"class(guide_colbar()) #> [1] \"ComposeSandwich\" \"Compose\" \"Guide\" \"ggproto\" #> [5] \"gg\" standard + aes(colour = cty) + scale_colour_viridis_c( guide = compose_sandwich( text = primitive_labels(), opposite = primitive_ticks() ) ) last_plot() + theme(legend.text.position = \"left\") standard + aes(colour = cty) + scale_colour_viridis_c( guide = compose_sandwich( text = \"axis_base\", opposite = \"axis_base\" ) ) # The same plot standard + aes(colour = cty) + scale_colour_viridis_c( guide = guide_colbar(vanilla = FALSE) )"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"gizmos","dir":"Articles","previous_headings":"","what":"Gizmos","title":"A guide to guide composition","text":"insides guide_colbar() called ‘gizmo’. gizmo differs primitive gizmo general building block, rather specialised display particular aesthetic. Also, complete guide allow complete crucial task translating graphic display interpretation data. called ‘gizmo’ sort gadget don’t appropriate name . Hence: gizmo.","code":""},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"my-first-gizmo","dir":"Articles","previous_headings":"Gizmos","what":"My first gizmo","title":"A guide to guide composition","text":"can display gizmo guide_colbar() —sandwich spread, — gizmo_barcap(). also immediately clear need bread case. Similarly guide_colsteps() gizmo_stepcap(), might second gizmo may already encountered.","code":"standard + aes(colour = cty) + scale_colour_viridis_c( guide = gizmo_barcap() )"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"exotic-gizmos","dir":"Articles","previous_headings":"Gizmos","what":"Exotic gizmos","title":"A guide to guide composition","text":"also gizmos may less familiar. reasonably simple one gizmo_grob(), just allows place grob guide. example, can stack axis, use non-bread part sandwich. Please note good representation plot’s colour aesthetic. hope wouldn’t necessary : don’t make plot like ! Perhaps gizmo’s inherently useful gizmo_density() gizmo_histogram(). default, wrap density() hist() functions called layer’s data. can pass arguments functions density.args hist.args respectively. ’ll repeat : gizmos, full guides. Also: please ignore ’re guiding colour fill colour visible. However, can easily promote gizmos full guide adding axis. compose_sandwich() can reasonable job .","code":"my_grob <- grid::grobTree( grid::rectGrob(), grid::textGrob(\"Grob\\nGizmo\") ) my_gizmo <- gizmo_grob(my_grob, width = unit(2, \"cm\"), height = unit(2, \"cm\")) standard + aes(colour = cty) + guides( x = compose_stack(\"axis\", my_gizmo), colour = compose_sandwich(middle = my_gizmo, text = \"axis_base\") ) standard + aes(colour = cty, fill = cty) + scale_colour_viridis_c( option = \"C\", guide = gizmo_density(density.args = list(adjust = 0.7)) ) + scale_fill_viridis_c( option = \"D\", guide = gizmo_histogram(hist.args = list(breaks = 10)) ) standard + aes(colour = cty, fill = cty) + scale_colour_viridis_c( option = \"C\", guide = compose_sandwich( middle = gizmo_density(just = 1), text = \"axis_base\" ) ) + scale_fill_viridis_c( option = \"D\", guide = compose_sandwich( middle = gizmo_histogram(just = 0.5), text = \"axis_base\" ) )"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"other-compositions","dir":"Articles","previous_headings":"","what":"Other compositions","title":"A guide to guide composition","text":"following compositions situational aren’t part ‘proper’ guide. compose_ontop() guide lets render one guide . can see plots allows us touch panel composing top one another, stacking. also compose_crux() (‘cross’) parent composition compose_sandwich(). Instead allowing bread two sides, can also put guides top bottom. isn’t currently use complete guide though.","code":"top <- guide_axis_base( key = key_manual(32, label = \"Here is 32\"), theme = theme_guide( ticks.length = unit(1.5, \"cm\"), ticks = element_line(arrow = arrow()), line = element_blank() ) ) standard + guides(y.sec = compose_ontop(\"axis\", top)) + labs(title = \"compose_ontop\") standard + guides(y.sec = compose_stack(\"axis\", top)) + labs(title = \"compose_stack\") ball <- gizmo_grob(grid::circleGrob( r = unit(0.5, \"cm\"), gp = grid::gpar(fill = \"tomato\") )) block <- gizmo_grob(grid::rectGrob( width = unit(1, \"cm\"), height = unit(1, \"cm\"), gp = grid::gpar(fill = \"dodgerblue\") )) standard + aes(colour = cty) + scale_colour_viridis_c( guide = compose_crux( centre = gizmo_barcap(), left = \"axis_base\", right = \"axis_base\", top = ball, bottom = block ) )"},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"keys-in-vanilla-ggplot2","dir":"Articles","previous_headings":"","what":"Keys in vanilla ggplot2","title":"Key information","text":"way guides exchange information scales called ‘keys’. Keys simply data frames typically hold information aesthetic, values represent displayed. may already seen keys ’ve used get_guide_data() function , can used retrieved guide’s key. data frame , can see key ‘x’ aesthetic. tells us relative location tick marks aesthetic’s x column, numerical values represent .value column. values communicated users captured .label column. Sometimes, keys information additional aesthetics, like y column key .","code":"standard <- ggplot(mpg, aes(displ, hwy)) + geom_point(aes(shape = drv, colour = drv)) + labs( shape = \"Drive train\", colour = \"Drive train\", y = \"Highway efficiency\", x = \"Engine Displacement\" ) get_guide_data(standard, aesthetic = \"x\") #> x .value .label y #> 1 0.1127946 2 2 0 #> 2 0.2811448 3 3 0 #> 3 0.4494949 4 4 0 #> 4 0.6178451 5 5 0 #> 5 0.7861953 6 6 0 #> 6 0.9545455 7 7 0"},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"keys-in-legendry","dir":"Articles","previous_headings":"","what":"Keys in legendry","title":"Key information","text":"key difference keys legendry keys ggplot2, legendry exposes users keys. first, can inconvenience, allows greater degree customisation.","code":""},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"why-use-keys","dir":"Articles","previous_headings":"Keys in legendry","what":"Why use keys?","title":"Key information","text":"dig different types keys, worth noting exactly keys exposed. Keys represent ‘rules’ annotate scale, whereas guide display rule. example, key_log() instructs annotate every 10x change large ticks, changes smaller ticks. doesn’t really matter whether rule applied axis colour bar. rule independent display makes modular.","code":"logkey <- key_log() ggplot(msleep, aes(sleep_total, brainwt, colour = bodywt)) + geom_point(na.rm = TRUE) + scale_y_log10(guide = guide_axis_base(key = logkey)) + scale_colour_viridis_c( trans = \"log10\", guide = guide_colbar(key = logkey) )"},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"regular-keys","dir":"Articles","previous_headings":"Keys in legendry","what":"Regular keys","title":"Key information","text":"understand better typical key works, can use key_manual() manually create key. Usually sufficient just provide aesthetic argument, .value .label columns automatically derive . want custom labels, can set label argument. guides legendry accept key argument, cause guide display information key, rather information automatically derived scale. addition, can provide automatic keys keywords. Setting key = \"minor\", setting key = key_minor(). fashion many key_*() functions can used keyword omitting key_-prefix. keys don’t directly return data frames, return instructions keys interact scales. example key_auto(), default key many guides legendry, needs know range populate tickmarks. can preview values ’d label letting key absorb scale known limits.","code":"key_manual(aesthetic = c(2, 4, 6)) #> aesthetic .value .label #> 1 2 2 2 #> 2 4 4 4 #> 3 6 6 6 my_key <- key_manual(aesthetic = c(2, 4, 6), label = c(\"two\", \"four\", \"six\")) standard + guides(x = guide_axis_base(key = my_key)) standard + guides(x = guide_axis_base(key = \"minor\")) key <- key_auto() print(key) #> function (scale, aesthetic = NULL) #> { #> aesthetic <- aesthetic %||% scale$aesthetics[1] #> df <- Guide$extract_key(scale, aesthetic) #> df <- data_frame0(df, !!!extra_args(...)) #> class(df) <- c(\"key_standard\", \"key_guide\", class(df)) #> df #> } #> #> template <- scale_y_log10(limits = c(1, 1000)) key(template, \"y\") #> y .value .label #> 1 0 0 1 #> 2 1 1 10 #> 3 2 2 100 #> 4 3 3 1000"},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"ranged-keys","dir":"Articles","previous_headings":"Keys in legendry","what":"Ranged keys","title":"Key information","text":"special type guide may find legendry called ‘ranged’ guides. difference regular guides mark single point aesthetic, rather use start- end-point mark range aesthetic. can convenient annotate co-occurrances data plotting events. example, can annotate airtimes TV shows timeseries data. Compared regular key, don’t aesthetic column, replaced start end columns. cases, indicate single .value, can still use .label column. .level column indicates far offset range, ’ll display “Frasier” farther away “Golden Girls”. also ‘automatic’ ranged key, attempts find patterns key labels. example obvious pattern x-axis labels plot first 3 entries 3 drive trains 1999, followed 3 drive trains 2008. default, key_range_auto() tries split label non-alphanumeric character, give explicit split instructions using sep argument.","code":"ranges <- key_range_manual( start = as.Date(c(\"1985-09-14\", \"1993-09-16\")), end = as.Date(c(\"1992-05-09\", \"2004-05-13\")), name = c(\"Golden Girls\", \"Frasier\"), level = 1:2 ) ranges #> start end .label .level #> 1 1985-09-14 1992-05-09 Golden Girls 1 #> 2 1993-09-16 2004-05-13 Frasier 2 ggplot(economics, aes(date, unemploy)) + geom_line() + guides(x.sec = primitive_bracket(ranges)) plot <- ggplot(mpg, aes(interaction(drv, year), displ, fill = drv)) + geom_boxplot() + labs( x = \"Drive train by year\", y = \"Engine displacement\", fill = \"Drive train\" ) plot # Split on literal periods key <- key_range_auto(sep = \"\\\\.\") plot + guides(x = primitive_bracket(key = key))"},{"path":[]},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"piping-keys","dir":"Articles","previous_headings":"Futher gimmicks","what":"Piping keys","title":"Key information","text":"key_manual() key_range_manual() functions equivalents easy pipe. called key_map() key_range_map() respectively, can replace following: following, pipe-friendly version: keys display something like :","code":"key <- key_range_manual( start = presidential$start, end = presidential$end, name = presidential$name ) key <- presidential |> key_range_map( start = start, end = end, name = name ) ggplot(economics, aes(date, unemploy)) + geom_line() + guides(x.sec = primitive_bracket(key))"},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"formatting-keys","dir":"Articles","previous_headings":"Futher gimmicks","what":"Formatting keys","title":"Key information","text":"addition lot control keys display, also control common text formatting operations keys. key options ... argument allows many arguments element_text() passed labels. cases know label advance, almost every time one uses key_manual(), key_map() ranged equivalents, can even vectorise formatting options.","code":"ggplot(mpg, aes(displ, hwy)) + geom_point() + guides(x = guide_axis_base(key = key_auto(colour = \"red\", face = \"bold\"))) guide <- presidential |> key_range_map( start = start, end = end, name = name, colour = ifelse(party == \"Republican\", \"tomato\", \"dodgerblue\"), face = \"bold\" ) |> primitive_bracket() ggplot(economics, aes(date, unemploy)) + geom_line() + guides(x.sec = guide)"},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"forbidden-keys","dir":"Articles","previous_headings":"Futher gimmicks","what":"Forbidden keys","title":"Key information","text":", time writing, two keys probably shouldn’t use code. key_sequence() key_bins(). hope mentioning use prevent experimenting subsequent frustration keys. can see key_sequence() produce informative axis. reason key designed colour gradients Likewise, key_bins() designed regular guides, specific colour steps.","code":"my_sequence_key <- key_sequence(n = 20) standard + guides(x = guide_axis_base(key = my_sequence_key)) ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + scale_colour_viridis_c( guide = gizmo_barcap(key = my_sequence_key) ) my_bins_key <- key_bins() ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + scale_colour_viridis_c( guide = gizmo_stepcap(key = my_bins_key) )"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"axes","dir":"Articles","previous_headings":"","what":"Axes","title":"A guided tour","text":"Axes truly bread butter guides. Naturally, axes shine brightest guides positions like x y can moonlight auxiliary guides well.","code":""},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"where-not-to-apply","dir":"Articles","previous_headings":"Axes","what":"Where (not) to apply","title":"A guided tour","text":"legendry, staple axis guide_axis_base(). first glance, axes utterly unremarkable much mirror ggplot2::guide_axis() design. terms novelty, ‘extra’ option axes offer display bidirectional tick marks. However, guide_axis_base() flexible ggplot2::guide_axis(). ggplot2, ’d typically switch ggplot2::guide_axis_theta() display axis theta coordinate polar plot. custom axis knows fit polar coordinates, fuss needed switching polar coordinates. Argueably, custom guide little bit flexible. exactly scruples displaying arbitrary continuous aesthetics, like colour plot . can see, informative colour guide reason ’d advice . unadvised yet possible topic resurfaces later article. summary, guide_axis_base() flexible guide can used position aesthetic, can () used continuous aesthetics.","code":"# Turn on axis lines theme_update(axis.line = element_line()) # A standard plot standard <- ggplot(mpg, aes(displ, hwy)) + geom_point() + labs( x = \"Engine Displacement (Litres)\", y = \"Highway Miles per Gallon\" ) standard + guides( x = \"axis_base\", y = \"axis_base\" ) p <- standard + scale_x_continuous(guide = guide_axis_base(bidi = TRUE)) + scale_y_continuous(guide = guide_axis_base(bidi = TRUE)) p p + coord_radial(start = 1.25 * pi, end = 2.75 * pi) standard + aes(colour = cty) + guides(colour = \"axis_base\")"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"nested-axes","dir":"Articles","previous_headings":"Axes","what":"Nested axes","title":"A guided tour","text":"Currently, exactly 1 ‘novelty’ axis guide_axis_nested(). Let’s suppose ‘nested’ data, purposes just means discrete variables kind categories interactions can laid nested fashion. category categories, . example three super-categories ‘Drink’, ‘Fruit’ ‘Vehicle’ granular categories like ‘Coffee’ ‘Pear’ belong super-categories. can use interaction() function paste together name inner category name outer category. Instead just relying formatting labels correctly splitting, can also manually annotate outer categories. , can use key_range_manual() function constructs brackets see fit.","code":"df <- data.frame( item = c(\"Coffee\", \"Tea\", \"Apple\", \"Pear\", \"Car\"), type = c(\"Drink\", \"Drink\", \"Fruit\", \"Fruit\", \"Vehicle\"), amount = c(5, 1, 2, 3, 1) ) plain <- ggplot(df, aes(interaction(item, type), amount)) + geom_col() plain + guides(x = \"axis_nested\") my_key <- key_range_manual( start = c(\"Coffee\", \"Apple\"), end = c(\"Tea\", \"Pear\"), name = c(\"Drinks\", \"Fruits\"), level = 1 ) ggplot(df, aes(item, amount)) + geom_col() + scale_x_discrete( limits = df$item, guide = guide_axis_nested( regular_key = \"auto\", key = my_key ) )"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"brackets","dir":"Articles","previous_headings":"Axes > Nested axes","what":"Brackets","title":"A guided tour","text":"change style range indicators, can choose different bracket setting. theme elements legendry.bracket legendry.bracket.size control styling size line. settings shortcut theme_guide(). brackets can provided string naming bracket function, like \"curvy\" invokes bracket_curvy(). follows overview build-bracket shapes. Quite possibly, might bracket shapes want use, aren’t built legendry. Luckily, can build custom brackets, using numeric matrix : 2 columns corresponding x y coordinates. least 2 rows. values 0 1. x-coordinate stretched along axis, whereas y squished fit legendry.bracket.size theme setting. custom bracket can just provided bracket argument.","code":"plain + guides(x = guide_axis_nested(bracket = \"curvy\")) + theme_guide( bracket = element_line(colour = \"blue\"), bracket.size = unit(3, \"mm\") ) brackets <- list( \"atan\" = bracket_atan(), \"chevron\" = bracket_chevron(), \"curvy\" = bracket_curvy(), \"line\" = bracket_line(), \"round\" = bracket_round(), \"sigmoid\" = bracket_sigmoid(), \"square\" = bracket_square() ) brackets <- cbind( as.data.frame(do.call(rbind, brackets)), shape = factor(rep(names(brackets), lengths(brackets) / 2), names(brackets)) ) ggplot(brackets, aes(x, y)) + geom_path() + facet_wrap(~ shape) + coord_equal() zigzag <- cbind( x = seq(0, 1, length.out = 20), y = rep(c(0, 1), length.out = 20) ) plain + guides(x = guide_axis_nested(bracket = zigzag))"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"boxes","dir":"Articles","previous_headings":"Axes > Nested axes","what":"Boxes","title":"A guided tour","text":"Alternatively, also possible forego brackets altogether use boxes instead.","code":"plain + guides(x = guide_axis_nested(type = \"box\"))"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"customising","dir":"Articles","previous_headings":"Axes > Nested axes","what":"Customising","title":"A guided tour","text":"needn’t strictly use guide_axis_nested() discrete data: can use continuous data well. However, ’d need provide manual ranged key, one created key_range_manual()/key_range_map(). customise different depths bracketed text, can give list text elements levels_text argument. Alternatively, can tailor many usual text formatting options encoding key.","code":"presidents <- key_range_map(presidential, start = start, end = end, name = name) eco <- ggplot(economics, aes(date, unemploy)) + geom_line() + labs(y = \"Unemployment\") eco + guides(x = guide_axis_nested(key = presidents)) presidents$.level <- rep(1:3, length.out = nrow(presidents)) eco + guides(x = guide_axis_nested( key = presidents, levels_text = list( element_text(face = \"bold\"), NULL, element_text(face = \"italic\") ) )) presidents <- key_range_map( presidential, start = start, end = end, name = name, level = rep(1:4, length.out = nrow(presidential)), colour = ifelse(party == \"Republican\", \"tomato\", \"dodgerblue\") ) eco + guides(x = guide_axis_nested(key = presidents))"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"dendrograms","dir":"Articles","previous_headings":"Axes","what":"Dendrograms","title":"A guided tour","text":"Dendrograms popular method displaying results hierarchical clustering. standard way computing hierarchical clusters compute distance metric data dist() forwarding result hclust(). default plot method shows dendrogram. packages many options display dendrograms, notably ggdendro dendextend. legendry package ambition best dendrogram visualiser, find dendrograms use useful annotation. use dendrograms, can provide object produced hclust scale_(x/y)_dendro(). ensures scale follows order clustering result default uses guide_axis_dendro() display dendrogram next labels. guide_axis_dendro() function can decomposed labels segments. can use primitive_segments(\"dendro\") display labels, may convenient rather place labels opposite end panel. plot use raw segments draw radial dendrogram. vanish = TRUE option indicates fit dendrogram root tree middle, ever relevant secondary theta axes.","code":"clust <- hclust(dist(scale(mtcars)), method = \"ave\") plot(clust) ggplot(mtcars, aes(mpg, rownames(mtcars))) + geom_col() + scale_y_dendro(clust) ggplot(mtcars, aes(mpg, rownames(mtcars))) + geom_col() + scale_y_dendro(clust) + coord_radial(theta = \"y\", inner.radius = 0.5) + guides( theta = guide_axis_base(angle = 90), theta.sec = primitive_segments(\"dendro\", vanish = TRUE), r = \"none\" ) + theme( axis.title = element_blank(), plot.margin = margin(t = 50, b = 50) )"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"colours","dir":"Articles","previous_headings":"","what":"Colours","title":"A guided tour","text":"colour fill aesthetics wonderful build guides , can apply pretty much anything. First, ’ll take gander variants colour bars gander rings.","code":""},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"bars-and-steps","dir":"Articles","previous_headings":"Colours","what":"Bars and steps","title":"A guided tour","text":"Two variants colour guides exist {legendry}: guide_colbar() reflects guide_colourbar() guide_colsteps() reflects guide_coloursteps(). used standard fashion, look similar vanilla counterparts. Please note following paragraphs apply equally guide_colsteps(), ’ll take guide_colbar() examples.","code":"standard <- standard + aes(colour = cty) + labs(colour = \"City Miles\\nper Gallon\") standard + scale_colour_viridis_c(guide = \"colbar\") + labs(title = \"Custom colour bar\") standard + scale_colour_viridis_b(guide = \"colsteps\") + labs(title = \"Custom colour steps\")"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"caps","dir":"Articles","previous_headings":"Colours > Bars and steps","what":"Caps","title":"A guided tour","text":"thing sets guides apart indicators data goes --bounds. common case --bounds data, set scale limits narrower data range. plot , cty variable observation lower limit 10, upper limit 30. Typically, displayed na.value = \"grey\" colour. bars display data --bounds gray ‘caps’ two ends bar. can change --bounds strategy, oob argument scale, caps reflect colour --bounds data acquired. can also force caps appear, even --bounds data, force cap colour consistent scale. shape cap needn’t triangle. can set shape built-cap shapes. caps can provided string naming cap function, like \"arch\" invokes cap_arch(). follows overview build-cap shapes. certainly possible use shapes imagination well. provide shape, use numeric matrix : 2 columns corresponding x y coordinates. least 2 rows. positive values 2nd column (y). Start (0, 0) coordinate. End (1, 0) coordinate. can see shapes requirements hold built-shapes. matrix can given shape argument guide.","code":"standard + scale_colour_viridis_c( limits = c(10, 30), guide = \"colbar\" ) standard + scale_colour_viridis_c( limits = c(10, 30), oob = oob_squish, guide = \"colbar\" ) standard + scale_colour_viridis_c( guide = guide_colbar( show = c(FALSE, TRUE), oob = \"squish\" ) ) standard + scale_colour_viridis_c( guide = guide_colbar( show = TRUE, oob = \"squish\", shape = \"arch\" ) ) caps <- list( none = cap_none(), triangle = cap_triangle(), round = cap_round(), arch = cap_arch(), ogee = cap_ogee() ) caps <- cbind( as.data.frame(do.call(rbind, caps)), shape = factor(rep(names(caps), lengths(caps) / 2), names(caps)) ) ggplot(caps, aes(x, y)) + geom_path(arrow = arrow()) + facet_wrap(~ shape) + coord_equal() hourglass_cap <- cbind( x = c(0, 1, 0, 1), y = c(0, 1, 1, 0) ) standard + scale_colour_viridis_c( guide = guide_colbar( show = TRUE, oob = \"squish\", shape = hourglass_cap ) )"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"side-guides","dir":"Articles","previous_headings":"Colours > Bars and steps","what":"Side-guides","title":"A guided tour","text":"colour bars come small party trick: two rows tick marks separate axes masquerading parts colour bar. becomes easier see wash away make-vanilla = FALSE. trick allows tailor colour bar liking separate sides. can use invoke tricks described axis section, like setting minor ticks, swap axes annotation-primitive like primitive_bracket().","code":"standard + scale_colour_viridis_c( guide = guide_colbar(vanilla = FALSE) ) brackets <- key_range_manual( start = c(9, 25), end = c(19, 30), name = c(\"A\", \"B\") ) |> primitive_bracket(bracket = \"square\") standard + scale_colour_viridis_c( minor_breaks = breaks_width(1), guide = guide_colbar( first_guide = guide_axis_base(\"minor\"), second_guide = brackets ) )"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"rings","dir":"Articles","previous_headings":"Colours","what":"Rings","title":"A guided tour","text":"Aside bars steps, also option show colour ring. understand might convenient, can help understand type data suitable . prime example cyclical data can month year. time December January just one month, encoded numerically, difference 11 months. problem can show sometimes periodic data, like housing sales . Every year get sharp colour transition winter. remedy problem use cyclical palette. {scico} package offers suitable cyclical palettes, like ‘romaO’, ‘vikO’, ‘bamO’, ‘corkO’ ‘brocO’. already much better, guide poor job displaying cyclical nature months. better reflected guide, can use guide_colring(). ‘thickness’ donut can controlled legend.key.width parameter, default 1/5th diameter. outer diameter ring controlled legend.key.size parameter, multiplied 5 consistency colour bar multiplier. Like custom colour bars, possible set custom guides, hoarded inner_guide outer_guide distinguish aren’t first second.","code":"housing <- ggplot( subset(txhousing, city == \"Houston\"), aes(date, volume, colour = month) ) + geom_line() + scale_y_continuous( name = \"Total volume of sales\", labels = dollar_format(scale = 1e-6, suffix = \"M\") ) + labs( x = \"Date\", colour = \"Month\" ) housing + scale_colour_viridis_c(limits = c(0, 12)) # Colours from scico::scico(12, palette = \"romaO\") periodic_pal <- c(\"#723957\", \"#843D3A\", \"#97552B\", \"#B08033\", \"#CBB45D\", \"#D5DA99\", \"#B8DEC3\", \"#85C7CF\", \"#599FC4\", \"#4E73AB\", \"#5F4C81\", \"#723959\") housing + scale_colour_gradientn(colours = periodic_pal, limits = c(0, 12)) housing + scale_colour_gradientn( colours = periodic_pal, limits = c(1, 13), breaks = 1:12, guide = \"colring\" ) housing + scale_colour_gradientn( colours = periodic_pal, limits = c(1, 13), breaks = 1:12, minor_breaks = breaks_width(0.25), guide = guide_colring( outer_guide = guide_axis_base(\"minor\"), inner_guide = \"none\" ) ) + theme( legend.key.width = rel(2.5), # fill to center legend.key.size = unit(0.5, \"cm\") # actual size is 0.5 * 5 = 2.5 cm )"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"legends","dir":"Articles","previous_headings":"","what":"Legends","title":"A guided tour","text":"addition full guides , legendry also three variants guide_legend() legend. first guide_legend_base(), similar ggplot2::guide_legend(), offers design argument lets put keys arbitrary cells rectangular layout. Secondly, guide_legend_cross() let ‘cross’ two variables, ; generate legend key every combination two variable levels. legends merged share title, wise construct common legend setting key strategy title. Alternatively, can also use guide compound variable already combines two variables. Note missing combinations correctly omitted case. Lastly, also legend suitable displaying groups. guide_legend_group() legend adds additional titles separate groups. default, splits labels first non-alphanumeric character, can also use key_group_lut() indicate groups.","code":"design <- matrix(NA, 3, 3) diag(design) <- 1:3 standard + aes(colour = drv) + guides(colour = guide_legend_base(design = design)) common <- guide_legend_cross(key = \"auto\", title = \"Cross legend\") standard + aes(colour = drv, shape = factor(cyl)) + guides(colour = common, shape = common) standard + aes(colour = paste(cyl, drv)) + guides(colour = \"legend_cross\") set.seed(42) i <- sample(nrow(msleep), 6) ggplot(msleep[i, ], aes(sleep_total, bodywt)) + geom_point(aes(colour = paste0(vore, \"vore.\", name))) + guides(colour = \"legend_group\")"},{"path":"https://teunbrand.github.io/legendry/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Teun van den Brand. Author, maintainer, copyright holder.","code":""},{"path":"https://teunbrand.github.io/legendry/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"van den Brand T (2024). legendry: Extended Legends Axes 'ggplot2'. R package version 0.1.0.9000, https://github.com/teunbrand/legendry, https://teunbrand.github.io/legendry/.","code":"@Manual{, title = {legendry: Extended Legends and Axes for 'ggplot2'}, author = {Teun {van den Brand}}, year = {2024}, note = {R package version 0.1.0.9000, https://github.com/teunbrand/legendry}, url = {https://teunbrand.github.io/legendry/}, }"},{"path":"https://teunbrand.github.io/legendry/index.html","id":"legendry-","dir":"","previous_headings":"","what":"Extended Legends and Axes for ggplot2","title":"Extended Legends and Axes for ggplot2","text":"goal legendry provide additional guide functionality ggplot2 ecosystem.","code":""},{"path":"https://teunbrand.github.io/legendry/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Extended Legends and Axes for ggplot2","text":"can install development version legendry GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"teunbrand/legendry\")"},{"path":"https://teunbrand.github.io/legendry/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Extended Legends and Axes for ggplot2","text":"Let’s first set basic plot experiment : legendry package offers selection calls ‘complete guides’. complete guides can just drop-replacement regular guides, can specify using ggplot2’s guides() function using guide argument scales. example , ’re using two custom variants vanilla guides, namely guide_axis_base() guide_colbar(). custom variants additional options allow greater degree customisation: axis guide option bidirectional ticks. colourbar automatically recognises --bounds values displays cap. Besides complete guides, legendry also incomplete guides can composed. ggplot2::guide_axis_stack() axis composition function can used display multiple guides. , use ‘primitive’ guide (incomplete building block) display range axis. stacking regular axis primitive guide completed. legendry package extends guide composition concept beyond axes types guides. example compose ‘sandwich’: central guide flanked two others. bracket primitive, matter aesthetic displays can re-use sandwich. ’ve yet write vignette composition.","code":"library(legendry) #> Loading required package: ggplot2 base <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + labs( x = \"Engine displacement\", y = \"Highway miles per gallon\", col = \"City miles\\nper gallon\" ) + theme(axis.line = element_line()) base + scale_colour_viridis_c( limits = c(NA, 30), guide = \"colbar\" ) + guides( x = guide_axis_base(bidi = TRUE) ) # A partial guide to display a bracket efficient_bracket <- primitive_bracket( # Keys determine what is displayed key = key_range_manual(start = 25, end = Inf, name = \"Efficient\"), bracket = \"square\", # We want vertical text theme = theme( legend.text = element_text(angle = 90, hjust = 0.5), axis.text.y.left = element_text(angle = 90, hjust = 0.5) ) ) base + guides(y = guide_axis_stack(\"axis\", efficient_bracket)) base + scale_colour_viridis_c( guide = compose_sandwich( middle = gizmo_density(), text = \"axis_base\", opposite = efficient_bracket ) )"},{"path":"https://teunbrand.github.io/legendry/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Extended Legends and Axes for ggplot2","text":"Please note legendry project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Bracket options — bracket_options","title":"Bracket options — bracket_options","text":"functions construct various sorts brackets. construct matrix can supplied bracket argument primitive_bracket().","code":""},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bracket options — bracket_options","text":"","code":"bracket_line() bracket_square() bracket_chevron() bracket_round(angle = 180, n = 100) bracket_sigmoid(curvature = 10, n = 100) bracket_atan(curvature = 5, n = 100) bracket_curvy(angle = 225, n = 100)"},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bracket options — bracket_options","text":"angle numeric(1): angle degrees circle piece drawn. bracket_curvy(), angle 180 270. n integer(1) number points use bracket. curvature numeric(1) controls curliness bracket. precisely, used construct sequence seq(-curvature, curvature, length.= n) logistic arctangent functions evaluated.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bracket options — bracket_options","text":" coordinates points brackets.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Bracket options — bracket_options","text":"designing custom bracket shapes, expectation columns number 0 1. first column follows direction guide whereas second column orthogonal direction.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":"functions","dir":"Reference","previous_headings":"","what":"Functions","title":"Bracket options — bracket_options","text":"bracket_line(): simple line bracket. n = 2 points. bracket_square(): square bracket. n = 4 points. bracket_chevron(): chevron (V-shape) makes bracket. n = 3 points. bracket_round(): One circular arc makes bracket. bracket_sigmoid(): Two sigmoid curves stacked top one another form bracket. bracket_atan(): Two arctangent curves stacked top one another form bracket. bracket_curvy(): Four circular arcs make bracket.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bracket options — bracket_options","text":"","code":"plot(bracket_sigmoid(), type = 'l')"},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Cap options — cap_options","title":"Cap options — cap_options","text":"functions construct various sorts caps. construct matrix can supplied shape argument gizmo_barcap().","code":""},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cap options — cap_options","text":"","code":"cap_triangle() cap_round(n = 100) cap_arch(n = 100) cap_ogee(n = 100) cap_none()"},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cap options — cap_options","text":"n number points use cap.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cap options — cap_options","text":" coordinates points brackets.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Cap options — cap_options","text":"designing custom cap shapes, expectation first point starts (0, 0) coordinate last point ends (0, 1) coordinate. first column follows orthogonal direction bar whereas second column follows direction bar.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":"functions","dir":"Reference","previous_headings":"","what":"Functions","title":"Cap options — cap_options","text":"cap_triangle(): equilateral triangle n = 3 points. cap_round(): semicircle. cap_arch(): Two circular arcs forming equilateral Gothic arch. cap_ogee(): Four circular arcs forming 'ogee' arch. cap_none(): cap.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cap options — cap_options","text":"","code":"plot(cap_arch(), type = 'l')"},{"path":"https://teunbrand.github.io/legendry/reference/common_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"common parameters in legendry — common_parameters","title":"common parameters in legendry — common_parameters","text":"collection common parameters needn't re-documented time.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/common_parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"common parameters in legendry — common_parameters","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. available_aes vector listing aesthetics guide can build. direction indicating direction guide. Can \"horizontal\" \"vertical\". angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. override.aes named specifying aesthetic parameters key glyphs. See details examples guide_legend().","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_crux.html","id":null,"dir":"Reference","previous_headings":"","what":"Compose guides in a cross — compose_crux","title":"Compose guides in a cross — compose_crux","text":"guide composition central guide optionally surrounded guides four sides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_crux.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compose guides in a cross — compose_crux","text":"","code":"compose_crux( key = NULL, centre = \"none\", left = \"none\", right = \"none\", top = \"none\", bottom = \"none\", args = list(), complete = FALSE, theme = NULL, theme_defaults = list(), reverse = FALSE, order = 0, title = waiver(), position = waiver(), available_aes = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/compose_crux.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compose guides in a cross — compose_crux","text":"key standard key specification. key shared among guides NULL keys . See information linked topic. centre, left, right, top, bottom Guides use composition per position. guide can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. args arguments pass guides given either function string. complete whether treat composition complete guide. TRUE, title margin added result. FALSE (default), titles margins added. theme object style guide individually differently plot's theme settings. theme arguments guide overrides, combined , plot's theme. theme_defaults theme elements override undeclared theme arguments. reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. position guide drawn: one \"top\", \"bottom\", \"left\", \"right\". available_aes vector listing aesthetics guide can build.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_crux.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compose guides in a cross — compose_crux","text":" guide object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/compose_crux.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compose guides in a cross — compose_crux","text":"","code":"# Roughly recreating a colour bar with extra text on top and bottom crux <- compose_crux( centre = gizmo_barcap(), left = \"axis_base\", right = \"axis_base\", top = primitive_title(\"A lot\"), bottom = primitive_title(\"A little\") ) ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) + guides(colour = crux)"},{"path":"https://teunbrand.github.io/legendry/reference/compose_ontop.html","id":null,"dir":"Reference","previous_headings":"","what":"Compose guides on top of one another — compose_ontop","title":"Compose guides on top of one another — compose_ontop","text":"guide can place place guides top one another.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_ontop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compose guides on top of one another — compose_ontop","text":"","code":"compose_ontop( ..., args = list(), key = NULL, title = waiver(), angle = waiver(), theme = NULL, order = 0, position = waiver(), available_aes = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/compose_ontop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compose guides on top of one another — compose_ontop","text":"... Guides stack composition. guide can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. args arguments pass guides given either function string. key standard key specification. key shared among guides NULL keys . See information linked topic. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". available_aes giving aesthetics must match guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_ontop.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compose guides on top of one another — compose_ontop","text":" composite guide object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/compose_ontop.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compose guides on top of one another — compose_ontop","text":"","code":"# Using the ontop composition to get two types of ticks with different # lengths ggplot(mpg, aes(displ, hwy)) + geom_point() + guides(x = compose_ontop( guide_axis_base( key_manual(c(2, 4, 6)), theme = theme( axis.ticks = element_line(colour = \"limegreen\"), axis.ticks.length = unit(11, \"pt\") ) ), guide_axis_base( key_manual(c(3, 5, 7)), theme = theme( axis.ticks = element_line(colour = \"tomato\"), axis.ticks.length = unit(5.5, \"pt\") ) ) ))"},{"path":"https://teunbrand.github.io/legendry/reference/compose_sandwich.html","id":null,"dir":"Reference","previous_headings":"","what":"Compose guides as a sandwich — compose_sandwich","title":"Compose guides as a sandwich — compose_sandwich","text":"guide composition middle guide flanked two parallel guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_sandwich.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compose guides as a sandwich — compose_sandwich","text":"","code":"compose_sandwich( key = key_auto(), middle = gizmo_barcap(), text = \"none\", opposite = \"none\", args = list(), complete = TRUE, theme = NULL, theme_defaults = list(), reverse = FALSE, order = 0, title = waiver(), position = waiver(), available_aes = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/compose_sandwich.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compose guides as a sandwich — compose_sandwich","text":"key standard key specification. key shared among guides NULL keys . See information linked topic. middle Guide use middle guide. guide can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. text, opposite Guides use legend.text.position location opposite side middle guide respectively. Guide specification middle argument. args arguments pass guides given either function string. complete whether treat composition complete guide. TRUE, title margin added result. FALSE (default), titles margins added. theme object style guide individually differently plot's theme settings. theme arguments guide overrides, combined , plot's theme. theme_defaults theme elements override undeclared theme arguments. reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. position guide drawn: one \"top\", \"bottom\", \"left\", \"right\". available_aes vector listing aesthetics guide can build.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_sandwich.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compose guides as a sandwich — compose_sandwich","text":" guide object.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_sandwich.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compose guides as a sandwich — compose_sandwich","text":"sandwich composition effectively crux composition lacking two opposing arms.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/compose_sandwich.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compose guides as a sandwich — compose_sandwich","text":"","code":"# A standard plot with a sandwich guide ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) + guides(colour = compose_sandwich( middle = \"colourbar\", text = \"axis_base\", opposite = primitive_bracket(key = key_range_manual( start = c(10, 20), end = c(25, 30), name = c(\"A\", \"B\") )) ))"},{"path":"https://teunbrand.github.io/legendry/reference/compose_stack.html","id":null,"dir":"Reference","previous_headings":"","what":"Compose guides as stack — compose_stack","title":"Compose guides as stack — compose_stack","text":"guide can stack guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_stack.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compose guides as stack — compose_stack","text":"","code":"compose_stack( ..., args = list(), key = NULL, title = waiver(), side.titles = waiver(), angle = waiver(), theme = NULL, order = 0, drop = NULL, position = waiver(), available_aes = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/compose_stack.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compose guides as stack — compose_stack","text":"... Guides stack composition. guide can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. args arguments pass guides given either function string. key standard key specification. key shared among guides NULL keys . See information linked topic. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. side.titles giving labels titles displayed side stack. Set NULL display side titles. waiver(), attempt made extract titles guides use side titles. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. drop giving indices guides dropped facet requests labels drawn axes panels. default, NULL, drop every guide except first. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". available_aes giving aesthetics must match guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_stack.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compose guides as stack — compose_stack","text":" guide object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/compose_stack.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compose guides as stack — compose_stack","text":"","code":"ggplot() + geom_function(fun = dnorm, xlim = c(-3, 3)) + guides(x = compose_stack( \"axis\", \"axis\", side.titles = c(\"first\", \"second\") )) + # Add margin to make room for side titles theme(plot.margin = margin(5.5, 5.5, 5.5, 11))"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_barcap.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: capped colour bar — gizmo_barcap","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":"guide displays colour bar optional caps either ends bar.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_barcap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":"","code":"gizmo_barcap( key = \"sequence\", shape = \"triangle\", size = NULL, show = NA, alpha = NA, oob = \"keep\", theme = NULL, position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_barcap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":"key sequence key specification. Defaults key_sequence(n = 15). Changing argument key_sequence() fine, changing key type advised. shape cap specification providing one following: cap , cap_triangle(). naming cap function without 'cap_'-prefix, e.g. \"round\". two column giving coordinates cap, like created cap functions cap_arch(). size setting size cap. NULL (default), cap size proportional shape coordinates legend.key.size theme setting. show control caps displayed ends bar. TRUE, caps always displayed. FALSE, caps never displayed. NA (default), caps displayed data range exceed limits. given , show[1] controls display lower end show[2] upper end. alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_barcap.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_barcap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() # Just a bar p + scale_colour_viridis_c(guide = gizmo_barcap()) # Caps show up when there is data outside the limits p + scale_colour_viridis_c( limits = c(10, 30), guide = gizmo_barcap() ) # The scale's out-of-bounds handler determines cap colour p + scale_colour_viridis_c( limits = c(10, 30), oob = scales::oob_squish, guide = gizmo_barcap() ) # Customising display of the guide p + scale_colour_viridis_c( oob = scales::oob_squish, guide = gizmo_barcap( shape = \"arch\", show = c(FALSE, TRUE), size = unit(2, \"cm\"), theme = theme(legend.key.height = unit(4, \"cm\")) ) ) + theme( legend.frame = element_rect(colour = \"black\"), legend.key.width = unit(0.5, \"cm\") )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_density.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: kernel density estimate — gizmo_density","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"guide displays kernel density estimate (KDE) aesthetic. aesthetic colour fill, shape reflect .","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_density.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"","code":"gizmo_density( key = \"sequence\", density = NULL, density.args = list(), density.fun = stats::density, just = 0.5, oob = \"keep\", alpha = NA, theme = NULL, position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_density.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"key sequence key binned key specification. density One following: NULL using kernel density estimation data values (default). vector feed density.fun function. named x y numeric elements equal length, one returned using density() function. Please note input expected scale-transformed space, original data space. density.args additional arguments density.fun argument. applies density provided . already. density.fun use kernel density estimation density argument provided list already. just 0 1. Use 0 bottom- left-aligned densities, use 1 top- right-aligned densities 0.5 violin shapes. oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_density.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: kernel density estimate — gizmo_density","text":" object.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_density.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"Non-finite values NA NaN ignored infinite values -Inf Inf squished limits.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_density.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + scale_colour_viridis_c() # Density from plot data p + guides(colour = gizmo_density()) # Using bins instead of gradient p + guides(colour = gizmo_density(\"bins\")) # Providing custom values to compute density of p + guides(colour = gizmo_density(density = runif(1000, min = 5, max = 35))) # Providing a precomputed density p + guides(colour = gizmo_density(density = density(mpg$cty, adjust = 0.5))) # Alternatively, parameters may be passed through density.args p + guides(colour = gizmo_density(density.args = list(adjust = 0.5)))"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_grob.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: custom grob — gizmo_grob","title":"Guide gizmo: custom grob — gizmo_grob","text":"guide displays user-provided grob.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_grob.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: custom grob — gizmo_grob","text":"","code":"gizmo_grob( grob, width = grobWidth(grob), height = grobHeight(grob), hjust = 0.5, vjust = 0.5, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_grob.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: custom grob — gizmo_grob","text":"grob display. width, height [][grid::unit] setting allocated width height grob respectively. hjust, vjust 0 1 setting horizontal vertical justification grob used guide x y aesthetics. position guide drawn: one \"top\", \"bottom\", \"left\", \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_grob.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: custom grob — gizmo_grob","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_grob.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: custom grob — gizmo_grob","text":"","code":"circle <- grid::circleGrob() # A standard plot with grob gizmos ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + guides( x.sec = gizmo_grob( circle, hjust = 0.75, width = unit(2, \"cm\"), height = unit(2, \"cm\") ), colour = gizmo_grob( circle, width = unit(1, \"cm\"), height = unit(1, \"cm\") ) )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_histogram.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: histogram — gizmo_histogram","title":"Guide gizmo: histogram — gizmo_histogram","text":"guide displays histogram aesthetic. aesthetic colour fill, shape reflect .","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_histogram.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: histogram — gizmo_histogram","text":"","code":"gizmo_histogram( key = \"sequence\", hist = NULL, hist.args = list(), hist.fun = graphics::hist, just = 1, oob = oob_keep, alpha = NA, theme = NULL, position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_histogram.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: histogram — gizmo_histogram","text":"key sequence key binned key specification. hist One following: NULL computing histograms data values (default). atomic feed hist.fun function. named breaks counts numeric items, breaks item exactly one element longer counts item. typical way construct list using hist() function. Please note input expected scale-transformed space, original data space. hist.args additional arguments hist.fun argument. applies hist provided already. hist.fun use computing histograms hist argument provided list already. just 0 1. Use 0 bottom- left-aligned histograms, use 1 top- right-aligned histograms 0.5 centred histograms. oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_histogram.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: histogram — gizmo_histogram","text":" object.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_histogram.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Guide gizmo: histogram — gizmo_histogram","text":"Non-finite values NA NaN ignored infinite values -Inf Inf squished limits.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_histogram.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: histogram — gizmo_histogram","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + scale_colour_viridis_c() # Histogram from plot data p + guides(colour = gizmo_histogram()) # Using bins instead of gradient p + guides(colour = gizmo_histogram(\"bins\")) # Providing custom values to compute histogram p + guides(colour = gizmo_histogram(hist = runif(1000, min = 5, max = 35))) # Providing precomputed histogram p + guides(colour = gizmo_histogram(hist = hist(mpg$cty, breaks = 10))) # Alternatively, parameters may be passed through hist.args p + guides(colour = gizmo_histogram(hist.arg = list(breaks = 10)))"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_stepcap.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: capped colour steps — gizmo_stepcap","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"guide displays binned variant colour bar optional caps either ends bar.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_stepcap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"","code":"gizmo_stepcap( key = \"bins\", shape = \"triangle\", size = NULL, show = NA, alpha = NA, oob = \"keep\", theme = NULL, position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_stepcap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"key bins key specificiation. Defaults key_bins(even.steps = FALSE, show.limits = NULL). Changing arguments key_bins() fine, changing key type advised. shape cap specification providing one following: cap , cap_triangle(). naming cap function without 'cap_'-prefix, e.g. \"round\". two column giving coordinates cap, like created cap functions cap_arch(). size setting size cap. NULL (default), cap size proportional shape coordinates legend.key.size theme setting. show control caps displayed ends bar. TRUE, caps always displayed. FALSE, caps never displayed. NA (default), caps displayed data range exceed limits. given , show[1] controls display lower end show[2] upper end. alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_stepcap.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"GizmoStepcap object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_stepcap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() # Just some recangles p + scale_colour_viridis_c(guide = gizmo_stepcap()) # Caps show up when there is data outside the limits p + scale_colour_viridis_c( limits = c(10, 30), guide = gizmo_stepcap() ) # The scale's out-of-bounds handler determines cap colour p + scale_colour_viridis_c( limits = c(10, 30), oob = scales::oob_squish, guide = gizmo_stepcap() ) # Customising the display of the guide p + scale_colour_viridis_c( oob = scales::oob_squish, guide = gizmo_stepcap( shape = \"round\", show = c(FALSE, TRUE), size = unit(1, \"cm\"), theme = theme(legend.key.height = unit(4, \"cm\")) ) ) + theme( legend.frame = element_rect(colour = \"black\"), legend.key.width = unit(0.5, \"cm\") )"},{"path":"https://teunbrand.github.io/legendry/reference/guide-composition.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide composition — guide-composition","title":"Guide composition — guide-composition","text":"Guide composition meta-guide orchestrating ensemble guides. , 'composing' guide useful visual reflection scale.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide-composition.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide composition — guide-composition","text":"","code":"new_compose( guides, args = list(), ..., available_aes = c(\"any\", \"x\", \"y\", \"r\", \"theta\"), call = caller_env(), super = Compose )"},{"path":"https://teunbrand.github.io/legendry/reference/guide-composition.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide composition — guide-composition","text":"guides guides wherein element one following: class object. returns class object. naming function, without guide_ primitive_ prefix. args arguments pass guides given either function string. ... Additional parameters pass new_guide(). available_aes giving aesthetics must match guides. call call display messages. super class object giving meta-guide composition.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide-composition.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide composition — guide-composition","text":" (sub-)class guide composes guides.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide-composition.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide composition — guide-composition","text":"","code":"# The `new_compose()` function is not intended to be used directly my_composition <- new_compose(list(\"axis\", \"axis\"), super = ComposeStack) # Is the same as my_composition <- compose_stack(\"axis\", \"axis\")"},{"path":"https://teunbrand.github.io/legendry/reference/guide-gizmos.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmos — guide-gizmos","title":"Guide gizmos — guide-gizmos","text":"Guide gizmos speciality guide components specific one aesthetics display. Typically can composed guides guide primitives form complete guide.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide-primitives.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitives — guide-primitives","title":"Guide primitives — guide-primitives","text":"Guide primitives building blocks complex guides. , useful visual reflection scale. purpose combined one another form complex, complete guides reflect scale way.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide-primitives.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Guide primitives — guide-primitives","text":"guide primitives simple, flexible tailored one particular aesthetic. way can reused combined .","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_base.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom axis guide — guide_axis_base","title":"Custom axis guide — guide_axis_base","text":"axis guide visual representation position scales can represent x, y, theta r aesthetics. differs guide_axis() can accept custom keys can act axis coord_radial() like guide_axis_theta().","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_base.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom axis guide — guide_axis_base","text":"","code":"guide_axis_base( key = NULL, title = waiver(), theme = NULL, n.dodge = 1, check.overlap = FALSE, angle = waiver(), cap = \"none\", bidi = FALSE, order = 0, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_base.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom axis guide — guide_axis_base","text":"key standard key specification. Defaults key_auto(). See information linked topic 'Details' section. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. n.dodge positive setting number layers text labels can occupy avoid overlapping labels. check.overlap indicating whether check omit overlapping text. TRUE, first, last middle labels recursively prioritised order. FALSE, labels drawn. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. cap method cap axes. One following: one following: \"none\" perform capping. \"\" cap line ends extreme breaks. \"upper\" cap line upper extreme break. \"lower\" cap line lower extreme break. [1], TRUE equivalent \"\" FALSE equivalent \"none\" options . sorted [2n] even number members. lines drawn every odd-even pair. takes scale's breaks first argument, scale's limits second argument returns [2n] described . bidi : whether ticks drawn bidirectionally (TRUE) single direction (FALSE, default). order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_base.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom axis guide — guide_axis_base","text":" object.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_base.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Custom axis guide — guide_axis_base","text":"hood, guide stack composition line, ticks labels primitives. set minor ticks, use key = \"minor\", use type argument key_manual() key_map(). use logarithmic axis, set key = \"log\".","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_base.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom axis guide — guide_axis_base","text":"","code":"# A standard plot with custom keys p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + scale_x_continuous( guide = guide_axis_base(key = key_minor()) ) + scale_y_continuous( guide = guide_axis_base(key = key_manual(c(20, 25, 30, 40))) ) p # Is translated to theta axis without fuss p + coord_radial() # To use as logarithmic axis: ggplot(msleep, aes(bodywt, brainwt)) + geom_point(na.rm = TRUE) + scale_x_continuous( transform = \"log10\", guide = guide_axis_base(\"log\") )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_dendro.html","id":null,"dir":"Reference","previous_headings":"","what":"Dendrogram guide — guide_axis_dendro","title":"Dendrogram guide — guide_axis_dendro","text":"axis speciality axis discrete data hierarchically clustered. Please aware guide affect scale limits, set appropriately. guide give misleading results step skipped!","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_dendro.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Dendrogram guide — guide_axis_dendro","text":"","code":"guide_axis_dendro( key = \"dendro\", title = waiver(), theme = NULL, space = rel(10), vanish = TRUE, n.dodge = 1, angle = waiver(), check.overlap = FALSE, ticks = \"none\", axis_line = \"none\", order = 0, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_dendro.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Dendrogram guide — guide_axis_dendro","text":"key segment key specification. See information linked topic. Alternatively, object class automatically invokes key_dendro(). title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. space Either object length 1 determining space allocated orthogonal direction. space argument class (default) base size taken tick length theme setting. vanish relevant guide used secondary theta position: whether continue draw segments meed center (TRUE) strictly observe space setting (FALSE). n.dodge positive setting number layers text labels can occupy avoid overlapping labels. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. check.overlap indicating whether check omit overlapping text. TRUE, first, last middle labels recursively prioritised order. FALSE, labels drawn. ticks, axis_line Guides use ticks axis lines. Defaults drawing ticks axis lines. Can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_dendro.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Dendrogram guide — guide_axis_dendro","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_dendro.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Dendrogram guide — guide_axis_dendro","text":"","code":"# Hierarchically cluster data clust <- hclust(dist(scale(mtcars)), \"ave\") # Using the guide along with appropriate limits p <- ggplot(mtcars, aes(disp, rownames(mtcars))) + geom_col() + scale_y_discrete(limits = clust$labels[clust$order]) # Standard usage p + guides(y = guide_axis_dendro(clust)) # Adding ticks and axis line p + guides(y = guide_axis_dendro(clust, ticks = \"ticks\", axis_line = \"line\")) + theme(axis.line = element_line()) # Controlling space allocated to dendrogram p + guides(y = guide_axis_dendro(clust, space = unit(4, \"cm\"))) + theme(axis.ticks.y.left = element_line(\"red\")) # If want just the dendrograme, use `primitive_segments()` p + guides(y = primitive_segments(clust), y.sec = \"axis\")"},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_nested.html","id":null,"dir":"Reference","previous_headings":"","what":"Nested axis guide — guide_axis_nested","title":"Nested axis guide — guide_axis_nested","text":"axis guide gives extra range annotations position scales. can used infer nesting structure labels annotate ranges.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_nested.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Nested axis guide — guide_axis_nested","text":"","code":"guide_axis_nested( key = \"range_auto\", regular_key = \"auto\", type = \"bracket\", title = waiver(), theme = NULL, angle = waiver(), cap = \"none\", bidi = FALSE, oob = \"squish\", drop_zero = TRUE, pad_discrete = NULL, levels_text = NULL, ..., order = 0, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_nested.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Nested axis guide — guide_axis_nested","text":"key range key specification. key = \"range_auto\", additional labels inserted represent point values. regular_key standard key specification appearance regular tick marks. type Appearance ranges, either \"box\" put text boxes \"bracket\" (default) text brackets. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. cap method cap axes. One following: one following: \"none\" perform capping. \"\" cap line ends extreme breaks. \"upper\" cap line upper extreme break. \"lower\" cap line lower extreme break. [1], TRUE equivalent \"\" FALSE equivalent \"none\" options . sorted [2n] even number members. lines drawn every odd-even pair. takes scale's breaks first argument, scale's limits second argument returns [2n] described . bidi : whether ticks drawn bidirectionally (TRUE) single direction (FALSE, default). oob method dealing --bounds (oob) ranges. Can one \"squish\", \"censor\" \"none\". drop_zero whether drop near-zero width ranges (TRUE, default) preserve (FALSE). pad_discrete giving amount ranges extended given discrete variable. applied drop_zero setting. levels_text list objects customise text appears every level. ... Arguments passed primitive_bracket(), primitive_box() primitive_fence(). order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_nested.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Nested axis guide — guide_axis_nested","text":" object.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_nested.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Nested axis guide — guide_axis_nested","text":"hood, guide stack composition line, ticks, optionally labels either bracket, box fence primitives. default, key = \"range_auto\" incorporate 0th level labels inferred scale's labels. labels look like regular labels. offer keys opportunity display ranges alongside regular-looking labels, regular_key argument can used setup separate key display ticks ranges.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_nested.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Nested axis guide — guide_axis_nested","text":"","code":"# A plot with nested categories on the x-axis p <- ggplot(mpg, aes(interaction(drv, cyl), hwy)) + geom_boxplot() p + guides(x = \"axis_nested\") # Apply styling to brackets p + guides(x = \"axis_nested\") + theme_guide(bracket = element_line(\"red\", linewidth = 1)) # Don't drop nesting indicators that have 0-width p + guides(x = guide_axis_nested(drop_zero = FALSE)) # Change additional padding for discrete categories p + guides(x = guide_axis_nested(pad_discrete = 0)) # Change bracket type p + guides(x = guide_axis_nested(bracket = \"curvy\")) # Use boxes instead of brackets + styling of boxes p + guides(x = guide_axis_nested(type = \"box\")) + theme_guide(box = element_rect(\"limegreen\", \"forestgreen\")) # Using fences instead of brackets + styling of fences p + guides(x = guide_axis_nested(type = \"fence\", rail = \"inner\")) + theme_guide( fence.post = element_line(\"tomato\"), fence.rail = element_line(\"dodgerblue\") ) # Use as annotation of a typical axis # `regular_key` controls display of typical axis ggplot(mpg, aes(displ, hwy)) + geom_point() + guides(x = guide_axis_nested( key = key_range_manual(start = 2:3, end = 5:6, name = c(\"First\", \"Second\")), regular_key = key_manual(c(2, 2.5, 3, 5, 7)) ))"},{"path":"https://teunbrand.github.io/legendry/reference/guide_circles.html","id":null,"dir":"Reference","previous_headings":"","what":"Circle size guide — guide_circles","title":"Circle size guide — guide_circles","text":"guide displays sizes points series circles. typically paired geom_point() draw_key_point() glyphs.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_circles.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Circle size guide — guide_circles","text":"","code":"guide_circles( key = NULL, title = waiver(), theme = NULL, hjust = 0.5, vjust = 0, text_position = NULL, clip_text = FALSE, override.aes = list(shape = 1), position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_circles.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Circle size guide — guide_circles","text":"key standard key specification. Defaults key_auto(). See information linked topic. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. hjust, vjust 0 1 giving horizontal vertical justification, respectively, central shapes. recommended hjust = 0.5 text placed left right vjust = 0.5 recommended text placed top bottom. text_position string, one \"ontop\", \"top\", \"right\", \"bottom\", \"left\" describe placement labels. default (NULL), take legend.text.position theme setting. clip_text whether give text \"ontop\" position small rectangle background colour. override.aes named specifying aesthetic parameters key glyphs. See details examples guide_legend(). position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_circles.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Circle size guide — guide_circles","text":" object.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_circles.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Circle size guide — guide_circles","text":"Please note default size scales scale area, radius, equidistant breaks appear irregularly spaced positions due labelling diameter circle. graph designed standard round shapes mind, .e. shapes 1, 16, 19 21. reason, shape = 1 default override.aes argument. shapes probably drawn quality alignment label placement may unsatisfactory.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_circles.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Circle size guide — guide_circles","text":"","code":"# A standard plot p <- ggplot(mtcars, aes(disp, mpg)) + geom_point(aes(size = hp), alpha = 0.3) # By default, the sizes aren't large enough to make this guide clear p + scale_size_area(guide = \"circles\") # Update with a more approrpriate scale p <- p + scale_size_area( max_size = 30, limits = c(0, NA), breaks = c(0, 25, 100, 250) ) p + guides(size = \"circles\") # Horizontal orientation p + guides(size = guide_circles( vjust = 0.5, hjust = 0, text_position = \"bottom\" )) # Alternative text placement p + guides(size = guide_circles( text_position = \"ontop\", clip_text = TRUE )) # More styling options p + guides(size = guide_circles(override.aes = aes(colour = \"red\")))+ theme( # Key background legend.key = element_rect(colour = \"black\", fill = 'white'), # Padding around central shapes legendry.legend.key.margin = margin(1, 1, 1, 1, \"cm\"), legend.ticks = element_line(colour = \"blue\"), legend.text.position = \"left\" )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_colbar.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom colour bar guide — guide_colbar","title":"Custom colour bar guide — guide_colbar","text":"Similar guide_colourbar(), guide displays continuous colour fill aesthetics. additional options display caps end bar, depending --bounds values.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colbar.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom colour bar guide — guide_colbar","text":"","code":"guide_colbar( title = waiver(), key = \"auto\", first_guide = \"axis_base\", second_guide = first_guide, shape = \"triangle\", size = NULL, show = NA, nbin = 15, alpha = NA, reverse = FALSE, oob = scales::oob_keep, theme = NULL, vanilla = TRUE, position = waiver(), available_aes = c(\"colour\", \"fill\") )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_colbar.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom colour bar guide — guide_colbar","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. key sequence key specification. Defaults key_sequence(n = 15). Changing argument key_sequence() fine, changing key type advised. first_guide, second_guide Guides flank colour bar. guide can specified using one following: class object. returns class object. naming function, without guide_ primitive_ prefix. first_guide placed location specified legend.text.position theme setting. second_guide placed opposite position. second_guide label suppression mechanism, labels drawn guide. shape cap specification providing one following: cap , cap_triangle(). naming cap function without 'cap_'-prefix, e.g. \"round\". two column giving coordinates cap, like created cap functions cap_arch(). size setting size cap. NULL (default), cap size proportional shape coordinates legend.key.size theme setting. show control caps displayed ends bar. TRUE, caps always displayed. FALSE, caps never displayed. NA (default), caps displayed data range exceed limits. given , show[1] controls display lower end show[2] upper end. nbin positive determining many colours use colour gradient. alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. vanilla whether default style match vanilla guide_colourbar() (TRUE) take theme verbatim (FALSE). position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". available_aes vector listing aesthetics guide can build.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colbar.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom colour bar guide — guide_colbar","text":" object","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colbar.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Custom colour bar guide — guide_colbar","text":"colours always rendered gradients, important use graphics device can render . can checked using check_device(\"gradients\").","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_colbar.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom colour bar guide — guide_colbar","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) # The colourbar shows caps when values are out-of-bounds (oob) p + scale_colour_viridis_c( limits = c(10, NA), guide = \"colbar\" ) # It also shows how oob values are handled p + scale_colour_viridis_c( limits = c(10, NA), oob = scales::oob_squish, guide = \"colbar\" ) # Adjusting the type of cap p + scale_colour_viridis_c( limits = c(10, 30), oob = scales::oob_squish, guide = guide_colbar(shape = \"round\") ) # One-sided ticks p + scale_colour_viridis_c( guide = guide_colbar(second_guide = \"none\") ) # Colour bar with minor breaks p + scale_colour_viridis_c( minor_breaks = scales::breaks_width(1), guide = guide_colbar(key = \"minor\") ) # Using log ticks on a colourbar ggplot(msleep, aes(sleep_total, sleep_rem)) + geom_point(aes(colour = bodywt), na.rm = TRUE) + scale_colour_viridis_c( transform = \"log10\", guide = guide_colbar(key = \"log\") )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_colring.html","id":null,"dir":"Reference","previous_headings":"","what":"Colour rings and arcs — guide_colring","title":"Colour rings and arcs — guide_colring","text":"Similar guide_colourbar(), guide displays continuous colour fill aesthetics. Instead bar, gradient shown ring arc, can convenient cyclical palettes provided scico package.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colring.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Colour rings and arcs — guide_colring","text":"","code":"guide_colring( title = waiver(), key = \"auto\", start = 0, end = NULL, outer_guide = \"axis_base\", inner_guide = \"axis_base\", nbin = 300, reverse = FALSE, show_labels = \"outer\", theme = NULL, vanilla = TRUE, position = waiver(), available_aes = c(\"colour\", \"fill\"), ... )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_colring.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Colour rings and arcs — guide_colring","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. key standard key specification. Defaults key_auto(). start, end radians specifying offset starting end points 12 o'clock. NULL default end, internally defaults start + 2 * pi. outer_guide, inner_guide Guides display outside inside colour ring. guide can specified using one following: class object. returns class object. naming function, without guide_ primitive_ prefix. nbin positive determining many colours display. reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. show_labels indicating guide labels shown. Can one \"outer\" (default), \"inner\", \"\" \"none\". Note labels can omitted related guide label suppression mechanism. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. vanilla whether default style match vanilla guide_colourbar() (TRUE) take theme verbatim (FALSE). position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". available_aes vector listing aesthetics guide can build. ... Arguments forwarded outer_guide inner_guide provided functions strings.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colring.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Colour rings and arcs — guide_colring","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_colring.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Colour rings and arcs — guide_colring","text":"","code":"# Rings works best with a cyclical palette my_pal <- c(\"black\", \"tomato\", \"white\", \"dodgerblue\", \"black\") p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + scale_colour_gradientn(colours = my_pal) # Standard colour ring p + guides(colour = \"colring\") # As an arc p + guides(colour = guide_colring( start = 1.25 * pi, end = 2.75 * pi )) # Removing the inner tick marks p + guides(colour = guide_colring(inner_guide = \"none\")) # Include labels on the inner axis p + guides(colour = guide_colring(show_labels = \"both\")) # Passing an argument to inner/outer guides p + guides(colour = guide_colring(angle = 0))"},{"path":"https://teunbrand.github.io/legendry/reference/guide_colsteps.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom colour steps guide — guide_colsteps","title":"Custom colour steps guide — guide_colsteps","text":"Similar guide_coloursteps(), guide displays continuous colour fill aesthetics. additional options display caps end bar, depending --bounds values.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colsteps.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom colour steps guide — guide_colsteps","text":"","code":"guide_colsteps( title = waiver(), key = \"bins\", first_guide = \"axis_base\", second_guide = \"axis_base\", shape = \"triangle\", size = NULL, show = NA, alpha = NA, reverse = FALSE, oob = scales::oob_keep, theme = NULL, position = waiver(), vanilla = TRUE, available_aes = c(\"colour\", \"fill\") )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_colsteps.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom colour steps guide — guide_colsteps","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. key bins key specificiation. Defaults key_bins(even.steps = FALSE, show.limits = NULL). Changing arguments key_bins() fine, changing key type advised. first_guide, second_guide Guides flank colour steps. guide can specified using one following: class object. returns class object. naming function, without guide_ primitive_ prefix. first_guide placed location specified legend.text.position theme setting. second_guide placed opposite position. second_guide label suppression mechanism, labels drawn guide. shape cap specification providing one following: cap , cap_triangle(). naming cap function without 'cap_'-prefix, e.g. \"round\". two column giving coordinates cap, like created cap functions cap_arch(). size setting size cap. NULL (default), cap size proportional shape coordinates legend.key.size theme setting. show control caps displayed ends bar. TRUE, caps always displayed. FALSE, caps never displayed. NA (default), caps displayed data range exceed limits. given , show[1] controls display lower end show[2] upper end. alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". vanilla whether default style match vanilla guide_colourbar() (TRUE) take theme verbatim (FALSE). available_aes vector listing aesthetics guide can build.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colsteps.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom colour steps guide — guide_colsteps","text":" object","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colsteps.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Custom colour steps guide — guide_colsteps","text":"steps rendered clipped rectangles, important use graphics device can render clipped paths. can checked using check_device(\"clippingPaths\").","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_colsteps.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom colour steps guide — guide_colsteps","text":"","code":"p <- ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) # The colour steps show caps when values are out-of-bounds p + scale_colour_viridis_b( limits = c(10, NA), guide = \"colsteps\" ) # It also shows how oob values are handled p + scale_colour_viridis_b( limits = c(10, 30), oob = scales::oob_censor, guide = \"colsteps\" ) # Adjusting the type of cap p + scale_colour_viridis_b( limits = c(10, 30), guide = guide_colsteps(shape = \"round\") ) # The default is to use the breaks as-is p + scale_colour_viridis_b( limits = c(10, 30), breaks = c(10, 20, 25), guide = \"colsteps\" ) # But the display can be set to use evenly spaced steps p + scale_colour_viridis_b( limits = c(10, 30), breaks = c(10, 20, 25), guide = guide_colsteps(key = key_bins(even.steps = TRUE)) ) # Using tick marks by swapping side guides p + scale_colour_viridis_b( guide = guide_colsteps( first_guide = \"axis_base\", second_guide = \"axis_base\" ) )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_base.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom legend guide — guide_legend_base","title":"Custom legend guide — guide_legend_base","text":"legend closely mirrors ggplot2::guide_legend(), two adjustments. First, guide_legend_base() supports design argument flexible layout. Secondly, legend.spacing.y theme element observed verbatim instead overruled.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_base.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom legend guide — guide_legend_base","text":"","code":"guide_legend_base( key = NULL, title = waiver(), theme = NULL, design = NULL, nrow = NULL, ncol = NULL, reverse = FALSE, override.aes = list(), position = NULL, direction = NULL, order = 0 )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_base.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom legend guide — guide_legend_base","text":"key standard key specification. Defaults key_auto(). See information linked topic. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. design Specification legend layout. One following: NULL (default) use layout algorithm guide_legend(). string representing cell layout wherein # defines empty cell. See examples. representing cell layout wherein NA defines empty cell. See examples. Non-string atomic vectors treated .matrix(). nrow, ncol positive setting desired dimensions legend layout. NULL (default), dimensions derived design argument fit match number keys. reverse whether order keys inverted. override.aes named specifying aesthetic parameters key glyphs. See details examples guide_legend(). position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\". order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_base.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom legend guide — guide_legend_base","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_base.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom legend guide — guide_legend_base","text":"","code":"# A dummy plot p <- ggplot(data.frame(x = 1:3, type = c(\"tic\", \"tac\", \"toe\"))) + aes(x, x, shape = type) + geom_point(na.rm = TRUE) + scale_shape_manual(values = c(1, 4, NA)) # A design string, each character giving a cell value. # Newlines separate rows, white space is ignored. design <- \" 123 213 321 \" # Alternatively, the same can be specified using a matrix directly # design <- matrix(c(1, 2, 3, 2, 1, 3, 3, 2, 1), 3, 3, byrow = TRUE) p + guides(shape = guide_legend_base(design = design)) # Empty cells can be created using `#` design <- \" #2# 1#3 \" # Alternatively: # design <- matrix(c(NA, 1, 2, NA, NA, 3), nrow = 2) p + guides(shape = guide_legend_base(design = design))"},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_cross.html","id":null,"dir":"Reference","previous_headings":"","what":"Cross legend guide — guide_legend_cross","title":"Cross legend guide — guide_legend_cross","text":"legend type similar guide_legend() displays crosses, : interactions, two variables.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_cross.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cross legend guide — guide_legend_cross","text":"","code":"guide_legend_cross( key = NULL, title = waiver(), swap = FALSE, col_text = element_text(angle = 90, vjust = 0.5), override.aes = list(), reverse = FALSE, theme = NULL, position = NULL, direction = NULL, order = 0 )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_cross.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cross legend guide — guide_legend_cross","text":"key One following key specifications: group split specification using legend display compound variable like paste(var1, var2). standard key specification, like key_auto(), crossing two separate variables across two scales. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. swap TRUE exchanges column row variables displayed legend. col_text object giving adjustments text column labels. Can NULL display column labels equal fashion row labels. override.aes named specifying aesthetic parameters key glyphs. See details examples guide_legend(). reverse whether order keys inverted, first value controls row order second value column order. Input recycled. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\". order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_cross.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cross legend guide — guide_legend_cross","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_cross.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cross legend guide — guide_legend_cross","text":"","code":"# Standard use for single aesthetic. The default is to split labels to # disentangle aesthetics that are already crossed (by e.g. `paste()`) ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = paste(year, drv))) + guides(colour = \"legend_cross\") # If legends should be merged between identical aesthetics, both need the # same legend type. ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = paste(year, drv), shape = paste(year, drv))) + guides(colour = \"legend_cross\", shape = \"legend_cross\") # Crossing two aesthetics requires a shared title and `key = \"auto\"`. The # easy way to achieve this is to predefine a shared guide. my_guide <- guide_legend_cross(key = \"auto\", title = \"My title\") ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = drv, shape = factor(year))) + guides(colour = my_guide, shape = my_guide) # You can cross more than 2 aesthetics but not more than 2 unique aesthetics. ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = drv, shape = factor(year), size = factor(drv))) + scale_size_ordinal() + guides(colour = my_guide, shape = my_guide, size = my_guide) # You can merge an aesthetic that is already crossed with an aesthetic that # contributes to only one side of the cross. ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = paste(year, drv), shape = drv)) + guides( colour = guide_legend_cross(title = \"My Title\"), shape = guide_legend_cross(title = \"My Title\", key = \"auto\") )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_group.html","id":null,"dir":"Reference","previous_headings":"","what":"Grouped legend — guide_legend_group","title":"Grouped legend — guide_legend_group","text":"legend resembles ggplot2::guide_legend(), ability keep groups blocks titles.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_group.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Grouped legend — guide_legend_group","text":"","code":"guide_legend_group( key = \"group_split\", title = waiver(), override.aes = list(), nrow = NULL, ncol = NULL, theme = NULL, position = NULL, direction = NULL, order = 0 )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_group.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Grouped legend — guide_legend_group","text":"key group key specification. Defaults key_group_split() split labels find groups. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. override.aes named specifying aesthetic parameters key glyphs. See details examples guide_legend(). nrow, ncol positive setting desired dimensions legend layout. Either nrow ncol can set, , theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\". order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_group.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Grouped legend — guide_legend_group","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_group.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Grouped legend — guide_legend_group","text":"","code":"# Standard plot for selection of `msleep` df <- msleep[c(9, 28, 11, 5, 34, 54, 64, 24, 53), ] p <- ggplot(df) + aes(bodywt, awake, colour = paste(order, name)) + geom_point() # By default, groups are inferred from the name p + guides(colour = \"legend_group\") # You can also use a look-up table for groups # The lookup table can be more expansive than just the data: # We're using the full 'msleep' data here instead of the subset lut <- key_group_lut(msleep$name, msleep$order) p + aes(colour = name) + guides(colour = guide_legend_group(key = lut)) # `nrow` and `ncol` apply within groups p + guides(colour = guide_legend_group(nrow = 1)) # Groups are arranged according to `direction` p + guides(colour = guide_legend_group(ncol = 1, direction = \"horizontal\")) + theme(legend.title.position = \"top\") # Customising the group titles p + guides(colour = \"legend_group\") + theme( legendry.legend.subtitle.position = \"left\", legendry.legend.subtitle = element_text( hjust = 1, vjust = 1, size = rel(0.9), margin = margin(t = 5.5, r = 5.5) ) ) # Changing the spacing between groups p + guides(colour = \"legend_group\") + theme(legendry.group.spacing = unit(0, \"cm\"))"},{"path":"https://teunbrand.github.io/legendry/reference/key_group.html","id":null,"dir":"Reference","previous_headings":"","what":"Group keys — key_group","title":"Group keys — key_group","text":"functions helper functions working grouped data keys guides. share goal creating guide key, different methods. key_group_split() function factory whose functions make attempt infer groups scale's labels. key_group_lut() function factory whose functions use look table sort group membership.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_group.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Group keys — key_group","text":"","code":"key_group_split(sep = \"[^[:alnum:]]+\", reverse = FALSE) key_group_lut(members, group, ungrouped = \"Other\")"},{"path":"https://teunbrand.github.io/legendry/reference/key_group.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Group keys — key_group","text":"sep giving regular expression use splitting labels provided scale using strsplit() function. defaults, labels splitted non-alphanumeric character. reverse FALSE (default) treats first part split string groups later parts members. TRUE, treats last part groups. members vector including scale's breaks values. group vector parallel members giving group member. ungrouped giving group label assign scale's breaks match values members argument.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_group.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Group keys — key_group","text":"function use key argument guide.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/key_group.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Group keys — key_group","text":"","code":"# Example scale values <- c(\"group A:value 1\", \"group A:value 2\", \"group B:value 1\") template <- scale_colour_discrete(limits = values) # Treat the 'group X' part as groups key <- key_group_split(sep = \":\") key(template) #> colour .value .label .group #> 1 #F8766D group A:value 1 value 1 group A #> 2 #00BA38 group A:value 2 value 2 group A #> 3 #619CFF group B:value 1 value 1 group B # Treat the 'value X' part as groups key <- key_group_split(sep = \":\", reverse = TRUE) key(template) #> colour .value .label .group #> 1 #F8766D group A:value 1 group A value 1 #> 2 #619CFF group B:value 1 group B value 1 #> 3 #00BA38 group A:value 2 group A value 2 # Example scale template <- scale_colour_discrete(limits = msleep$name[c(1, 7, 9, 23, 24)]) # A lookup table can have more entries than needed key <- key_group_lut(msleep$name, msleep$order) key(template) #> colour .value .label .group #> 1 #F8766D Cheetah Cheetah Carnivora #> 2 #A3A500 Northern fur seal Northern fur seal Carnivora #> 3 #00BF7D Dog Dog Carnivora #> 4 #00B0F6 Horse Horse Perissodactyla #> 5 #E76BF3 Donkey Donkey Perissodactyla # Or less entries than needed key <- key_group_lut( msleep$name[23:24], msleep$order[23:24], ungrouped = \"Other animals\" ) key(template) #> colour .value .label .group #> 1 #00B0F6 Horse Horse Perissodactyla #> 2 #E76BF3 Donkey Donkey Perissodactyla #> 3 #F8766D Cheetah Cheetah Other animals #> 4 #A3A500 Northern fur seal Northern fur seal Other animals #> 5 #00BF7D Dog Dog Other animals"},{"path":"https://teunbrand.github.io/legendry/reference/key_range.html","id":null,"dir":"Reference","previous_headings":"","what":"Range keys — key_range","title":"Range keys — key_range","text":"functions helper functions working ranged data keys guides. share goal creating guide key, different methods: key_range_auto() function factory whose functions make attempt infer ranges scale's labels. key_range_manual() uses user-provided vectors set ranges. key_range_map() makes mappings set ranges.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_range.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Range keys — key_range","text":"","code":"key_range_auto(sep = \"[^[:alnum:]]+\", reverse = FALSE, ...) key_range_manual(start, end, name = NULL, level = NULL, ...) key_range_map(data, ..., .call = caller_env())"},{"path":"https://teunbrand.github.io/legendry/reference/key_range.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Range keys — key_range","text":"sep giving regular expression use splitting labels provided scale using strsplit(). Defaults splitting non-alphanumeric character. reverse FALSE (default) treats first labels inner labels last labels outer labels. TRUE, thee first labels treated outer labels last labels treated inner labels. ... set mappings similar provided aes(), evaluated data argument. key_range_map(), must contain start end mappings. Can contain additional parameters text styling, namely colour, family, face, size, hjust, vjust, angle lineheight. start, end vector can interpreted scale, giving start end positions range respectively. name list expressions level giving depth range avoid overlaps different ranges. level smaller 1, brackets drawn. data similar object coerced fortify() , mapping argument evaluated. .call call display messages.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_range.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Range keys — key_range","text":"key_range_auto() function. key_range_manual() key_range_map() class.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_range.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Range keys — key_range","text":"level variable optional missing, guides use algorithm similar IRanges::disjointBins() avoid overlaps. key_range_auto() work expression labels.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/key_range.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Range keys — key_range","text":"","code":"# Example scale template <- scale_x_discrete(limits = c(\"A 1\", \"B 1\", \"C&1\", \"D&2\", \"E&2\")) # By default, splits on all non-alphanumeric characters auto <- key_range_auto() auto(template) #> start end .label .level #> 1 1 1 A 0 #> 2 2 2 B 0 #> 3 3 3 C 0 #> 4 4 4 D 0 #> 5 5 5 E 0 #> 6 1 3 1 1 #> 7 4 5 2 1 # Only split on a specific character auto <- key_range_auto(sep = \"&\") auto(template) #> Warning: Not all labels in `key_range_auto()` can be split into equal lengths. #> ℹ Is \"&\" the correct `sep` argument? #> start end .label .level #> 1 1 1 A 1 0 #> 2 2 2 B 1 0 #> 3 3 3 C 0 #> 4 4 4 D 0 #> 5 5 5 E 0 #> 6 3 3 1 1 #> 7 4 5 2 1 # Treating the letters as outer labels and numbers as inner labels auto <- key_range_auto(reverse = TRUE) auto(template) #> start end .label .level #> 1 1 1 1 0 #> 2 2 2 1 0 #> 3 3 3 1 0 #> 4 4 4 2 0 #> 5 5 5 2 0 #> 6 1 1 A 1 #> 7 2 2 B 1 #> 8 3 3 C 1 #> 9 4 4 D 1 #> 10 5 5 E 1 # Providing custom values key_range_manual( start = c(1, 5, 10), end = c(4, 15, 11), level = c(0, 2, 1), name = c(\"A\", \"B\", \"C\") ) #> start end .label .level #> 1 1 4 A 0 #> 2 5 15 B 2 #> 3 10 11 C 1 # Values from a key_range_map(presidential, start = start, end = end, name = name) #> start end .label #> 1 1953-01-20 1961-01-20 Eisenhower #> 2 1961-01-20 1963-11-22 Kennedy #> 3 1963-11-22 1969-01-20 Johnson #> 4 1969-01-20 1974-08-09 Nixon #> 5 1974-08-09 1977-01-20 Ford #> 6 1977-01-20 1981-01-20 Carter #> 7 1981-01-20 1989-01-20 Reagan #> 8 1989-01-20 1993-01-20 Bush #> 9 1993-01-20 2001-01-20 Clinton #> 10 2001-01-20 2009-01-20 Bush #> 11 2009-01-20 2017-01-20 Obama #> 12 2017-01-20 2021-01-20 Trump"},{"path":"https://teunbrand.github.io/legendry/reference/key_segments.html","id":null,"dir":"Reference","previous_headings":"","what":"Segment keys — key_segments","title":"Segment keys — key_segments","text":"functions helper functions working segment data keys guides. share goal creating guide key, different methods: key_segment_manual() directly uses user-provided vectors set segments. key_segment_map() makes mappings set segments. key_dendro() specialty case coercing dendrogram data segments. aware setting key alone affect scale limits, give misleading results used incorrectly!","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_segments.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Segment keys — key_segments","text":"","code":"key_segment_manual(value, oppo, value_end = value, oppo_end = oppo, ...) key_segment_map(data, ..., .call = caller_env()) key_dendro(dendro = NULL, type = \"rectangle\")"},{"path":"https://teunbrand.github.io/legendry/reference/key_segments.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Segment keys — key_segments","text":"value, value_end vector interpreted along scale guide codifies. oppo, oppo_end vector interpreted orthogonal value value_end variables. ... set mappings similar provided aes(), evaluated data argument. key_segments_map(), must contain value oppo mappings. data similar object coerced fortify() , mapping argument evaluated. .call call display messages. dendro data structure can coerced dendrogram .dendrogram() function. NULL (default) attempt made search data scale. type string, either \"rectangle\" \"triangle\", indicating shape edges nodes dendrogram.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_segments.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Segment keys — key_segments","text":"key_segments_manual() key_segments_map(), class.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/key_segments.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Segment keys — key_segments","text":"","code":"# Giving vectors directly key_segment_manual( value = 0:1, value_end = 2:3, oppo = 1:0, oppo_end = 3:2 ) #> value oppo value_end oppo_end #> 1 0 1 2 3 #> 2 1 0 3 2 # Taking columns of a data frame data <- data.frame(x = 0:1, y = 1:0, xend = 2:3, yend = 3:2) key_segment_map(data, value = x, oppo = y, value_end = xend, oppo_end = yend) #> value oppo value_end oppo_end #> 1 0 1 2 3 #> 2 1 0 3 2 # Using dendrogram data clust <- hclust(dist(USArrests), \"ave\") key_dendro(clust)(scale_x_discrete()) #> value oppo value_end oppo_end #> 1 17.994141 152.313999 4.765625 152.313999 #> 2 4.765625 152.313999 4.765625 77.605024 #> 3 17.994141 152.313999 31.222656 152.313999 #> 4 31.222656 152.313999 31.222656 89.232093 #> 5 4.765625 77.605024 1.500000 77.605024 #> 6 1.500000 77.605024 1.500000 38.527912 #> 7 4.765625 77.605024 8.031250 77.605024 #> 8 8.031250 77.605024 8.031250 44.283922 #> 9 1.500000 38.527912 1.000000 38.527912 #> 10 1.000000 38.527912 1.000000 0.000000 #> 11 1.500000 38.527912 2.000000 38.527912 #> 12 2.000000 38.527912 2.000000 0.000000 #> 13 8.031250 44.283922 3.875000 44.283922 #> 14 3.875000 44.283922 3.875000 28.012211 #> 15 8.031250 44.283922 12.187500 44.283922 #> 16 12.187500 44.283922 12.187500 39.394633 #> 17 3.875000 28.012211 3.000000 28.012211 #> 18 3.000000 28.012211 3.000000 0.000000 #> 19 3.875000 28.012211 4.750000 28.012211 #> 20 4.750000 28.012211 4.750000 15.453120 #> 21 4.750000 15.453120 4.000000 15.453120 #> 22 4.000000 15.453120 4.000000 0.000000 #> 23 4.750000 15.453120 5.500000 15.453120 #> 24 5.500000 15.453120 5.500000 13.896043 #> 25 5.500000 13.896043 5.000000 13.896043 #> 26 5.000000 13.896043 5.000000 0.000000 #> 27 5.500000 13.896043 6.000000 13.896043 #> 28 6.000000 13.896043 6.000000 0.000000 #> 29 12.187500 39.394633 9.625000 39.394633 #> 30 9.625000 39.394633 9.625000 26.363428 #> 31 12.187500 39.394633 14.750000 39.394633 #> 32 14.750000 39.394633 14.750000 28.095803 #> 33 9.625000 26.363428 7.750000 26.363428 #> 34 7.750000 26.363428 7.750000 16.891499 #> 35 9.625000 26.363428 11.500000 26.363428 #> 36 11.500000 26.363428 11.500000 18.417331 #> 37 7.750000 16.891499 7.000000 16.891499 #> 38 7.000000 16.891499 7.000000 0.000000 #> 39 7.750000 16.891499 8.500000 16.891499 #> 40 8.500000 16.891499 8.500000 15.454449 #> 41 8.500000 15.454449 8.000000 15.454449 #> 42 8.000000 15.454449 8.000000 0.000000 #> 43 8.500000 15.454449 9.000000 15.454449 #> 44 9.000000 15.454449 9.000000 0.000000 #> 45 11.500000 18.417331 10.500000 18.417331 #> 46 10.500000 18.417331 10.500000 6.236986 #> 47 11.500000 18.417331 12.500000 18.417331 #> 48 12.500000 18.417331 12.500000 13.297368 #> 49 10.500000 6.236986 10.000000 6.236986 #> 50 10.000000 6.236986 10.000000 0.000000 #> 51 10.500000 6.236986 11.000000 6.236986 #> 52 11.000000 6.236986 11.000000 0.000000 #> 53 12.500000 13.297368 12.000000 13.297368 #> 54 12.000000 13.297368 12.000000 0.000000 #> 55 12.500000 13.297368 13.000000 13.297368 #> 56 13.000000 13.297368 13.000000 0.000000 #> 57 14.750000 28.095803 14.000000 28.095803 #> 58 14.000000 28.095803 14.000000 0.000000 #> 59 14.750000 28.095803 15.500000 28.095803 #> 60 15.500000 28.095803 15.500000 21.167192 #> 61 15.500000 21.167192 15.000000 21.167192 #> 62 15.000000 21.167192 15.000000 0.000000 #> 63 15.500000 21.167192 16.000000 21.167192 #> 64 16.000000 21.167192 16.000000 0.000000 #> 65 31.222656 89.232093 23.796875 89.232093 #> 66 23.796875 89.232093 23.796875 44.837933 #> 67 31.222656 89.232093 38.648438 89.232093 #> 68 38.648438 89.232093 38.648438 54.746831 #> 69 23.796875 44.837933 20.343750 44.837933 #> 70 20.343750 44.837933 20.343750 26.713777 #> 71 23.796875 44.837933 27.250000 44.837933 #> 72 27.250000 44.837933 27.250000 29.054195 #> 73 20.343750 26.713777 17.937500 26.713777 #> 74 17.937500 26.713777 17.937500 16.425489 #> 75 20.343750 26.713777 22.750000 26.713777 #> 76 22.750000 26.713777 22.750000 22.595978 #> 77 17.937500 16.425489 17.000000 16.425489 #> 78 17.000000 16.425489 17.000000 0.000000 #> 79 17.937500 16.425489 18.875000 16.425489 #> 80 18.875000 16.425489 18.875000 12.878100 #> 81 18.875000 12.878100 18.000000 12.878100 #> 82 18.000000 12.878100 18.000000 0.000000 #> 83 18.875000 12.878100 19.750000 12.878100 #> 84 19.750000 12.878100 19.750000 10.736739 #> 85 19.750000 10.736739 19.000000 10.736739 #> 86 19.000000 10.736739 19.000000 0.000000 #> 87 19.750000 10.736739 20.500000 10.736739 #> 88 20.500000 10.736739 20.500000 7.355270 #> 89 20.500000 7.355270 20.000000 7.355270 #> 90 20.000000 7.355270 20.000000 0.000000 #> 91 20.500000 7.355270 21.000000 7.355270 #> 92 21.000000 7.355270 21.000000 0.000000 #> 93 22.750000 22.595978 22.000000 22.595978 #> 94 22.000000 22.595978 22.000000 0.000000 #> 95 22.750000 22.595978 23.500000 22.595978 #> 96 23.500000 22.595978 23.500000 11.456439 #> 97 23.500000 11.456439 23.000000 11.456439 #> 98 23.000000 11.456439 23.000000 0.000000 #> 99 23.500000 11.456439 24.000000 11.456439 #> 100 24.000000 11.456439 24.000000 0.000000 #> 101 27.250000 29.054195 25.750000 29.054195 #> 102 25.750000 29.054195 25.750000 20.198479 #> 103 27.250000 29.054195 28.750000 29.054195 #> 104 28.750000 29.054195 28.750000 23.972143 #> 105 25.750000 20.198479 25.000000 20.198479 #> 106 25.000000 20.198479 25.000000 0.000000 #> 107 25.750000 20.198479 26.500000 20.198479 #> 108 26.500000 20.198479 26.500000 12.614278 #> 109 26.500000 12.614278 26.000000 12.614278 #> 110 26.000000 12.614278 26.000000 0.000000 #> 111 26.500000 12.614278 27.000000 12.614278 #> 112 27.000000 12.614278 27.000000 0.000000 #> 113 28.750000 23.972143 28.000000 23.972143 #> 114 28.000000 23.972143 28.000000 0.000000 #> 115 28.750000 23.972143 29.500000 23.972143 #> 116 29.500000 23.972143 29.500000 14.501034 #> 117 29.500000 14.501034 29.000000 14.501034 #> 118 29.000000 14.501034 29.000000 0.000000 #> 119 29.500000 14.501034 30.000000 14.501034 #> 120 30.000000 14.501034 30.000000 0.000000 #> 121 38.648438 54.746831 34.437500 54.746831 #> 122 34.437500 54.746831 34.437500 20.598507 #> 123 38.648438 54.746831 42.859375 54.746831 #> 124 42.859375 54.746831 42.859375 41.094765 #> 125 34.437500 20.598507 31.875000 20.598507 #> 126 31.875000 20.598507 31.875000 15.026107 #> 127 34.437500 20.598507 37.000000 20.598507 #> 128 37.000000 20.598507 37.000000 15.122897 #> 129 31.875000 15.026107 31.000000 15.026107 #> 130 31.000000 15.026107 31.000000 0.000000 #> 131 31.875000 15.026107 32.750000 15.026107 #> 132 32.750000 15.026107 32.750000 12.438692 #> 133 32.750000 12.438692 32.000000 12.438692 #> 134 32.000000 12.438692 32.000000 0.000000 #> 135 32.750000 12.438692 33.500000 12.438692 #> 136 33.500000 12.438692 33.500000 3.834058 #> 137 33.500000 3.834058 33.000000 3.834058 #> 138 33.000000 3.834058 33.000000 0.000000 #> 139 33.500000 3.834058 34.000000 3.834058 #> 140 34.000000 3.834058 34.000000 0.000000 #> 141 37.000000 15.122897 35.500000 15.122897 #> 142 35.500000 15.122897 35.500000 6.637771 #> 143 37.000000 15.122897 38.500000 15.122897 #> 144 38.500000 15.122897 38.500000 13.352260 #> 145 35.500000 6.637771 35.000000 6.637771 #> 146 35.000000 6.637771 35.000000 0.000000 #> 147 35.500000 6.637771 36.000000 6.637771 #> 148 36.000000 6.637771 36.000000 0.000000 #> 149 38.500000 13.352260 37.500000 13.352260 #> 150 37.500000 13.352260 37.500000 3.929377 #> 151 38.500000 13.352260 39.500000 13.352260 #> 152 39.500000 13.352260 39.500000 8.027453 #> 153 37.500000 3.929377 37.000000 3.929377 #> 154 37.000000 3.929377 37.000000 0.000000 #> 155 37.500000 3.929377 38.000000 3.929377 #> 156 38.000000 3.929377 38.000000 0.000000 #> 157 39.500000 8.027453 39.000000 8.027453 #> 158 39.000000 8.027453 39.000000 0.000000 #> 159 39.500000 8.027453 40.000000 8.027453 #> 160 40.000000 8.027453 40.000000 0.000000 #> 161 42.859375 41.094765 41.000000 41.094765 #> 162 41.000000 41.094765 41.000000 0.000000 #> 163 42.859375 41.094765 44.718750 41.094765 #> 164 44.718750 41.094765 44.718750 33.117815 #> 165 44.718750 33.117815 42.750000 33.117815 #> 166 42.750000 33.117815 42.750000 10.771175 #> 167 44.718750 33.117815 46.687500 33.117815 #> 168 46.687500 33.117815 46.687500 27.779904 #> 169 42.750000 10.771175 42.000000 10.771175 #> 170 42.000000 10.771175 42.000000 0.000000 #> 171 42.750000 10.771175 43.500000 10.771175 #> 172 43.500000 10.771175 43.500000 8.537564 #> 173 43.500000 8.537564 43.000000 8.537564 #> 174 43.000000 8.537564 43.000000 0.000000 #> 175 43.500000 8.537564 44.000000 8.537564 #> 176 44.000000 8.537564 44.000000 0.000000 #> 177 46.687500 27.779904 45.500000 27.779904 #> 178 45.500000 27.779904 45.500000 13.044922 #> 179 46.687500 27.779904 47.875000 27.779904 #> 180 47.875000 27.779904 47.875000 18.993398 #> 181 45.500000 13.044922 45.000000 13.044922 #> 182 45.000000 13.044922 45.000000 0.000000 #> 183 45.500000 13.044922 46.000000 13.044922 #> 184 46.000000 13.044922 46.000000 0.000000 #> 185 47.875000 18.993398 47.000000 18.993398 #> 186 47.000000 18.993398 47.000000 0.000000 #> 187 47.875000 18.993398 48.750000 18.993398 #> 188 48.750000 18.993398 48.750000 10.184218 #> 189 48.750000 10.184218 48.000000 10.184218 #> 190 48.000000 10.184218 48.000000 0.000000 #> 191 48.750000 10.184218 49.500000 10.184218 #> 192 49.500000 10.184218 49.500000 2.291288 #> 193 49.500000 2.291288 49.000000 2.291288 #> 194 49.000000 2.291288 49.000000 0.000000 #> 195 49.500000 2.291288 50.000000 2.291288 #> 196 50.000000 2.291288 50.000000 0.000000"},{"path":"https://teunbrand.github.io/legendry/reference/key_specialty.html","id":null,"dir":"Reference","previous_headings":"","what":"Speciality keys — key_specialty","title":"Speciality keys — key_specialty","text":"functions helper functions working keys guides. functions described widely applicable may apply small subset guides. , fine adjust arguments speciality key, swapping types ill-advised. key_sequence() function factory whose functions create regularly spaced sequence limits scale. used colour bar guides. key_bins() function factory whose function create binned key given breaks scale. used colour steps guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_specialty.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Speciality keys — key_specialty","text":"","code":"key_sequence(n = 15) key_bins(even.steps = FALSE, show.limits = NULL)"},{"path":"https://teunbrand.github.io/legendry/reference/key_specialty.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Speciality keys — key_specialty","text":"n positive giving number colours use gradient. even.steps indicating whether size bins displayed equal (TRUE) proportional length data space (FALSE). show.limits stating whether limits scale shown labels ticks (TRUE) remain hidden (FALSE). Note breaks coinciding limits shown regardless setting. default, NULL, consults scale's show.limits setting defaults FALSE.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_specialty.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Speciality keys — key_specialty","text":"key_sequence() function.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/key_specialty.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Speciality keys — key_specialty","text":"","code":"# An example scale template <- scale_fill_viridis_c(limits = c(0, 10), breaks = c(2, 4, 6, 8)) # Retrieving colourbar and colourstep keys key_sequence()(template) #> fill .value #> 1 #440154 0.0000000 #> 2 #461F66 0.7142857 #> 3 #453478 1.4285714 #> 4 #414888 2.1428571 #> 5 #3C5B8A 2.8571429 #> 6 #336D8D 3.5714286 #> 7 #2B7F8D 4.2857143 #> 8 #2B9089 5.0000000 #> 9 #26A186 5.7142857 #> 10 #40B17B 6.4285714 #> 11 #5FBF69 7.1428571 #> 12 #76CE56 7.8571429 #> 13 #A4D848 8.5714286 #> 14 #D2E039 9.2857143 #> 15 #FDE725 10.0000000 key_bins()(template) #> fill min max .label .value #> 1 #46286D 0 2 NA #> 2 #3B5E8B 2 4 2 2 #> 3 #2B9089 4 6 4 4 #> 4 #5ABC6D 6 8 6 6 #> 5 #C0DD40 8 10 8 8 #> 6 NA NA NA"},{"path":"https://teunbrand.github.io/legendry/reference/key_standard.html","id":null,"dir":"Reference","previous_headings":"","what":"Standard keys — key_standard","title":"Standard keys — key_standard","text":"functions helper functions working tick marks keys guides. share goal creating guide key, different outcomes: key_auto() function factory whose functions extract typical key major breaks scale. key_manual() uses user-provided vectors make key. key_map() makes mappings make key. key_minor() function factory whose functions also extract minor break positions minor tick marks. key_log() function factory whose functions place ticks intervals log10 space. key_none() makes empty key entries.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_standard.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Standard keys — key_standard","text":"","code":"key_auto(...) key_manual( aesthetic, value = aesthetic, label = as.character(value), type = NULL, ... ) key_map(data, ..., .call = caller_env()) key_minor(...) key_log( prescale_base = NULL, negative_small = 0.1, expanded = TRUE, labeller = NULL, ... ) key_none()"},{"path":"https://teunbrand.github.io/legendry/reference/key_standard.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Standard keys — key_standard","text":"... set mappings similar provided aes(), evaluated data argument. must contain aesthetic mapping. aesthetic, value vector values guide represent equivalent breaks argument scales. aesthetic mapped, whereas value . intents purposes, aesthetic value identical. label list expressions use labels. type vector representing one break types: \"major\", \"minor\" \"mini\". NULL (default), breaks treated major breaks. data similar object coerced fortify() , mapping argument evaluated. .call call display messages. prescale_base giving base logarithm transform data manually. default, NULL, use scale transformation calculate positions. advisable set prescale_base argument data already log-transformed. using log-transform scale coord_trans(), default NULL recommended. negative_small setting smallest absolute value marked tick case scale limits include 0 negative numbers. expanded determining whether ticks cover entire range scale expansion (TRUE, default), restricted scale limits (FALSE). labeller receives major breaks returns formatted labels. key_log(), NULL default scales::label_log() strictly positive numbers custom labeller negative numbers included.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_standard.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Standard keys — key_standard","text":"key_auto(), key_minor() key_log() function. key_manual() key_map() class.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/key_standard.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Standard keys — key_standard","text":"","code":"# An example scale template <- scale_x_continuous(limits = c(0, 10)) # The auto, minor and log keys operate on scales key_auto()(template) #> x .value .label #> 1 0.0 0.0 0.0 #> 2 2.5 2.5 2.5 #> 3 5.0 5.0 5.0 #> 4 7.5 7.5 7.5 #> 5 10.0 10.0 10.0 key_minor()(template) #> x .value .label .type #> 1 0.00 0.00 0.0 major #> 2 2.50 2.50 2.5 major #> 3 5.00 5.00 5.0 major #> 4 7.50 7.50 7.5 major #> 5 10.00 10.00 10.0 major #> 6 1.25 1.25 minor #> 7 3.75 3.75 minor #> 8 6.25 6.25 minor #> 9 8.75 8.75 minor # So does the log key template <- scale_x_continuous(transform = \"log10\", limits = c(0.1, 10)) key_log()(template) # Providing custom values key_manual( aesthetic = 1:5, label = c(\"one\", \"two\", \"three\", \"four\", \"five\") ) #> aesthetic .value .label #> 1 1 1 one #> 2 2 2 two #> 3 3 3 three #> 4 4 4 four #> 5 5 5 five # Values from a `` key_map(ToothGrowth, aesthetic = unique(supp)) #> aesthetic .value .label #> 1 VC VC VC #> 2 OJ OJ OJ # Empty key key_none() #> [1] aesthetic .value .label #> <0 rows> (or 0-length row.names)"},{"path":"https://teunbrand.github.io/legendry/reference/legendry-package.html","id":null,"dir":"Reference","previous_headings":"","what":"legendry: Extended Legends and Axes for 'ggplot2' — legendry-package","title":"legendry: Extended Legends and Axes for 'ggplot2' — legendry-package","text":"'ggplot2' extension focusses expanding plotter's arsenal guides. Guides 'ggplot2' include axes legends. 'legendry' offers new axes annotation options, well new legends colour displays.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/legendry-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"legendry: Extended Legends and Axes for 'ggplot2' — legendry-package","text":"Maintainer: Teun van den Brand tahvdbrand@gmail.com (ORCID) [copyright holder]","code":""},{"path":"https://teunbrand.github.io/legendry/reference/legendry_extensions.html","id":null,"dir":"Reference","previous_headings":"","what":"ggproto objects in legendry — Compose","title":"ggproto objects in legendry — Compose","text":"legendry package relies extension system ggplot2 ggproto class objects, allow cross-package inheritance objects geoms, stats, facets, scales coordinate systems. purpose making plots, users invited wholly ignore objects, since interacting objects preferred various constructor functions. legendry package introduces new ggproto class support variations axes, legends colourbars.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitives: boxes — primitive_box","title":"Guide primitives: boxes — primitive_box","text":"function constructs boxes guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitives: boxes — primitive_box","text":"","code":"primitive_box( key = \"range_auto\", angle = waiver(), oob = \"squish\", drop_zero = TRUE, pad_discrete = 0.4, min_size = NULL, levels_box = NULL, levels_text = NULL, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitives: boxes — primitive_box","text":"key range key specification. See information linked topic. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. oob method dealing --bounds (oob) ranges. Can one \"squish\", \"censor\" \"none\". drop_zero whether drop near-zero width ranges (TRUE, default) preserve (FALSE). pad_discrete giving amount ranges extended given discrete variable. applied drop_zero setting. min_size [][grid::unit] setting minimal size box. levels_box list objects customise boxes appear every level. levels_text list objects customise text appears every level. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitives: boxes — primitive_box","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitives: boxes — primitive_box","text":"theme options determine styling guide, may differ depending whether guide used axis legend context. Common types following: legendry.box boxes draw.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitives: boxes — primitive_box","text":"axis.text.{x/y}.{position} text inside boxes.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitives: boxes — primitive_box","text":"legend.text text inside boxes.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitives: boxes — primitive_box","text":"","code":"# A standard plot p <- ggplot(mpg, aes(interaction(drv, year), displ)) + geom_point() key <- key_range_manual(c(2, 4), c(5, 6), c(\"A\", \"B\")) # Adding as secondary guides p + guides( x.sec = primitive_box(), y.sec = primitive_box(key = key) )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: brackets — primitive_bracket","title":"Guide primitive: brackets — primitive_bracket","text":"function constructs brackets guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: brackets — primitive_bracket","text":"","code":"primitive_bracket( key = \"range_auto\", bracket = \"line\", angle = waiver(), oob = \"squish\", drop_zero = TRUE, pad_discrete = 0.4, levels_brackets = NULL, levels_text = NULL, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: brackets — primitive_bracket","text":"key range key specification. See information linked topic. bracket bracket providing one following: bracket , bracket_square. naming bracket function without 'bracket_'-prefix, e.g. \"square\". two-column giving line coordinates bracket, like created bracket functions, bracket_round(). angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. oob method dealing --bounds (oob) ranges. Can one \"squish\", \"censor\" \"none\". drop_zero whether drop near-zero width ranges (TRUE, default) preserve (FALSE). pad_discrete giving amount ranges extended given discrete variable. applied drop_zero setting. levels_brackets list objects customise brackets appear every level. levels_text list objects customise text appears every level. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: brackets — primitive_bracket","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: brackets — primitive_bracket","text":"theme options determine styling guide, may differ depending whether guide used axis legend context. Common types following: legendry.bracket line used draw brackets. legendry.backet.size setting space afforded bracket.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: brackets — primitive_bracket","text":"axis.text.{x/y}.{position} text displayed brackets.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: brackets — primitive_bracket","text":"legend.text text displayed brackets.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: brackets — primitive_bracket","text":"","code":"# A standard plot p <- ggplot(mpg, aes(interaction(drv, year), displ)) + geom_point() key <- key_range_manual(c(2, 4), c(5, 6), c(\"A\", \"B\")) # Adding as secondary guides p + guides( x.sec = primitive_bracket(), y.sec = primitive_bracket(key = key) )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: fence — primitive_fence","title":"Guide primitive: fence — primitive_fence","text":"function constructs fence guide primitive. customisation options easier understand view fence 'post' vertical pieces real world fence, 'rail' horizontal pieces.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: fence — primitive_fence","text":"","code":"primitive_fence( key = \"range_auto\", rail = \"none\", angle = waiver(), oob = \"squish\", drop_zero = TRUE, pad_discrete = 0.5, levels_text = NULL, levels_post = NULL, levels_rail = NULL, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: fence — primitive_fence","text":"key range key specification. See information linked topic. rail giving option display fence railing. Can either \"none\" (default) display railings, \"inner\" draw one rail closer plot panel, \"outer\" display one rail farther plot panel, \"\" sandwich labels rails. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. oob method dealing --bounds (oob) ranges. Can one \"squish\", \"censor\" \"none\". drop_zero whether drop near-zero width ranges (TRUE, default) preserve (FALSE). pad_discrete giving amount ranges extended given discrete variable. applied drop_zero setting. levels_text list objects customise text appears every level. levels_post, levels_rail list objects customise fence posts rails displayed every level. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: fence — primitive_fence","text":" primitive guie can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: fence — primitive_fence","text":"theme options determine styling guide, may differ depending whether guide used axis legend context. Common types following: legendry.fence.post line used draw pieces orthogonal direction scale. legendry.fence.rail line used draw pieces parallel direction scale.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: fence — primitive_fence","text":"axis.text.{x/y}.{position} text displayed.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: fence — primitive_fence","text":"legend.text text displayed.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: fence — primitive_fence","text":"","code":"# A standard plot p <- ggplot(mpg, aes(interaction(drv, year), displ)) + geom_point() key <- key_range_manual(c(2, 4), c(5, 6), c(\"A\", \"B\")) # Adding as secondary guides p + guides( x.sec = primitive_fence(rail = \"inner\"), y.sec = primitive_fence(key = key, rail = \"outer\") )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: labels — primitive_labels","title":"Guide primitive: labels — primitive_labels","text":"function constructs labels guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: labels — primitive_labels","text":"","code":"primitive_labels( key = NULL, angle = waiver(), n.dodge = 1, check.overlap = FALSE, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: labels — primitive_labels","text":"key standard key specification. See information linked topic. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. n.dodge positive setting number layers text labels can occupy avoid overlapping labels. check.overlap indicating whether check omit overlapping text. TRUE, first, last middle labels recursively prioritised order. FALSE, labels drawn. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: labels — primitive_labels","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: labels — primitive_labels","text":"theme options determine styling guide, may differ depending whether guide used axis legend context.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: labels — primitive_labels","text":"axis.text.{x/y}.{position} display labels.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"as-a-legend-guide-","dir":"Reference","previous_headings":"","what":"As a legend guide.","title":"Guide primitive: labels — primitive_labels","text":"legend.text display labels.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: labels — primitive_labels","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # Adding as secondary guides p + guides( x.sec = primitive_labels(), y.sec = primitive_labels(n.dodge = 2) )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: line — primitive_line","title":"Guide primitive: line — primitive_line","text":"function constructs line guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: line — primitive_line","text":"","code":"primitive_line(key = NULL, cap = \"none\", theme = NULL, position = waiver())"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: line — primitive_line","text":"key standard key specification. See information linked topic. cap method cap axes. One following: one following: \"none\" perform capping. \"\" cap line ends extreme breaks. \"upper\" cap line upper extreme break. \"lower\" cap line lower extreme break. [1], TRUE equivalent \"\" FALSE equivalent \"none\" options . sorted [2n] even number members. lines drawn every odd-even pair. takes scale's breaks first argument, scale's limits second argument returns [2n] described . theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: line — primitive_line","text":"PrimitiveLine primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: line — primitive_line","text":"theme options determine styling guide, may differ depending whether guide used axis legend context.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: line — primitive_line","text":"axis.line.{x/y}.{position} line style.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: line — primitive_line","text":"legend.axis.line line style.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: line — primitive_line","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + theme(axis.line = element_line()) # Adding as secondary guides p + guides( x.sec = primitive_line(), y.sec = primitive_line(cap = \"both\") )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitives: segments — primitive_segments","title":"Guide primitives: segments — primitive_segments","text":"function constructs guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitives: segments — primitive_segments","text":"","code":"primitive_segments( key = NULL, space = rel(10), vanish = FALSE, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitives: segments — primitive_segments","text":"key segment key specification. See information linked topic. Alternatively, object class automatically invokes key_dendro(). space Either object length 1 determining space allocated orthogonal direction. space argument class (default) base size taken tick length theme setting. vanish relevant guide used secondary theta position: whether continue draw segments meed center (TRUE) strictly observe space setting (FALSE). theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitives: segments — primitive_segments","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitives: segments — primitive_segments","text":"theme options determine style guide, may differ depending whether guide used axis legend context.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitives: segments — primitive_segments","text":"axis.ticks.{x/y}.{position} display segments. axis.ticks.length.{x/y}.{position} base size segments orthogonal direction.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitives: segments — primitive_segments","text":"legend.ticks display segments. legend.ticks.length base size segments orthogonal direction.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitives: segments — primitive_segments","text":"","code":"# Building a key key <- key_segment_manual( value = c(1.6, 1.6, 3.4, 5.2), value_end = c(7.0, 7.0, 3.4, 5.2), oppo = c(1.0, 2.0, 0.0, 0.0), oppo_end = c(1.0, 2.0, 3.0, 3.0) ) # Using the primitive in a plot ggplot(mpg, aes(displ, hwy)) + geom_point() + scale_x_continuous( guide = primitive_segments(key = key) )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_spacer.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: spacer — primitive_spacer","title":"Guide primitive: spacer — primitive_spacer","text":"function constructs spacer guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_spacer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: spacer — primitive_spacer","text":"","code":"primitive_spacer( space = NULL, title = waiver(), theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_spacer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: spacer — primitive_spacer","text":"space [][grid::unit()] title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_spacer.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: spacer — primitive_spacer","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_spacer.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: spacer — primitive_spacer","text":"#' theme options determine styling guide. guide option dependent role axis legend. legendry.guide.spacing setting amount spacing space argument NULL.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_spacer.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: spacer — primitive_spacer","text":"","code":"ggplot(mpg, aes(displ, hwy)) + geom_point() + guides( x = guide_axis_stack(\"axis\", primitive_spacer(unit(1, \"cm\")), \"axis\") )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: line — primitive_ticks","title":"Guide primitive: line — primitive_ticks","text":"function constructs ticks guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: line — primitive_ticks","text":"","code":"primitive_ticks(key = NULL, bidi = FALSE, theme = NULL, position = waiver())"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: line — primitive_ticks","text":"key standard key specification. See information linked topic. bidi : whether ticks drawn bidirectionally (TRUE) single direction (FALSE, default). theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: line — primitive_ticks","text":"PrimitiveTicks primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: line — primitive_ticks","text":"theme options determine styling guide, may differ depending whether guide used axis legend context. Common types following:","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: line — primitive_ticks","text":"axis.ticks.{x/y}.{position} major tick lines. axis.minor.ticks.{x/y}.{position} minor tick lines. legendry.axis.mini.ticks internally inheriting minor ticks smallest ticks e.g. log axes. axis.ticks.length.{x/y}.{position} major ticks length. axis.minor.ticks.length.{x/y}.{position} minor ticks length. legendry.axis.mini.ticks.length internally inheriting minor tick length smallest ticks e.g. log axes.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: line — primitive_ticks","text":"legend.ticks major tick lines. legendry.legend.minor.ticks minor tick lines. legendry.legend.mini.ticks smallest ticks e.g. log axes. legend.ticks.length major ticks length. legendry.legend.minor.ticks.length minor ticks length. legendry.legend.mini.ticks.length smallest ticks e.g. log axes.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: line — primitive_ticks","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # Adding as secondary guides p + guides(x.sec = primitive_ticks(), y.sec = primitive_ticks())"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: title — primitive_title","title":"Guide primitive: title — primitive_title","text":"function constructs title guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: title — primitive_title","text":"","code":"primitive_title( title = waiver(), angle = waiver(), theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: title — primitive_title","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: title — primitive_title","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: title — primitive_title","text":"theme options determine styling guide, may differ depending whether guide used axis legend context.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: title — primitive_title","text":"axis.title.{x/y}.{position} title display.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: title — primitive_title","text":"legend.title title display.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: title — primitive_title","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # Adding as secondary guides p + guides( x.sec = primitive_title(\"Horizontal Title\"), y.sec = primitive_title(c(\"along vertical\", \"Multiple tiles\")) )"},{"path":"https://teunbrand.github.io/legendry/reference/scale_x_dendro.html","id":null,"dir":"Reference","previous_headings":"","what":"Dendrogram scales — scale_x_dendro","title":"Dendrogram scales — scale_x_dendro","text":"speciality scales use hierarchically clustered data. scale automatically orders limits according clustering result comes dendrogram axis.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/scale_x_dendro.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Dendrogram scales — scale_x_dendro","text":"","code":"scale_x_dendro( clust, ..., expand = waiver(), guide = \"axis_dendro\", position = \"bottom\" ) scale_y_dendro( clust, ..., expand = waiver(), guide = \"axis_dendro\", position = \"left\" )"},{"path":"https://teunbrand.github.io/legendry/reference/scale_x_dendro.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Dendrogram scales — scale_x_dendro","text":"clust data structure can coerced object .hclust(). ... Arguments passed ggplot2::discrete_scale aesthetics names aesthetics scale works . palette palette function called single integer argument (number levels scale) returns values take (e.g., scales::pal_hue()). name name scale. Used axis legend title. waiver(), default, name scale taken first mapping used aesthetic. NULL, legend title omitted. breaks One : NULL breaks waiver() default breaks (scale limits) character vector breaks function takes limits input returns breaks output. Also accepts rlang lambda function notation. labels One : NULL labels waiver() default labels computed transformation object character vector giving labels (must length breaks) expression vector (must length breaks). See ?plotmath details. function takes breaks input returns labels output. Also accepts rlang lambda function notation. na.translate Unlike continuous scales, discrete scales can easily show missing values, default. want remove missing values discrete scale, specify na.translate = FALSE. na.value na.translate = TRUE, aesthetic value missing values displayed ? apply position scales NA always placed far right. drop unused factor levels omitted scale? default, TRUE, uses levels appear data; FALSE includes levels factor. Please note display every level legend, layer use show.legend = TRUE. call call used construct scale reporting messages. super super class use constructed scale expand position scales, vector range expansion constants used add padding around data ensure placed distance away axes. Use convenience function expansion() generate values expand argument. defaults expand scale 5% side continuous variables, 0.6 units side discrete variables. guide function used create guide name. See guides() information. position position scales, position axis. left right y axes, top bottom x axes.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/scale_x_dendro.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Dendrogram scales — scale_x_dendro","text":" object can added plot.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/scale_x_dendro.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Dendrogram scales — scale_x_dendro","text":"scale limits determined order labels clust argument. limits argument scales, breaks argument can still used selectively omit breaks labels can used formatting purposes.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/scale_x_dendro.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Dendrogram scales — scale_x_dendro","text":"","code":"# Hierarchically cluster data, separately for rows and columns car_clust <- hclust(dist(scale(mtcars)), \"ave\") var_clust <- hclust(dist(scale(t(mtcars))), \"ave\") long_mtcars <- data.frame( car = rownames(mtcars)[row(mtcars)], var = colnames(mtcars)[col(mtcars)], value = as.vector(scale(mtcars)) ) # A standard heatmap adorned with dendrograms p <- ggplot(long_mtcars, aes(var, car, fill = value)) + geom_tile() + scale_x_dendro(var_clust) + scale_y_dendro(car_clust) p # Styling the dendrograms p + guides( y = guide_axis_dendro(key_dendro(type = \"triangle\")), x = guide_axis_dendro(space = rel(5)) ) + theme( axis.text.y.left = element_text(margin = margin(r = 3, l = 3)), axis.ticks.y = element_line(\"red\"), axis.ticks.x = element_line(linetype = \"dotted\") ) # In polar coordinates, plus some formatting p + coord_radial( theta = \"y\", inner.radius = 0.5, start = 0.25 * pi, end = 1.75 * pi ) + guides( theta = primitive_labels(angle = 90), theta.sec = primitive_segments(\"dendro\", vanish = TRUE), r = guide_axis_dendro(angle = 0) )"},{"path":"https://teunbrand.github.io/legendry/reference/theme_guide.html","id":null,"dir":"Reference","previous_headings":"","what":"Theme wrapper for guides — theme_guide","title":"Theme wrapper for guides — theme_guide","text":"function shorthand names theme elements relating guides. intended used guide_*(theme) argument. intent, due legends axes mutually exclusive theme elements, function sets elements simultaneously.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/theme_guide.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Theme wrapper for guides — theme_guide","text":"","code":"theme_guide( text = NULL, line = NULL, title = NULL, subtitle = NULL, text.position = NULL, title.position = NULL, subtitle.position = NULL, ticks = NULL, minor.ticks = NULL, mini.ticks = NULL, ticks.length = NULL, minor.ticks.length = NULL, mini.ticks.length = NULL, spacing = NULL, group.spacing = NULL, key = NULL, key.size = NULL, key.width = NULL, key.height = NULL, key.spacing = NULL, key.spacing.x = NULL, key.spacing.y = NULL, key.margin = NULL, frame = NULL, byrow = NULL, background = NULL, margin = NULL, bracket = NULL, bracket.size = NULL, box = NULL, fence = NULL, fence.post = NULL, fence.rail = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/theme_guide.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Theme wrapper for guides — theme_guide","text":"text setting legend.text axis.text elements. line setting legend.axis.line axis.line elements. title setting legend.title axis.title elements. subtitle setting legendry.legend.subtitle legendry.axis.subtitle elements. text.position, title.position, subtitle.position One \"top\", \"right\", \"bottom\" \"right\" setting following elements: text.position: sets legend.text.position. title.position: sets legend.title.position. subtitle.position sets legendry.legend.subtitle.position legendry.axis.subtitle.position ticks setting axis.ticks legend.ticks elements. minor.ticks setting legendry.legend.minor.ticks 6 axis.ticks.minor.{r/theta/x.top/x.bottom/y.left/y.right} elements. mini.ticks setting legendry.legend.mini.ticks legendry.axis.mini.ticks elements. ticks.length, minor.ticks.length, mini.ticks.length [][grid::unit()] setting following elements: ticks.length: sets legend.ticks.length axis.ticks.length. minor.ticks.length sets axis.minor.ticks.length legendry.legend.minor.ticks.length. mini.ticks.length sets legendry.axis.mini.ticks.length legendry.legend.mini.ticks.length. spacing, group.spacing [][grid::unit()] setting legendry.guide.spacing legendry.group.spacing theme elements. key setting legend.key element. key.size, key.width, key.height setting legend.key.size, legend.key.width legend.key.height elements respectively. key.spacing, key.spacing.x, key.spacing.y [][grid::unit()] setting legend.key.spacing, legend.key.spacing.x legend.key.spacing.y elements respectively. key.margin setting margin around legend glyphs. frame setting legend.frame element. byrow setting legend.byrow element. background setting legend.background element. margin setting legend.margin element. bracket setting legendry.bracket element. bracket.size [][grid::unit()] setting legendry.bracket.size element. box setting legendry.box element. fence, fence.post, fence.rail setting legendry.fence, legendry.fence.post legendry.fence.rail respectively.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/theme_guide.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Theme wrapper for guides — theme_guide","text":" object can provided guide.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/theme_guide.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Theme wrapper for guides — theme_guide","text":"","code":"red_ticks <- theme_guide(ticks = element_line(colour = \"red\", linewidth = 0.5)) # Both axis and colourbar gain red ticks ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + guides( colour = guide_colourbar(theme = red_ticks), x = guide_axis(theme = red_ticks) )"},{"path":"https://teunbrand.github.io/legendry/news/index.html","id":"legendry-development-version","dir":"Changelog","previous_headings":"","what":"legendry (development version)","title":"legendry (development version)","text":"New scale functions scale_x_dendro() scale_y_dendro(). New full guide function: guide_axis_dendro(). New primitive guide function: primitive_segments() New key functions: key_segment_manual(), key_segment_map() key_dendro(). New supporting theme element legendry.legend.key.margin. Fixed bug guide_axis_nested(key = key_range_auto(...)) produced duplicated labels (#31).","code":""},{"path":"https://teunbrand.github.io/legendry/news/index.html","id":"legendry-010","dir":"Changelog","previous_headings":"","what":"legendry 0.1.0","title":"legendry 0.1.0","text":"CRAN release: 2024-11-01 First release. Thanks following people catching reporting early bugs mistakes: @davidhodge931 (#7, #8, #9, #12) @luisDVA (#18) @mthomas-ketchbrook (#21)","code":""}] +[{"path":[]},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement tahvdbrand@gmail.com. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://teunbrand.github.io/legendry/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.1, available https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines inspired [Mozilla’s code conduct enforcement ladder][https://github.com/mozilla/inclusion]. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https://www.contributor-covenant.org/translations.","code":""},{"path":"https://teunbrand.github.io/legendry/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 Teun van den Brand Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"stacking","dir":"Articles","previous_headings":"","what":"Stacking","title":"A guide to guide composition","text":"cut open guide examine innards spilling , eyes first meets skeleton holds guide together. skeleton composition guide: guide whose task render compose guides. composition guide may entirely foreign ggplot2-user. vanilla ggplot2 also contains composition guide, namely guide_axis_stack(). accepts input guide specifications stacks guides top one another. legendry, composition operation: compose_stack(). regular axis guides x y aesthetics, works way guide_axis_stack(). However, guides stacks supports aesthetics, like colour, can also used .","code":"standard <- ggplot(mpg, aes(displ, hwy)) + geom_point() + labs( x = \"Engine displacement (litres)\", y = \"Highway Miles per Gallon\" ) + theme(axis.line = element_line()) standard + guides(x = guide_axis_stack(\"axis\", \"axis\", \"axis\")) staxis <- compose_stack(\"axis_base\", \"axis_base\", \"axis_base\") standard + aes(colour = cty) + guides( x = staxis, colour = guide_colbar(first_guide = staxis, second_guide = \"none\") ) + theme(legend.axis.line = element_line())"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"primitives","dir":"Articles","previous_headings":"","what":"Primitives","title":"A guide to guide composition","text":"point, might wise take closer look exactly guide_axis_base() . pull threads class , mystery starts unravel: Indeed, using compose_stack(\"axis_base\", \"axis_base\", ...) stacking stack! peel back layers see inside guide_axis_base(), find stacks? : good things must come end must guides building blocks. composition skeleton building blocks flesh providing function. building blocks called ‘primitives’ legendry. example, guide_axis_base() function stack three primitives. respectively build axis line, ticks labels. complete guide, don’t spacing , let’s exaggerate spacing clarity.","code":"class(guide_axis_base()) #> [1] \"ComposeStack\" \"Compose\" \"Guide\" \"ggproto\" \"gg\" standard + guides(x = compose_stack( primitive_line(), primitive_ticks(), primitive_labels(), theme = theme_guide(spacing = unit(5, \"pt\")) ))"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"introducing-the-rest-of-the-family","dir":"Articles","previous_headings":"Primitives","what":"Introducing the rest of the family","title":"A guide to guide composition","text":"’ve already met ‘famous’ primitives (lines, ticks, labels), let’s round acquaintances. spacer primitive can use increase spacing different pancakes stack, . also ‘ranged’ triplet: brackets, boxes fences. require niche range key power display nested axes. last member family primitive_title(). Aside just displaying text, three things: >1 title, distribute titles along range. makes convenient label lower higher ends scale. ‘absorbs’ regular axis title turning . title primitive guide actual title, makes slightly easier prevent unwanted double titles. implemented guide, take place regular axis titles. also means titles repeat facets.","code":"range_key <- key_range_manual( start = c(2, 4), end = c(5, 6), name = c(\"First\", \"Second\") ) standard + guides(x = compose_stack( \"axis_base\", primitive_bracket(range_key, \"curvy\"), primitive_spacer(unit(0.5, \"cm\")), primitive_box(range_key), primitive_spacer(unit(0.5, \"cm\")), primitive_fence(range_key, rail = \"outer\") )) standard + scale_x_continuous(guide = compose_stack( primitive_title(c( \"Sneaky little displacementses\", \"We needs it. Must have the displament\") ), primitive_title(\"Gollum explains engine displacement to you\") )) + labs(x = \"A normal person explains engine displacement\") last_plot() + facet_grid(~ year)"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"dont-use-primitives-directly","dir":"Articles","previous_headings":"Primitives","what":"Don’t use primitives directly","title":"A guide to guide composition","text":"giving primitive_-prefix, made impossible use name inside function don’t expect . acts little bit discouragement using primitives complete guides. However, can use primitives name inside guide composition functions, use full constructor function.","code":"standard + guides(x.sec = \"ticks\") #> Error in `validate_guide()`: #> ! Unknown guide: ticks standard + guides(x.sec = compose_stack(\"ticks\")) # Looks identical to the above standard + guides(x.sec = primitive_ticks())"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"sandwiching","dir":"Articles","previous_headings":"","what":"Sandwiching","title":"A guide to guide composition","text":"Aside making stack primitives, can also build sandwich primitives. Analogous two pieces bread outside good bits inside, sandwich composition guides often sees centrepiece flanked two guides. Similar naively believed guide_axis_stack() little snowflake guide, guide_colbar() fact composition: Focussing ‘bread’ part first, two guides can use flanking innards. One called ‘text’ one called ‘opposite’. called ‘text’ ‘opposite’ ‘text’-guide take position indicated legend.text.position theme element. Perhaps unsurprisingly; guide end called ‘opposite’ guide. can expose swapping theme element. also noted guide label-supression mechanism, ‘opposite’ guide drawn surpressed labels. mechanism place guides like guide_axis()/guide_axis_base() display example facet_grid(axis.labels = \"margins\"). thing guide_colbar() , compose_sandwich() , adjust theme settings match ggplot2::guide_colourbar() closely. Alright, fine, get ‘bread’ part sandwich! inside? ’m glad asked.","code":"class(guide_colbar()) #> [1] \"ComposeSandwich\" \"Compose\" \"Guide\" \"ggproto\" #> [5] \"gg\" standard + aes(colour = cty) + scale_colour_viridis_c( guide = compose_sandwich( text = primitive_labels(), opposite = primitive_ticks() ) ) last_plot() + theme(legend.text.position = \"left\") standard + aes(colour = cty) + scale_colour_viridis_c( guide = compose_sandwich( text = \"axis_base\", opposite = \"axis_base\" ) ) # The same plot standard + aes(colour = cty) + scale_colour_viridis_c( guide = guide_colbar(vanilla = FALSE) )"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"gizmos","dir":"Articles","previous_headings":"","what":"Gizmos","title":"A guide to guide composition","text":"insides guide_colbar() called ‘gizmo’. gizmo differs primitive gizmo general building block, rather specialised display particular aesthetic. Also, complete guide allow complete crucial task translating graphic display interpretation data. called ‘gizmo’ sort gadget don’t appropriate name . Hence: gizmo.","code":""},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"my-first-gizmo","dir":"Articles","previous_headings":"Gizmos","what":"My first gizmo","title":"A guide to guide composition","text":"can display gizmo guide_colbar() —sandwich spread, — gizmo_barcap(). also immediately clear need bread case. Similarly guide_colsteps() gizmo_stepcap(), might second gizmo may already encountered.","code":"standard + aes(colour = cty) + scale_colour_viridis_c( guide = gizmo_barcap() )"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"exotic-gizmos","dir":"Articles","previous_headings":"Gizmos","what":"Exotic gizmos","title":"A guide to guide composition","text":"also gizmos may less familiar. reasonably simple one gizmo_grob(), just allows place grob guide. example, can stack axis, use non-bread part sandwich. Please note good representation plot’s colour aesthetic. hope wouldn’t necessary : don’t make plot like ! Perhaps gizmo’s inherently useful gizmo_density() gizmo_histogram(). default, wrap density() hist() functions called layer’s data. can pass arguments functions density.args hist.args respectively. ’ll repeat : gizmos, full guides. Also: please ignore ’re guiding colour fill colour visible. However, can easily promote gizmos full guide adding axis. compose_sandwich() can reasonable job .","code":"my_grob <- grid::grobTree( grid::rectGrob(), grid::textGrob(\"Grob\\nGizmo\") ) my_gizmo <- gizmo_grob(my_grob, width = unit(2, \"cm\"), height = unit(2, \"cm\")) standard + aes(colour = cty) + guides( x = compose_stack(\"axis\", my_gizmo), colour = compose_sandwich(middle = my_gizmo, text = \"axis_base\") ) standard + aes(colour = cty, fill = cty) + scale_colour_viridis_c( option = \"C\", guide = gizmo_density(density.args = list(adjust = 0.7)) ) + scale_fill_viridis_c( option = \"D\", guide = gizmo_histogram(hist.args = list(breaks = 10)) ) standard + aes(colour = cty, fill = cty) + scale_colour_viridis_c( option = \"C\", guide = compose_sandwich( middle = gizmo_density(just = 1), text = \"axis_base\" ) ) + scale_fill_viridis_c( option = \"D\", guide = compose_sandwich( middle = gizmo_histogram(just = 0.5), text = \"axis_base\" ) )"},{"path":"https://teunbrand.github.io/legendry/articles/guide_composition.html","id":"other-compositions","dir":"Articles","previous_headings":"","what":"Other compositions","title":"A guide to guide composition","text":"following compositions situational aren’t part ‘proper’ guide. compose_ontop() guide lets render one guide . can see plots allows us touch panel composing top one another, stacking. also compose_crux() (‘cross’) parent composition compose_sandwich(). Instead allowing bread two sides, can also put guides top bottom. isn’t currently use complete guide though.","code":"top <- guide_axis_base( key = key_manual(32, label = \"Here is 32\"), theme = theme_guide( ticks.length = unit(1.5, \"cm\"), ticks = element_line(arrow = arrow()), line = element_blank() ) ) standard + guides(y.sec = compose_ontop(\"axis\", top)) + labs(title = \"compose_ontop\") standard + guides(y.sec = compose_stack(\"axis\", top)) + labs(title = \"compose_stack\") ball <- gizmo_grob(grid::circleGrob( r = unit(0.5, \"cm\"), gp = grid::gpar(fill = \"tomato\") )) block <- gizmo_grob(grid::rectGrob( width = unit(1, \"cm\"), height = unit(1, \"cm\"), gp = grid::gpar(fill = \"dodgerblue\") )) standard + aes(colour = cty) + scale_colour_viridis_c( guide = compose_crux( centre = gizmo_barcap(), left = \"axis_base\", right = \"axis_base\", top = ball, bottom = block ) )"},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"keys-in-vanilla-ggplot2","dir":"Articles","previous_headings":"","what":"Keys in vanilla ggplot2","title":"Key information","text":"way guides exchange information scales called ‘keys’. Keys simply data frames typically hold information aesthetic, values represent displayed. may already seen keys ’ve used get_guide_data() function , can used retrieved guide’s key. data frame , can see key ‘x’ aesthetic. tells us relative location tick marks aesthetic’s x column, numerical values represent .value column. values communicated users captured .label column. Sometimes, keys information additional aesthetics, like y column key .","code":"standard <- ggplot(mpg, aes(displ, hwy)) + geom_point(aes(shape = drv, colour = drv)) + labs( shape = \"Drive train\", colour = \"Drive train\", y = \"Highway efficiency\", x = \"Engine Displacement\" ) get_guide_data(standard, aesthetic = \"x\") #> x .value .label y #> 1 0.1127946 2 2 0 #> 2 0.2811448 3 3 0 #> 3 0.4494949 4 4 0 #> 4 0.6178451 5 5 0 #> 5 0.7861953 6 6 0 #> 6 0.9545455 7 7 0"},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"keys-in-legendry","dir":"Articles","previous_headings":"","what":"Keys in legendry","title":"Key information","text":"key difference keys legendry keys ggplot2, legendry exposes users keys. first, can inconvenience, allows greater degree customisation.","code":""},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"why-use-keys","dir":"Articles","previous_headings":"Keys in legendry","what":"Why use keys?","title":"Key information","text":"dig different types keys, worth noting exactly keys exposed. Keys represent ‘rules’ annotate scale, whereas guide display rule. example, key_log() instructs annotate every 10x change large ticks, changes smaller ticks. doesn’t really matter whether rule applied axis colour bar. rule independent display makes modular.","code":"logkey <- key_log() ggplot(msleep, aes(sleep_total, brainwt, colour = bodywt)) + geom_point(na.rm = TRUE) + scale_y_log10(guide = guide_axis_base(key = logkey)) + scale_colour_viridis_c( trans = \"log10\", guide = guide_colbar(key = logkey) )"},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"regular-keys","dir":"Articles","previous_headings":"Keys in legendry","what":"Regular keys","title":"Key information","text":"understand better typical key works, can use key_manual() manually create key. Usually sufficient just provide aesthetic argument, .value .label columns automatically derive . want custom labels, can set label argument. guides legendry accept key argument, cause guide display information key, rather information automatically derived scale. addition, can provide automatic keys keywords. Setting key = \"minor\", setting key = key_minor(). fashion many key_*() functions can used keyword omitting key_-prefix. keys don’t directly return data frames, return instructions keys interact scales. example key_auto(), default key many guides legendry, needs know range populate tickmarks. can preview values ’d label letting key absorb scale known limits.","code":"key_manual(aesthetic = c(2, 4, 6)) #> aesthetic .value .label #> 1 2 2 2 #> 2 4 4 4 #> 3 6 6 6 my_key <- key_manual(aesthetic = c(2, 4, 6), label = c(\"two\", \"four\", \"six\")) standard + guides(x = guide_axis_base(key = my_key)) standard + guides(x = guide_axis_base(key = \"minor\")) key <- key_auto() print(key) #> function (scale, aesthetic = NULL) #> { #> aesthetic <- aesthetic %||% scale$aesthetics[1] #> df <- Guide$extract_key(scale, aesthetic) #> df <- data_frame0(df, !!!extra_args(...)) #> class(df) <- c(\"key_standard\", \"key_guide\", class(df)) #> df #> } #> #> template <- scale_y_log10(limits = c(1, 1000)) key(template, \"y\") #> y .value .label #> 1 0 0 1 #> 2 1 1 10 #> 3 2 2 100 #> 4 3 3 1000"},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"ranged-keys","dir":"Articles","previous_headings":"Keys in legendry","what":"Ranged keys","title":"Key information","text":"special type guide may find legendry called ‘ranged’ guides. difference regular guides mark single point aesthetic, rather use start- end-point mark range aesthetic. can convenient annotate co-occurrances data plotting events. example, can annotate airtimes TV shows timeseries data. Compared regular key, don’t aesthetic column, replaced start end columns. cases, indicate single .value, can still use .label column. .level column indicates far offset range, ’ll display “Frasier” farther away “Golden Girls”. also ‘automatic’ ranged key, attempts find patterns key labels. example obvious pattern x-axis labels plot first 3 entries 3 drive trains 1999, followed 3 drive trains 2008. default, key_range_auto() tries split label non-alphanumeric character, give explicit split instructions using sep argument.","code":"ranges <- key_range_manual( start = as.Date(c(\"1985-09-14\", \"1993-09-16\")), end = as.Date(c(\"1992-05-09\", \"2004-05-13\")), name = c(\"Golden Girls\", \"Frasier\"), level = 1:2 ) ranges #> start end .label .level #> 1 1985-09-14 1992-05-09 Golden Girls 1 #> 2 1993-09-16 2004-05-13 Frasier 2 ggplot(economics, aes(date, unemploy)) + geom_line() + guides(x.sec = primitive_bracket(ranges)) plot <- ggplot(mpg, aes(interaction(drv, year), displ, fill = drv)) + geom_boxplot() + labs( x = \"Drive train by year\", y = \"Engine displacement\", fill = \"Drive train\" ) plot # Split on literal periods key <- key_range_auto(sep = \"\\\\.\") plot + guides(x = primitive_bracket(key = key))"},{"path":[]},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"piping-keys","dir":"Articles","previous_headings":"Futher gimmicks","what":"Piping keys","title":"Key information","text":"key_manual() key_range_manual() functions equivalents easy pipe. called key_map() key_range_map() respectively, can replace following: following, pipe-friendly version: keys display something like :","code":"key <- key_range_manual( start = presidential$start, end = presidential$end, name = presidential$name ) key <- presidential |> key_range_map( start = start, end = end, name = name ) ggplot(economics, aes(date, unemploy)) + geom_line() + guides(x.sec = primitive_bracket(key))"},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"formatting-keys","dir":"Articles","previous_headings":"Futher gimmicks","what":"Formatting keys","title":"Key information","text":"addition lot control keys display, also control common text formatting operations keys. key options ... argument allows many arguments element_text() passed labels. cases know label advance, almost every time one uses key_manual(), key_map() ranged equivalents, can even vectorise formatting options.","code":"ggplot(mpg, aes(displ, hwy)) + geom_point() + guides(x = guide_axis_base(key = key_auto(colour = \"red\", face = \"bold\"))) guide <- presidential |> key_range_map( start = start, end = end, name = name, colour = ifelse(party == \"Republican\", \"tomato\", \"dodgerblue\"), face = \"bold\" ) |> primitive_bracket() ggplot(economics, aes(date, unemploy)) + geom_line() + guides(x.sec = guide)"},{"path":"https://teunbrand.github.io/legendry/articles/keys.html","id":"forbidden-keys","dir":"Articles","previous_headings":"Futher gimmicks","what":"Forbidden keys","title":"Key information","text":", time writing, two keys probably shouldn’t use code. key_sequence() key_bins(). hope mentioning use prevent experimenting subsequent frustration keys. can see key_sequence() produce informative axis. reason key designed colour gradients Likewise, key_bins() designed regular guides, specific colour steps.","code":"my_sequence_key <- key_sequence(n = 20) standard + guides(x = guide_axis_base(key = my_sequence_key)) ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + scale_colour_viridis_c( guide = gizmo_barcap(key = my_sequence_key) ) my_bins_key <- key_bins() ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + scale_colour_viridis_c( guide = gizmo_stepcap(key = my_bins_key) )"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"axes","dir":"Articles","previous_headings":"","what":"Axes","title":"A guided tour","text":"Axes truly bread butter guides. Naturally, axes shine brightest guides positions like x y can moonlight auxiliary guides well.","code":""},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"where-not-to-apply","dir":"Articles","previous_headings":"Axes","what":"Where (not) to apply","title":"A guided tour","text":"legendry, staple axis guide_axis_base(). first glance, axes utterly unremarkable much mirror ggplot2::guide_axis() design. terms novelty, ‘extra’ option axes offer display bidirectional tick marks. However, guide_axis_base() flexible ggplot2::guide_axis(). ggplot2, ’d typically switch ggplot2::guide_axis_theta() display axis theta coordinate polar plot. custom axis knows fit polar coordinates, fuss needed switching polar coordinates. Argueably, custom guide little bit flexible. exactly scruples displaying arbitrary continuous aesthetics, like colour plot . can see, informative colour guide reason ’d advice . unadvised yet possible topic resurfaces later article. summary, guide_axis_base() flexible guide can used position aesthetic, can () used continuous aesthetics.","code":"# Turn on axis lines theme_update(axis.line = element_line()) # A standard plot standard <- ggplot(mpg, aes(displ, hwy)) + geom_point() + labs( x = \"Engine Displacement (Litres)\", y = \"Highway Miles per Gallon\" ) standard + guides( x = \"axis_base\", y = \"axis_base\" ) p <- standard + scale_x_continuous(guide = guide_axis_base(bidi = TRUE)) + scale_y_continuous(guide = guide_axis_base(bidi = TRUE)) p p + coord_radial(start = 1.25 * pi, end = 2.75 * pi) standard + aes(colour = cty) + guides(colour = \"axis_base\")"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"nested-axes","dir":"Articles","previous_headings":"Axes","what":"Nested axes","title":"A guided tour","text":"Currently, exactly 1 ‘novelty’ axis guide_axis_nested(). Let’s suppose ‘nested’ data, purposes just means discrete variables kind categories interactions can laid nested fashion. category categories, . example three super-categories ‘Drink’, ‘Fruit’ ‘Vehicle’ granular categories like ‘Coffee’ ‘Pear’ belong super-categories. can use interaction() function paste together name inner category name outer category. Instead just relying formatting labels correctly splitting, can also manually annotate outer categories. , can use key_range_manual() function constructs brackets see fit.","code":"df <- data.frame( item = c(\"Coffee\", \"Tea\", \"Apple\", \"Pear\", \"Car\"), type = c(\"Drink\", \"Drink\", \"Fruit\", \"Fruit\", \"Vehicle\"), amount = c(5, 1, 2, 3, 1) ) plain <- ggplot(df, aes(interaction(item, type), amount)) + geom_col() plain + guides(x = \"axis_nested\") my_key <- key_range_manual( start = c(\"Coffee\", \"Apple\"), end = c(\"Tea\", \"Pear\"), name = c(\"Drinks\", \"Fruits\"), level = 1 ) ggplot(df, aes(item, amount)) + geom_col() + scale_x_discrete( limits = df$item, guide = guide_axis_nested( regular_key = \"auto\", key = my_key ) )"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"brackets","dir":"Articles","previous_headings":"Axes > Nested axes","what":"Brackets","title":"A guided tour","text":"change style range indicators, can choose different bracket setting. theme elements legendry.bracket legendry.bracket.size control styling size line. settings shortcut theme_guide(). brackets can provided string naming bracket function, like \"curvy\" invokes bracket_curvy(). follows overview build-bracket shapes. Quite possibly, might bracket shapes want use, aren’t built legendry. Luckily, can build custom brackets, using numeric matrix : 2 columns corresponding x y coordinates. least 2 rows. values 0 1. x-coordinate stretched along axis, whereas y squished fit legendry.bracket.size theme setting. custom bracket can just provided bracket argument.","code":"plain + guides(x = guide_axis_nested(bracket = \"curvy\")) + theme_guide( bracket = element_line(colour = \"blue\"), bracket.size = unit(3, \"mm\") ) brackets <- list( \"atan\" = bracket_atan(), \"chevron\" = bracket_chevron(), \"curvy\" = bracket_curvy(), \"line\" = bracket_line(), \"round\" = bracket_round(), \"sigmoid\" = bracket_sigmoid(), \"square\" = bracket_square() ) brackets <- cbind( as.data.frame(do.call(rbind, brackets)), shape = factor(rep(names(brackets), lengths(brackets) / 2), names(brackets)) ) ggplot(brackets, aes(x, y)) + geom_path() + facet_wrap(~ shape) + coord_equal() zigzag <- cbind( x = seq(0, 1, length.out = 20), y = rep(c(0, 1), length.out = 20) ) plain + guides(x = guide_axis_nested(bracket = zigzag))"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"boxes","dir":"Articles","previous_headings":"Axes > Nested axes","what":"Boxes","title":"A guided tour","text":"Alternatively, also possible forego brackets altogether use boxes instead.","code":"plain + guides(x = guide_axis_nested(type = \"box\"))"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"customising","dir":"Articles","previous_headings":"Axes > Nested axes","what":"Customising","title":"A guided tour","text":"needn’t strictly use guide_axis_nested() discrete data: can use continuous data well. However, ’d need provide manual ranged key, one created key_range_manual()/key_range_map(). customise different depths bracketed text, can give list text elements levels_text argument. Alternatively, can tailor many usual text formatting options encoding key.","code":"presidents <- key_range_map(presidential, start = start, end = end, name = name) eco <- ggplot(economics, aes(date, unemploy)) + geom_line() + labs(y = \"Unemployment\") eco + guides(x = guide_axis_nested(key = presidents)) presidents$.level <- rep(1:3, length.out = nrow(presidents)) eco + guides(x = guide_axis_nested( key = presidents, levels_text = list( element_text(face = \"bold\"), NULL, element_text(face = \"italic\") ) )) presidents <- key_range_map( presidential, start = start, end = end, name = name, level = rep(1:4, length.out = nrow(presidential)), colour = ifelse(party == \"Republican\", \"tomato\", \"dodgerblue\") ) eco + guides(x = guide_axis_nested(key = presidents))"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"dendrograms","dir":"Articles","previous_headings":"Axes","what":"Dendrograms","title":"A guided tour","text":"Dendrograms popular method displaying results hierarchical clustering. standard way computing hierarchical clusters compute distance metric data dist() forwarding result hclust(). default plot method shows dendrogram. packages many options display dendrograms, notably ggdendro dendextend. legendry package ambition best dendrogram visualiser, find dendrograms use useful annotation. use dendrograms, can provide object produced hclust scale_(x/y)_dendro(). ensures scale follows order clustering result default uses guide_axis_dendro() display dendrogram next labels. guide_axis_dendro() function can decomposed labels segments. can use primitive_segments(\"dendro\") display labels, may convenient rather place labels opposite end panel. plot use raw segments draw radial dendrogram. vanish = TRUE option indicates fit dendrogram root tree middle, ever relevant secondary theta axes.","code":"clust <- hclust(dist(scale(mtcars)), method = \"ave\") plot(clust) ggplot(mtcars, aes(mpg, rownames(mtcars))) + geom_col() + scale_y_dendro(clust) ggplot(mtcars, aes(mpg, rownames(mtcars))) + geom_col() + scale_y_dendro(clust) + coord_radial(theta = \"y\", inner.radius = 0.5) + guides( theta = guide_axis_base(angle = 90), theta.sec = primitive_segments(\"dendro\", vanish = TRUE), r = \"none\" ) + theme( axis.title = element_blank(), plot.margin = margin(t = 50, b = 50) )"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"colours","dir":"Articles","previous_headings":"","what":"Colours","title":"A guided tour","text":"colour fill aesthetics wonderful build guides , can apply pretty much anything. First, ’ll take gander variants colour bars gander rings.","code":""},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"bars-and-steps","dir":"Articles","previous_headings":"Colours","what":"Bars and steps","title":"A guided tour","text":"Two variants colour guides exist {legendry}: guide_colbar() reflects guide_colourbar() guide_colsteps() reflects guide_coloursteps(). used standard fashion, look similar vanilla counterparts. Please note following paragraphs apply equally guide_colsteps(), ’ll take guide_colbar() examples.","code":"standard <- standard + aes(colour = cty) + labs(colour = \"City Miles\\nper Gallon\") standard + scale_colour_viridis_c(guide = \"colbar\") + labs(title = \"Custom colour bar\") standard + scale_colour_viridis_b(guide = \"colsteps\") + labs(title = \"Custom colour steps\")"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"caps","dir":"Articles","previous_headings":"Colours > Bars and steps","what":"Caps","title":"A guided tour","text":"thing sets guides apart indicators data goes --bounds. common case --bounds data, set scale limits narrower data range. plot , cty variable observation lower limit 10, upper limit 30. Typically, displayed na.value = \"grey\" colour. bars display data --bounds gray ‘caps’ two ends bar. can change --bounds strategy, oob argument scale, caps reflect colour --bounds data acquired. can also force caps appear, even --bounds data, force cap colour consistent scale. shape cap needn’t triangle. can set shape built-cap shapes. caps can provided string naming cap function, like \"arch\" invokes cap_arch(). follows overview build-cap shapes. certainly possible use shapes imagination well. provide shape, use numeric matrix : 2 columns corresponding x y coordinates. least 2 rows. positive values 2nd column (y). Start (0, 0) coordinate. End (1, 0) coordinate. can see shapes requirements hold built-shapes. matrix can given shape argument guide.","code":"standard + scale_colour_viridis_c( limits = c(10, 30), guide = \"colbar\" ) standard + scale_colour_viridis_c( limits = c(10, 30), oob = oob_squish, guide = \"colbar\" ) standard + scale_colour_viridis_c( guide = guide_colbar( show = c(FALSE, TRUE), oob = \"squish\" ) ) standard + scale_colour_viridis_c( guide = guide_colbar( show = TRUE, oob = \"squish\", shape = \"arch\" ) ) caps <- list( none = cap_none(), triangle = cap_triangle(), round = cap_round(), arch = cap_arch(), ogee = cap_ogee() ) caps <- cbind( as.data.frame(do.call(rbind, caps)), shape = factor(rep(names(caps), lengths(caps) / 2), names(caps)) ) ggplot(caps, aes(x, y)) + geom_path(arrow = arrow()) + facet_wrap(~ shape) + coord_equal() hourglass_cap <- cbind( x = c(0, 1, 0, 1), y = c(0, 1, 1, 0) ) standard + scale_colour_viridis_c( guide = guide_colbar( show = TRUE, oob = \"squish\", shape = hourglass_cap ) )"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"side-guides","dir":"Articles","previous_headings":"Colours > Bars and steps","what":"Side-guides","title":"A guided tour","text":"colour bars come small party trick: two rows tick marks separate axes masquerading parts colour bar. becomes easier see wash away make-vanilla = FALSE. trick allows tailor colour bar liking separate sides. can use invoke tricks described axis section, like setting minor ticks, swap axes annotation-primitive like primitive_bracket().","code":"standard + scale_colour_viridis_c( guide = guide_colbar(vanilla = FALSE) ) brackets <- key_range_manual( start = c(9, 25), end = c(19, 30), name = c(\"A\", \"B\") ) |> primitive_bracket(bracket = \"square\") standard + scale_colour_viridis_c( minor_breaks = breaks_width(1), guide = guide_colbar( first_guide = guide_axis_base(\"minor\"), second_guide = brackets ) )"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"rings","dir":"Articles","previous_headings":"Colours","what":"Rings","title":"A guided tour","text":"Aside bars steps, also option show colour ring. understand might convenient, can help understand type data suitable . prime example cyclical data can month year. time December January just one month, encoded numerically, difference 11 months. problem can show sometimes periodic data, like housing sales . Every year get sharp colour transition winter. remedy problem use cyclical palette. {scico} package offers suitable cyclical palettes, like ‘romaO’, ‘vikO’, ‘bamO’, ‘corkO’ ‘brocO’. already much better, guide poor job displaying cyclical nature months. better reflected guide, can use guide_colring(). ‘thickness’ donut can controlled legend.key.width parameter, default 1/5th diameter. outer diameter ring controlled legend.key.size parameter, multiplied 5 consistency colour bar multiplier. Like custom colour bars, possible set custom guides, hoarded inner_guide outer_guide distinguish aren’t first second.","code":"housing <- ggplot( subset(txhousing, city == \"Houston\"), aes(date, volume, colour = month) ) + geom_line() + scale_y_continuous( name = \"Total volume of sales\", labels = dollar_format(scale = 1e-6, suffix = \"M\") ) + labs( x = \"Date\", colour = \"Month\" ) housing + scale_colour_viridis_c(limits = c(0, 12)) # Colours from scico::scico(12, palette = \"romaO\") periodic_pal <- c(\"#723957\", \"#843D3A\", \"#97552B\", \"#B08033\", \"#CBB45D\", \"#D5DA99\", \"#B8DEC3\", \"#85C7CF\", \"#599FC4\", \"#4E73AB\", \"#5F4C81\", \"#723959\") housing + scale_colour_gradientn(colours = periodic_pal, limits = c(0, 12)) housing + scale_colour_gradientn( colours = periodic_pal, limits = c(1, 13), breaks = 1:12, guide = \"colring\" ) housing + scale_colour_gradientn( colours = periodic_pal, limits = c(1, 13), breaks = 1:12, minor_breaks = breaks_width(0.25), guide = guide_colring( outer_guide = guide_axis_base(\"minor\"), inner_guide = \"none\" ) ) + theme( legend.key.width = rel(2.5), # fill to center legend.key.size = unit(0.5, \"cm\") # actual size is 0.5 * 5 = 2.5 cm )"},{"path":"https://teunbrand.github.io/legendry/articles/tour.html","id":"legends","dir":"Articles","previous_headings":"","what":"Legends","title":"A guided tour","text":"addition full guides , legendry also three variants guide_legend() legend. first guide_legend_base(), similar ggplot2::guide_legend(), offers design argument lets put keys arbitrary cells rectangular layout. Secondly, guide_legend_cross() let ‘cross’ two variables, ; generate legend key every combination two variable levels. legends merged share title, wise construct common legend setting key strategy title. Alternatively, can also use guide compound variable already combines two variables. Note missing combinations correctly omitted case. Lastly, also legend suitable displaying groups. guide_legend_group() legend adds additional titles separate groups. default, splits labels first non-alphanumeric character, can also use key_group_lut() indicate groups.","code":"design <- matrix(NA, 3, 3) diag(design) <- 1:3 standard + aes(colour = drv) + guides(colour = guide_legend_base(design = design)) common <- guide_legend_cross(key = \"auto\", title = \"Cross legend\") standard + aes(colour = drv, shape = factor(cyl)) + guides(colour = common, shape = common) standard + aes(colour = paste(cyl, drv)) + guides(colour = \"legend_cross\") set.seed(42) i <- sample(nrow(msleep), 6) ggplot(msleep[i, ], aes(sleep_total, bodywt)) + geom_point(aes(colour = paste0(vore, \"vore.\", name))) + guides(colour = \"legend_group\")"},{"path":"https://teunbrand.github.io/legendry/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Teun van den Brand. Author, maintainer, copyright holder.","code":""},{"path":"https://teunbrand.github.io/legendry/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"van den Brand T (2024). legendry: Extended Legends Axes 'ggplot2'. R package version 0.1.0.9000, https://github.com/teunbrand/legendry, https://teunbrand.github.io/legendry/.","code":"@Manual{, title = {legendry: Extended Legends and Axes for 'ggplot2'}, author = {Teun {van den Brand}}, year = {2024}, note = {R package version 0.1.0.9000, https://github.com/teunbrand/legendry}, url = {https://teunbrand.github.io/legendry/}, }"},{"path":"https://teunbrand.github.io/legendry/index.html","id":"legendry-","dir":"","previous_headings":"","what":"Extended Legends and Axes for ggplot2","title":"Extended Legends and Axes for ggplot2","text":"goal legendry provide additional guide functionality ggplot2 ecosystem.","code":""},{"path":"https://teunbrand.github.io/legendry/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Extended Legends and Axes for ggplot2","text":"can install development version legendry GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"teunbrand/legendry\")"},{"path":"https://teunbrand.github.io/legendry/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Extended Legends and Axes for ggplot2","text":"Let’s first set basic plot experiment : legendry package offers selection calls ‘complete guides’. complete guides can just drop-replacement regular guides, can specify using ggplot2’s guides() function using guide argument scales. example , ’re using two custom variants vanilla guides, namely guide_axis_base() guide_colbar(). custom variants additional options allow greater degree customisation: axis guide option bidirectional ticks. colourbar automatically recognises --bounds values displays cap. Besides complete guides, legendry also incomplete guides can composed. ggplot2::guide_axis_stack() axis composition function can used display multiple guides. , use ‘primitive’ guide (incomplete building block) display range axis. stacking regular axis primitive guide completed. legendry package extends guide composition concept beyond axes types guides. example compose ‘sandwich’: central guide flanked two others. bracket primitive, matter aesthetic displays can re-use sandwich. ’ve yet write vignette composition.","code":"library(legendry) #> Loading required package: ggplot2 base <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + labs( x = \"Engine displacement\", y = \"Highway miles per gallon\", col = \"City miles\\nper gallon\" ) + theme(axis.line = element_line()) base + scale_colour_viridis_c( limits = c(NA, 30), guide = \"colbar\" ) + guides( x = guide_axis_base(bidi = TRUE) ) # A partial guide to display a bracket efficient_bracket <- primitive_bracket( # Keys determine what is displayed key = key_range_manual(start = 25, end = Inf, name = \"Efficient\"), bracket = \"square\", # We want vertical text theme = theme( legend.text = element_text(angle = 90, hjust = 0.5), axis.text.y.left = element_text(angle = 90, hjust = 0.5) ) ) base + guides(y = guide_axis_stack(\"axis\", efficient_bracket)) base + scale_colour_viridis_c( guide = compose_sandwich( middle = gizmo_density(), text = \"axis_base\", opposite = efficient_bracket ) )"},{"path":"https://teunbrand.github.io/legendry/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Extended Legends and Axes for ggplot2","text":"Please note legendry project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Bracket options — bracket_options","title":"Bracket options — bracket_options","text":"functions construct various sorts brackets. construct matrix can supplied bracket argument primitive_bracket().","code":""},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bracket options — bracket_options","text":"","code":"bracket_line() bracket_square() bracket_chevron() bracket_round(angle = 180, n = 100) bracket_sigmoid(curvature = 10, n = 100) bracket_atan(curvature = 5, n = 100) bracket_curvy(angle = 225, n = 100)"},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bracket options — bracket_options","text":"angle numeric(1): angle degrees circle piece drawn. bracket_curvy(), angle 180 270. n integer(1) number points use bracket. curvature numeric(1) controls curliness bracket. precisely, used construct sequence seq(-curvature, curvature, length.= n) logistic arctangent functions evaluated.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bracket options — bracket_options","text":" coordinates points brackets.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Bracket options — bracket_options","text":"designing custom bracket shapes, expectation columns number 0 1. first column follows direction guide whereas second column orthogonal direction.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":"functions","dir":"Reference","previous_headings":"","what":"Functions","title":"Bracket options — bracket_options","text":"bracket_line(): simple line bracket. n = 2 points. bracket_square(): square bracket. n = 4 points. bracket_chevron(): chevron (V-shape) makes bracket. n = 3 points. bracket_round(): One circular arc makes bracket. bracket_sigmoid(): Two sigmoid curves stacked top one another form bracket. bracket_atan(): Two arctangent curves stacked top one another form bracket. bracket_curvy(): Four circular arcs make bracket.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/bracket_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bracket options — bracket_options","text":"","code":"plot(bracket_sigmoid(), type = 'l')"},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Cap options — cap_options","title":"Cap options — cap_options","text":"functions construct various sorts caps. construct matrix can supplied shape argument gizmo_barcap().","code":""},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cap options — cap_options","text":"","code":"cap_triangle() cap_round(n = 100) cap_arch(n = 100) cap_ogee(n = 100) cap_none()"},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cap options — cap_options","text":"n number points use cap.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cap options — cap_options","text":" coordinates points brackets.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Cap options — cap_options","text":"designing custom cap shapes, expectation first point starts (0, 0) coordinate last point ends (0, 1) coordinate. first column follows orthogonal direction bar whereas second column follows direction bar.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":"functions","dir":"Reference","previous_headings":"","what":"Functions","title":"Cap options — cap_options","text":"cap_triangle(): equilateral triangle n = 3 points. cap_round(): semicircle. cap_arch(): Two circular arcs forming equilateral Gothic arch. cap_ogee(): Four circular arcs forming 'ogee' arch. cap_none(): cap.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/cap_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cap options — cap_options","text":"","code":"plot(cap_arch(), type = 'l')"},{"path":"https://teunbrand.github.io/legendry/reference/common_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"common parameters in legendry — common_parameters","title":"common parameters in legendry — common_parameters","text":"collection common parameters needn't re-documented time.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/common_parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"common parameters in legendry — common_parameters","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. available_aes vector listing aesthetics guide can build. direction indicating direction guide. Can \"horizontal\" \"vertical\". angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. override.aes named specifying aesthetic parameters key glyphs. See details examples guide_legend().","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_crux.html","id":null,"dir":"Reference","previous_headings":"","what":"Compose guides in a cross — compose_crux","title":"Compose guides in a cross — compose_crux","text":"guide composition central guide optionally surrounded guides four sides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_crux.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compose guides in a cross — compose_crux","text":"","code":"compose_crux( key = NULL, centre = \"none\", left = \"none\", right = \"none\", top = \"none\", bottom = \"none\", args = list(), complete = FALSE, theme = NULL, theme_defaults = list(), reverse = FALSE, order = 0, title = waiver(), position = waiver(), available_aes = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/compose_crux.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compose guides in a cross — compose_crux","text":"key standard key specification. key shared among guides NULL keys . See information linked topic. centre, left, right, top, bottom Guides use composition per position. guide can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. args arguments pass guides given either function string. complete whether treat composition complete guide. TRUE, title margin added result. FALSE (default), titles margins added. theme object style guide individually differently plot's theme settings. theme arguments guide overrides, combined , plot's theme. theme_defaults theme elements override undeclared theme arguments. reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. position guide drawn: one \"top\", \"bottom\", \"left\", \"right\". available_aes vector listing aesthetics guide can build.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_crux.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compose guides in a cross — compose_crux","text":" guide object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/compose_crux.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compose guides in a cross — compose_crux","text":"","code":"# Roughly recreating a colour bar with extra text on top and bottom crux <- compose_crux( centre = gizmo_barcap(), left = \"axis_base\", right = \"axis_base\", top = primitive_title(\"A lot\"), bottom = primitive_title(\"A little\") ) ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) + guides(colour = crux)"},{"path":"https://teunbrand.github.io/legendry/reference/compose_ontop.html","id":null,"dir":"Reference","previous_headings":"","what":"Compose guides on top of one another — compose_ontop","title":"Compose guides on top of one another — compose_ontop","text":"guide can place place guides top one another.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_ontop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compose guides on top of one another — compose_ontop","text":"","code":"compose_ontop( ..., args = list(), key = NULL, title = waiver(), angle = waiver(), theme = NULL, order = 0, position = waiver(), available_aes = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/compose_ontop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compose guides on top of one another — compose_ontop","text":"... Guides stack composition. guide can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. args arguments pass guides given either function string. key standard key specification. key shared among guides NULL keys . See information linked topic. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". available_aes giving aesthetics must match guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_ontop.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compose guides on top of one another — compose_ontop","text":" composite guide object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/compose_ontop.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compose guides on top of one another — compose_ontop","text":"","code":"# Using the ontop composition to get two types of ticks with different # lengths ggplot(mpg, aes(displ, hwy)) + geom_point() + guides(x = compose_ontop( guide_axis_base( key_manual(c(2, 4, 6)), theme = theme( axis.ticks = element_line(colour = \"limegreen\"), axis.ticks.length = unit(11, \"pt\") ) ), guide_axis_base( key_manual(c(3, 5, 7)), theme = theme( axis.ticks = element_line(colour = \"tomato\"), axis.ticks.length = unit(5.5, \"pt\") ) ) ))"},{"path":"https://teunbrand.github.io/legendry/reference/compose_sandwich.html","id":null,"dir":"Reference","previous_headings":"","what":"Compose guides as a sandwich — compose_sandwich","title":"Compose guides as a sandwich — compose_sandwich","text":"guide composition middle guide flanked two parallel guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_sandwich.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compose guides as a sandwich — compose_sandwich","text":"","code":"compose_sandwich( key = key_auto(), middle = gizmo_barcap(), text = \"none\", opposite = \"none\", args = list(), complete = TRUE, theme = NULL, theme_defaults = list(), reverse = FALSE, order = 0, title = waiver(), position = waiver(), available_aes = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/compose_sandwich.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compose guides as a sandwich — compose_sandwich","text":"key standard key specification. key shared among guides NULL keys . See information linked topic. middle Guide use middle guide. guide can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. text, opposite Guides use legend.text.position location opposite side middle guide respectively. Guide specification middle argument. args arguments pass guides given either function string. complete whether treat composition complete guide. TRUE, title margin added result. FALSE (default), titles margins added. theme object style guide individually differently plot's theme settings. theme arguments guide overrides, combined , plot's theme. theme_defaults theme elements override undeclared theme arguments. reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. position guide drawn: one \"top\", \"bottom\", \"left\", \"right\". available_aes vector listing aesthetics guide can build.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_sandwich.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compose guides as a sandwich — compose_sandwich","text":" guide object.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_sandwich.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compose guides as a sandwich — compose_sandwich","text":"sandwich composition effectively crux composition lacking two opposing arms.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/compose_sandwich.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compose guides as a sandwich — compose_sandwich","text":"","code":"# A standard plot with a sandwich guide ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) + guides(colour = compose_sandwich( middle = \"colourbar\", text = \"axis_base\", opposite = primitive_bracket(key = key_range_manual( start = c(10, 20), end = c(25, 30), name = c(\"A\", \"B\") )) ))"},{"path":"https://teunbrand.github.io/legendry/reference/compose_stack.html","id":null,"dir":"Reference","previous_headings":"","what":"Compose guides as stack — compose_stack","title":"Compose guides as stack — compose_stack","text":"guide can stack guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_stack.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compose guides as stack — compose_stack","text":"","code":"compose_stack( ..., args = list(), key = NULL, title = waiver(), side.titles = waiver(), angle = waiver(), theme = NULL, order = 0, drop = NULL, position = waiver(), available_aes = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/compose_stack.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compose guides as stack — compose_stack","text":"... Guides stack composition. guide can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. args arguments pass guides given either function string. key standard key specification. key shared among guides NULL keys . See information linked topic. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. side.titles giving labels titles displayed side stack. Set NULL display side titles. waiver(), attempt made extract titles guides use side titles. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. drop giving indices guides dropped facet requests labels drawn axes panels. default, NULL, drop every guide except first. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". available_aes giving aesthetics must match guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/compose_stack.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compose guides as stack — compose_stack","text":" guide object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/compose_stack.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compose guides as stack — compose_stack","text":"","code":"ggplot() + geom_function(fun = dnorm, xlim = c(-3, 3)) + guides(x = compose_stack( \"axis\", \"axis\", side.titles = c(\"first\", \"second\") )) + # Add margin to make room for side titles theme(plot.margin = margin(5.5, 5.5, 5.5, 11))"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_barcap.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: capped colour bar — gizmo_barcap","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":"guide displays colour bar optional caps either ends bar.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_barcap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":"","code":"gizmo_barcap( key = \"sequence\", shape = \"triangle\", size = NULL, show = NA, alpha = NA, oob = \"keep\", theme = NULL, position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_barcap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":"key sequence key specification. Defaults key_sequence(n = 15). Changing argument key_sequence() fine, changing key type advised. shape cap specification providing one following: cap , cap_triangle(). naming cap function without 'cap_'-prefix, e.g. \"round\". two column giving coordinates cap, like created cap functions cap_arch(). size setting size cap. NULL (default), cap size proportional shape coordinates legend.key.size theme setting. show control caps displayed ends bar. TRUE, caps always displayed. FALSE, caps never displayed. NA (default), caps displayed data range exceed limits. given , show[1] controls display lower end show[2] upper end. alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_barcap.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_barcap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() # Just a bar p + scale_colour_viridis_c(guide = gizmo_barcap()) # Caps show up when there is data outside the limits p + scale_colour_viridis_c( limits = c(10, 30), guide = gizmo_barcap() ) # The scale's out-of-bounds handler determines cap colour p + scale_colour_viridis_c( limits = c(10, 30), oob = scales::oob_squish, guide = gizmo_barcap() ) # Customising display of the guide p + scale_colour_viridis_c( oob = scales::oob_squish, guide = gizmo_barcap( shape = \"arch\", show = c(FALSE, TRUE), size = unit(2, \"cm\"), theme = theme(legend.key.height = unit(4, \"cm\")) ) ) + theme( legend.frame = element_rect(colour = \"black\"), legend.key.width = unit(0.5, \"cm\") )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_density.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: kernel density estimate — gizmo_density","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"guide displays kernel density estimate (KDE) aesthetic. aesthetic colour fill, shape reflect .","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_density.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"","code":"gizmo_density( key = \"sequence\", density = NULL, density.args = list(), density.fun = stats::density, just = 0.5, oob = \"keep\", alpha = NA, theme = NULL, position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_density.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"key sequence key binned key specification. density One following: NULL using kernel density estimation data values (default). vector feed density.fun function. named x y numeric elements equal length, one returned using density() function. Please note input expected scale-transformed space, original data space. density.args additional arguments density.fun argument. applies density provided . already. density.fun use kernel density estimation density argument provided list already. just 0 1. Use 0 bottom- left-aligned densities, use 1 top- right-aligned densities 0.5 violin shapes. oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_density.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: kernel density estimate — gizmo_density","text":" object.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_density.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"Non-finite values NA NaN ignored infinite values -Inf Inf squished limits.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_density.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + scale_colour_viridis_c() # Density from plot data p + guides(colour = gizmo_density()) # Using bins instead of gradient p + guides(colour = gizmo_density(\"bins\")) # Providing custom values to compute density of p + guides(colour = gizmo_density(density = runif(1000, min = 5, max = 35))) # Providing a precomputed density p + guides(colour = gizmo_density(density = density(mpg$cty, adjust = 0.5))) # Alternatively, parameters may be passed through density.args p + guides(colour = gizmo_density(density.args = list(adjust = 0.5)))"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_grob.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: custom grob — gizmo_grob","title":"Guide gizmo: custom grob — gizmo_grob","text":"guide displays user-provided grob.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_grob.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: custom grob — gizmo_grob","text":"","code":"gizmo_grob( grob, width = grobWidth(grob), height = grobHeight(grob), hjust = 0.5, vjust = 0.5, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_grob.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: custom grob — gizmo_grob","text":"grob display. width, height [][grid::unit] setting allocated width height grob respectively. hjust, vjust 0 1 setting horizontal vertical justification grob used guide x y aesthetics. position guide drawn: one \"top\", \"bottom\", \"left\", \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_grob.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: custom grob — gizmo_grob","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_grob.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: custom grob — gizmo_grob","text":"","code":"circle <- grid::circleGrob() # A standard plot with grob gizmos ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + guides( x.sec = gizmo_grob( circle, hjust = 0.75, width = unit(2, \"cm\"), height = unit(2, \"cm\") ), colour = gizmo_grob( circle, width = unit(1, \"cm\"), height = unit(1, \"cm\") ) )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_histogram.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: histogram — gizmo_histogram","title":"Guide gizmo: histogram — gizmo_histogram","text":"guide displays histogram aesthetic. aesthetic colour fill, shape reflect .","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_histogram.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: histogram — gizmo_histogram","text":"","code":"gizmo_histogram( key = \"sequence\", hist = NULL, hist.args = list(), hist.fun = graphics::hist, just = 1, oob = oob_keep, alpha = NA, theme = NULL, position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_histogram.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: histogram — gizmo_histogram","text":"key sequence key binned key specification. hist One following: NULL computing histograms data values (default). atomic feed hist.fun function. named breaks counts numeric items, breaks item exactly one element longer counts item. typical way construct list using hist() function. Please note input expected scale-transformed space, original data space. hist.args additional arguments hist.fun argument. applies hist provided already. hist.fun use computing histograms hist argument provided list already. just 0 1. Use 0 bottom- left-aligned histograms, use 1 top- right-aligned histograms 0.5 centred histograms. oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_histogram.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: histogram — gizmo_histogram","text":" object.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_histogram.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Guide gizmo: histogram — gizmo_histogram","text":"Non-finite values NA NaN ignored infinite values -Inf Inf squished limits.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_histogram.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: histogram — gizmo_histogram","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + scale_colour_viridis_c() # Histogram from plot data p + guides(colour = gizmo_histogram()) # Using bins instead of gradient p + guides(colour = gizmo_histogram(\"bins\")) # Providing custom values to compute histogram p + guides(colour = gizmo_histogram(hist = runif(1000, min = 5, max = 35))) # Providing precomputed histogram p + guides(colour = gizmo_histogram(hist = hist(mpg$cty, breaks = 10))) # Alternatively, parameters may be passed through hist.args p + guides(colour = gizmo_histogram(hist.arg = list(breaks = 10)))"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_stepcap.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: capped colour steps — gizmo_stepcap","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"guide displays binned variant colour bar optional caps either ends bar.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_stepcap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"","code":"gizmo_stepcap( key = \"bins\", shape = \"triangle\", size = NULL, show = NA, alpha = NA, oob = \"keep\", theme = NULL, position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_stepcap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"key bins key specificiation. Defaults key_bins(even.steps = FALSE, show.limits = NULL). Changing arguments key_bins() fine, changing key type advised. shape cap specification providing one following: cap , cap_triangle(). naming cap function without 'cap_'-prefix, e.g. \"round\". two column giving coordinates cap, like created cap functions cap_arch(). size setting size cap. NULL (default), cap size proportional shape coordinates legend.key.size theme setting. show control caps displayed ends bar. TRUE, caps always displayed. FALSE, caps never displayed. NA (default), caps displayed data range exceed limits. given , show[1] controls display lower end show[2] upper end. alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_stepcap.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"GizmoStepcap object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/gizmo_stepcap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() # Just some recangles p + scale_colour_viridis_c(guide = gizmo_stepcap()) # Caps show up when there is data outside the limits p + scale_colour_viridis_c( limits = c(10, 30), guide = gizmo_stepcap() ) # The scale's out-of-bounds handler determines cap colour p + scale_colour_viridis_c( limits = c(10, 30), oob = scales::oob_squish, guide = gizmo_stepcap() ) # Customising the display of the guide p + scale_colour_viridis_c( oob = scales::oob_squish, guide = gizmo_stepcap( shape = \"round\", show = c(FALSE, TRUE), size = unit(1, \"cm\"), theme = theme(legend.key.height = unit(4, \"cm\")) ) ) + theme( legend.frame = element_rect(colour = \"black\"), legend.key.width = unit(0.5, \"cm\") )"},{"path":"https://teunbrand.github.io/legendry/reference/guide-composition.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide composition — guide-composition","title":"Guide composition — guide-composition","text":"Guide composition meta-guide orchestrating ensemble guides. , 'composing' guide useful visual reflection scale.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide-composition.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide composition — guide-composition","text":"","code":"new_compose( guides, args = list(), ..., available_aes = c(\"any\", \"x\", \"y\", \"r\", \"theta\"), call = caller_env(), super = Compose )"},{"path":"https://teunbrand.github.io/legendry/reference/guide-composition.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide composition — guide-composition","text":"guides guides wherein element one following: class object. returns class object. naming function, without guide_ primitive_ prefix. args arguments pass guides given either function string. ... Additional parameters pass new_guide(). available_aes giving aesthetics must match guides. call call display messages. super class object giving meta-guide composition.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide-composition.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide composition — guide-composition","text":" (sub-)class guide composes guides.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide-composition.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide composition — guide-composition","text":"","code":"# The `new_compose()` function is not intended to be used directly my_composition <- new_compose(list(\"axis\", \"axis\"), super = ComposeStack) # Is the same as my_composition <- compose_stack(\"axis\", \"axis\")"},{"path":"https://teunbrand.github.io/legendry/reference/guide-gizmos.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmos — guide-gizmos","title":"Guide gizmos — guide-gizmos","text":"Guide gizmos speciality guide components specific one aesthetics display. Typically can composed guides guide primitives form complete guide.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide-primitives.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitives — guide-primitives","title":"Guide primitives — guide-primitives","text":"Guide primitives building blocks complex guides. , useful visual reflection scale. purpose combined one another form complex, complete guides reflect scale way.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide-primitives.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Guide primitives — guide-primitives","text":"guide primitives simple, flexible tailored one particular aesthetic. way can reused combined .","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_base.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom axis guide — guide_axis_base","title":"Custom axis guide — guide_axis_base","text":"axis guide visual representation position scales can represent x, y, theta r aesthetics. differs guide_axis() can accept custom keys can act axis coord_radial() like guide_axis_theta().","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_base.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom axis guide — guide_axis_base","text":"","code":"guide_axis_base( key = NULL, title = waiver(), theme = NULL, n.dodge = 1, check.overlap = FALSE, angle = waiver(), cap = \"none\", bidi = FALSE, order = 0, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_base.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom axis guide — guide_axis_base","text":"key standard key specification. Defaults key_auto(). See information linked topic 'Details' section. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. n.dodge positive setting number layers text labels can occupy avoid overlapping labels. check.overlap indicating whether check omit overlapping text. TRUE, first, last middle labels recursively prioritised order. FALSE, labels drawn. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. cap method cap axes. One following: one following: \"none\" perform capping. \"\" cap line ends extreme breaks. \"upper\" cap line upper extreme break. \"lower\" cap line lower extreme break. [1], TRUE equivalent \"\" FALSE equivalent \"none\" options . sorted [2n] even number members. lines drawn every odd-even pair. takes scale's breaks first argument, scale's limits second argument returns [2n] described . bidi : whether ticks drawn bidirectionally (TRUE) single direction (FALSE, default). order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_base.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom axis guide — guide_axis_base","text":" object.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_base.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Custom axis guide — guide_axis_base","text":"hood, guide stack composition line, ticks labels primitives. set minor ticks, use key = \"minor\", use type argument key_manual() key_map(). use logarithmic axis, set key = \"log\".","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_base.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom axis guide — guide_axis_base","text":"","code":"# A standard plot with custom keys p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + scale_x_continuous( guide = guide_axis_base(key = key_minor()) ) + scale_y_continuous( guide = guide_axis_base(key = key_manual(c(20, 25, 30, 40))) ) p # Is translated to theta axis without fuss p + coord_radial() # To use as logarithmic axis: ggplot(msleep, aes(bodywt, brainwt)) + geom_point(na.rm = TRUE) + scale_x_continuous( transform = \"log10\", guide = guide_axis_base(\"log\") )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_dendro.html","id":null,"dir":"Reference","previous_headings":"","what":"Dendrogram guide — guide_axis_dendro","title":"Dendrogram guide — guide_axis_dendro","text":"axis speciality axis discrete data hierarchically clustered. Please aware guide affect scale limits, set appropriately. guide give misleading results step skipped!","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_dendro.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Dendrogram guide — guide_axis_dendro","text":"","code":"guide_axis_dendro( key = \"dendro\", title = waiver(), theme = NULL, space = rel(10), vanish = TRUE, n.dodge = 1, angle = waiver(), check.overlap = FALSE, ticks = \"none\", axis_line = \"none\", order = 0, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_dendro.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Dendrogram guide — guide_axis_dendro","text":"key segment key specification. See information linked topic. Alternatively, object class automatically invokes key_dendro(). title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. space Either object length 1 determining space allocated orthogonal direction. space argument class (default) base size taken tick length theme setting. vanish relevant guide used secondary theta position: whether continue draw segments meed center (TRUE) strictly observe space setting (FALSE). n.dodge positive setting number layers text labels can occupy avoid overlapping labels. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. check.overlap indicating whether check omit overlapping text. TRUE, first, last middle labels recursively prioritised order. FALSE, labels drawn. ticks, axis_line Guides use ticks axis lines. Defaults drawing ticks axis lines. Can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_dendro.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Dendrogram guide — guide_axis_dendro","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_dendro.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Dendrogram guide — guide_axis_dendro","text":"","code":"# Hierarchically cluster data clust <- hclust(dist(scale(mtcars)), \"ave\") # Using the guide along with appropriate limits p <- ggplot(mtcars, aes(disp, rownames(mtcars))) + geom_col() + scale_y_discrete(limits = clust$labels[clust$order]) # Standard usage p + guides(y = guide_axis_dendro(clust)) # Adding ticks and axis line p + guides(y = guide_axis_dendro(clust, ticks = \"ticks\", axis_line = \"line\")) + theme(axis.line = element_line()) # Controlling space allocated to dendrogram p + guides(y = guide_axis_dendro(clust, space = unit(4, \"cm\"))) + theme(axis.ticks.y.left = element_line(\"red\")) # If want just the dendrograme, use `primitive_segments()` p + guides(y = primitive_segments(clust), y.sec = \"axis\")"},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_nested.html","id":null,"dir":"Reference","previous_headings":"","what":"Nested axis guide — guide_axis_nested","title":"Nested axis guide — guide_axis_nested","text":"axis guide gives extra range annotations position scales. can used infer nesting structure labels annotate ranges.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_nested.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Nested axis guide — guide_axis_nested","text":"","code":"guide_axis_nested( key = \"range_auto\", regular_key = \"auto\", type = \"bracket\", title = waiver(), theme = NULL, angle = waiver(), cap = \"none\", bidi = FALSE, oob = \"squish\", drop_zero = TRUE, pad_discrete = NULL, levels_text = NULL, ..., order = 0, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_nested.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Nested axis guide — guide_axis_nested","text":"key One following: range key specification. key = \"range_auto\", additional labels inserted represent point values. passed key_range_auto(sep) argument. exception made string valid key specification. regular_key standard key specification appearance regular tick marks. type Appearance ranges, either \"box\" put text boxes \"bracket\" (default) text brackets. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. cap method cap axes. One following: one following: \"none\" perform capping. \"\" cap line ends extreme breaks. \"upper\" cap line upper extreme break. \"lower\" cap line lower extreme break. [1], TRUE equivalent \"\" FALSE equivalent \"none\" options . sorted [2n] even number members. lines drawn every odd-even pair. takes scale's breaks first argument, scale's limits second argument returns [2n] described . bidi : whether ticks drawn bidirectionally (TRUE) single direction (FALSE, default). oob method dealing --bounds (oob) ranges. Can one \"squish\", \"censor\" \"none\". drop_zero whether drop near-zero width ranges (TRUE, default) preserve (FALSE). pad_discrete giving amount ranges extended given discrete variable. applied drop_zero setting. levels_text list objects customise text appears every level. ... Arguments passed primitive_bracket(), primitive_box() primitive_fence(). order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_nested.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Nested axis guide — guide_axis_nested","text":" object.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_nested.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Nested axis guide — guide_axis_nested","text":"hood, guide stack composition line, ticks, optionally labels either bracket, box fence primitives. default, key = \"range_auto\" incorporate 0th level labels inferred scale's labels. labels look like regular labels. offer keys opportunity display ranges alongside regular-looking labels, regular_key argument can used setup separate key display ticks ranges.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_axis_nested.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Nested axis guide — guide_axis_nested","text":"","code":"# A plot with nested categories on the x-axis p <- ggplot(mpg, aes(interaction(drv, cyl), hwy)) + geom_boxplot() p + guides(x = \"axis_nested\") # Apply styling to brackets p + guides(x = \"axis_nested\") + theme_guide(bracket = element_line(\"red\", linewidth = 1)) # Don't drop nesting indicators that have 0-width p + guides(x = guide_axis_nested(drop_zero = FALSE)) # Change additional padding for discrete categories p + guides(x = guide_axis_nested(pad_discrete = 0)) # Change bracket type p + guides(x = guide_axis_nested(bracket = \"curvy\")) # Use boxes instead of brackets + styling of boxes p + guides(x = guide_axis_nested(type = \"box\")) + theme_guide(box = element_rect(\"limegreen\", \"forestgreen\")) # Using fences instead of brackets + styling of fences p + guides(x = guide_axis_nested(type = \"fence\", rail = \"inner\")) + theme_guide( fence.post = element_line(\"tomato\"), fence.rail = element_line(\"dodgerblue\") ) # Use as annotation of a typical axis # `regular_key` controls display of typical axis ggplot(mpg, aes(displ, hwy)) + geom_point() + guides(x = guide_axis_nested( key = key_range_manual(start = 2:3, end = 5:6, name = c(\"First\", \"Second\")), regular_key = key_manual(c(2, 2.5, 3, 5, 7)) ))"},{"path":"https://teunbrand.github.io/legendry/reference/guide_circles.html","id":null,"dir":"Reference","previous_headings":"","what":"Circle size guide — guide_circles","title":"Circle size guide — guide_circles","text":"guide displays sizes points series circles. typically paired geom_point() draw_key_point() glyphs.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_circles.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Circle size guide — guide_circles","text":"","code":"guide_circles( key = NULL, title = waiver(), theme = NULL, hjust = 0.5, vjust = 0, text_position = NULL, clip_text = FALSE, override.aes = list(shape = 1), position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_circles.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Circle size guide — guide_circles","text":"key standard key specification. Defaults key_auto(). See information linked topic. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. hjust, vjust 0 1 giving horizontal vertical justification, respectively, central shapes. recommended hjust = 0.5 text placed left right vjust = 0.5 recommended text placed top bottom. text_position string, one \"ontop\", \"top\", \"right\", \"bottom\", \"left\" describe placement labels. default (NULL), take legend.text.position theme setting. clip_text whether give text \"ontop\" position small rectangle background colour. override.aes named specifying aesthetic parameters key glyphs. See details examples guide_legend(). position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_circles.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Circle size guide — guide_circles","text":" object.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_circles.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Circle size guide — guide_circles","text":"Please note default size scales scale area, radius, equidistant breaks appear irregularly spaced positions due labelling diameter circle. graph designed standard round shapes mind, .e. shapes 1, 16, 19 21. reason, shape = 1 default override.aes argument. shapes probably drawn quality alignment label placement may unsatisfactory.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_circles.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Circle size guide — guide_circles","text":"","code":"# A standard plot p <- ggplot(mtcars, aes(disp, mpg)) + geom_point(aes(size = hp), alpha = 0.3) # By default, the sizes aren't large enough to make this guide clear p + scale_size_area(guide = \"circles\") # Update with a more approrpriate scale p <- p + scale_size_area( max_size = 30, limits = c(0, NA), breaks = c(0, 25, 100, 250) ) p + guides(size = \"circles\") # Horizontal orientation p + guides(size = guide_circles( vjust = 0.5, hjust = 0, text_position = \"bottom\" )) # Alternative text placement p + guides(size = guide_circles( text_position = \"ontop\", clip_text = TRUE )) # More styling options p + guides(size = guide_circles(override.aes = aes(colour = \"red\")))+ theme( # Key background legend.key = element_rect(colour = \"black\", fill = 'white'), # Padding around central shapes legendry.legend.key.margin = margin(1, 1, 1, 1, \"cm\"), legend.ticks = element_line(colour = \"blue\"), legend.text.position = \"left\" )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_colbar.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom colour bar guide — guide_colbar","title":"Custom colour bar guide — guide_colbar","text":"Similar guide_colourbar(), guide displays continuous colour fill aesthetics. additional options display caps end bar, depending --bounds values.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colbar.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom colour bar guide — guide_colbar","text":"","code":"guide_colbar( title = waiver(), key = \"auto\", first_guide = \"axis_base\", second_guide = first_guide, shape = \"triangle\", size = NULL, show = NA, nbin = 15, alpha = NA, reverse = FALSE, oob = scales::oob_keep, theme = NULL, vanilla = TRUE, position = waiver(), available_aes = c(\"colour\", \"fill\") )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_colbar.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom colour bar guide — guide_colbar","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. key sequence key specification. Defaults key_sequence(n = 15). Changing argument key_sequence() fine, changing key type advised. first_guide, second_guide Guides flank colour bar. guide can specified using one following: class object. returns class object. naming function, without guide_ primitive_ prefix. first_guide placed location specified legend.text.position theme setting. second_guide placed opposite position. second_guide label suppression mechanism, labels drawn guide. shape cap specification providing one following: cap , cap_triangle(). naming cap function without 'cap_'-prefix, e.g. \"round\". two column giving coordinates cap, like created cap functions cap_arch(). size setting size cap. NULL (default), cap size proportional shape coordinates legend.key.size theme setting. show control caps displayed ends bar. TRUE, caps always displayed. FALSE, caps never displayed. NA (default), caps displayed data range exceed limits. given , show[1] controls display lower end show[2] upper end. nbin positive determining many colours use colour gradient. alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. vanilla whether default style match vanilla guide_colourbar() (TRUE) take theme verbatim (FALSE). position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". available_aes vector listing aesthetics guide can build.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colbar.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom colour bar guide — guide_colbar","text":" object","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colbar.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Custom colour bar guide — guide_colbar","text":"colours always rendered gradients, important use graphics device can render . can checked using check_device(\"gradients\").","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_colbar.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom colour bar guide — guide_colbar","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) # The colourbar shows caps when values are out-of-bounds (oob) p + scale_colour_viridis_c( limits = c(10, NA), guide = \"colbar\" ) # It also shows how oob values are handled p + scale_colour_viridis_c( limits = c(10, NA), oob = scales::oob_squish, guide = \"colbar\" ) # Adjusting the type of cap p + scale_colour_viridis_c( limits = c(10, 30), oob = scales::oob_squish, guide = guide_colbar(shape = \"round\") ) # One-sided ticks p + scale_colour_viridis_c( guide = guide_colbar(second_guide = \"none\") ) # Colour bar with minor breaks p + scale_colour_viridis_c( minor_breaks = scales::breaks_width(1), guide = guide_colbar(key = \"minor\") ) # Using log ticks on a colourbar ggplot(msleep, aes(sleep_total, sleep_rem)) + geom_point(aes(colour = bodywt), na.rm = TRUE) + scale_colour_viridis_c( transform = \"log10\", guide = guide_colbar(key = \"log\") )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_colring.html","id":null,"dir":"Reference","previous_headings":"","what":"Colour rings and arcs — guide_colring","title":"Colour rings and arcs — guide_colring","text":"Similar guide_colourbar(), guide displays continuous colour fill aesthetics. Instead bar, gradient shown ring arc, can convenient cyclical palettes provided scico package.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colring.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Colour rings and arcs — guide_colring","text":"","code":"guide_colring( title = waiver(), key = \"auto\", start = 0, end = NULL, outer_guide = \"axis_base\", inner_guide = \"axis_base\", nbin = 300, reverse = FALSE, show_labels = \"outer\", theme = NULL, vanilla = TRUE, position = waiver(), available_aes = c(\"colour\", \"fill\"), ... )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_colring.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Colour rings and arcs — guide_colring","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. key standard key specification. Defaults key_auto(). start, end radians specifying offset starting end points 12 o'clock. NULL default end, internally defaults start + 2 * pi. outer_guide, inner_guide Guides display outside inside colour ring. guide can specified using one following: class object. returns class object. naming function, without guide_ primitive_ prefix. nbin positive determining many colours display. reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. show_labels indicating guide labels shown. Can one \"outer\" (default), \"inner\", \"\" \"none\". Note labels can omitted related guide label suppression mechanism. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. vanilla whether default style match vanilla guide_colourbar() (TRUE) take theme verbatim (FALSE). position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". available_aes vector listing aesthetics guide can build. ... Arguments forwarded outer_guide inner_guide provided functions strings.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colring.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Colour rings and arcs — guide_colring","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_colring.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Colour rings and arcs — guide_colring","text":"","code":"# Rings works best with a cyclical palette my_pal <- c(\"black\", \"tomato\", \"white\", \"dodgerblue\", \"black\") p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + scale_colour_gradientn(colours = my_pal) # Standard colour ring p + guides(colour = \"colring\") # As an arc p + guides(colour = guide_colring( start = 1.25 * pi, end = 2.75 * pi )) # Removing the inner tick marks p + guides(colour = guide_colring(inner_guide = \"none\")) # Include labels on the inner axis p + guides(colour = guide_colring(show_labels = \"both\")) # Passing an argument to inner/outer guides p + guides(colour = guide_colring(angle = 0))"},{"path":"https://teunbrand.github.io/legendry/reference/guide_colsteps.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom colour steps guide — guide_colsteps","title":"Custom colour steps guide — guide_colsteps","text":"Similar guide_coloursteps(), guide displays continuous colour fill aesthetics. additional options display caps end bar, depending --bounds values.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colsteps.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom colour steps guide — guide_colsteps","text":"","code":"guide_colsteps( title = waiver(), key = \"bins\", first_guide = \"axis_base\", second_guide = \"axis_base\", shape = \"triangle\", size = NULL, show = NA, alpha = NA, reverse = FALSE, oob = scales::oob_keep, theme = NULL, position = waiver(), vanilla = TRUE, available_aes = c(\"colour\", \"fill\") )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_colsteps.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom colour steps guide — guide_colsteps","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. key bins key specificiation. Defaults key_bins(even.steps = FALSE, show.limits = NULL). Changing arguments key_bins() fine, changing key type advised. first_guide, second_guide Guides flank colour steps. guide can specified using one following: class object. returns class object. naming function, without guide_ primitive_ prefix. first_guide placed location specified legend.text.position theme setting. second_guide placed opposite position. second_guide label suppression mechanism, labels drawn guide. shape cap specification providing one following: cap , cap_triangle(). naming cap function without 'cap_'-prefix, e.g. \"round\". two column giving coordinates cap, like created cap functions cap_arch(). size setting size cap. NULL (default), cap size proportional shape coordinates legend.key.size theme setting. show control caps displayed ends bar. TRUE, caps always displayed. FALSE, caps never displayed. NA (default), caps displayed data range exceed limits. given , show[1] controls display lower end show[2] upper end. alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". vanilla whether default style match vanilla guide_colourbar() (TRUE) take theme verbatim (FALSE). available_aes vector listing aesthetics guide can build.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colsteps.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom colour steps guide — guide_colsteps","text":" object","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_colsteps.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Custom colour steps guide — guide_colsteps","text":"steps rendered clipped rectangles, important use graphics device can render clipped paths. can checked using check_device(\"clippingPaths\").","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_colsteps.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom colour steps guide — guide_colsteps","text":"","code":"p <- ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) # The colour steps show caps when values are out-of-bounds p + scale_colour_viridis_b( limits = c(10, NA), guide = \"colsteps\" ) # It also shows how oob values are handled p + scale_colour_viridis_b( limits = c(10, 30), oob = scales::oob_censor, guide = \"colsteps\" ) # Adjusting the type of cap p + scale_colour_viridis_b( limits = c(10, 30), guide = guide_colsteps(shape = \"round\") ) # The default is to use the breaks as-is p + scale_colour_viridis_b( limits = c(10, 30), breaks = c(10, 20, 25), guide = \"colsteps\" ) # But the display can be set to use evenly spaced steps p + scale_colour_viridis_b( limits = c(10, 30), breaks = c(10, 20, 25), guide = guide_colsteps(key = key_bins(even.steps = TRUE)) ) # Using tick marks by swapping side guides p + scale_colour_viridis_b( guide = guide_colsteps( first_guide = \"axis_base\", second_guide = \"axis_base\" ) )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_base.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom legend guide — guide_legend_base","title":"Custom legend guide — guide_legend_base","text":"legend closely mirrors ggplot2::guide_legend(), two adjustments. First, guide_legend_base() supports design argument flexible layout. Secondly, legend.spacing.y theme element observed verbatim instead overruled.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_base.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom legend guide — guide_legend_base","text":"","code":"guide_legend_base( key = NULL, title = waiver(), theme = NULL, design = NULL, nrow = NULL, ncol = NULL, reverse = FALSE, override.aes = list(), position = NULL, direction = NULL, order = 0 )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_base.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom legend guide — guide_legend_base","text":"key standard key specification. Defaults key_auto(). See information linked topic. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. design Specification legend layout. One following: NULL (default) use layout algorithm guide_legend(). string representing cell layout wherein # defines empty cell. See examples. representing cell layout wherein NA defines empty cell. See examples. Non-string atomic vectors treated .matrix(). nrow, ncol positive setting desired dimensions legend layout. NULL (default), dimensions derived design argument fit match number keys. reverse whether order keys inverted. override.aes named specifying aesthetic parameters key glyphs. See details examples guide_legend(). position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\". order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_base.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom legend guide — guide_legend_base","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_base.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom legend guide — guide_legend_base","text":"","code":"# A dummy plot p <- ggplot(data.frame(x = 1:3, type = c(\"tic\", \"tac\", \"toe\"))) + aes(x, x, shape = type) + geom_point(na.rm = TRUE) + scale_shape_manual(values = c(1, 4, NA)) # A design string, each character giving a cell value. # Newlines separate rows, white space is ignored. design <- \" 123 213 321 \" # Alternatively, the same can be specified using a matrix directly # design <- matrix(c(1, 2, 3, 2, 1, 3, 3, 2, 1), 3, 3, byrow = TRUE) p + guides(shape = guide_legend_base(design = design)) # Empty cells can be created using `#` design <- \" #2# 1#3 \" # Alternatively: # design <- matrix(c(NA, 1, 2, NA, NA, 3), nrow = 2) p + guides(shape = guide_legend_base(design = design))"},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_cross.html","id":null,"dir":"Reference","previous_headings":"","what":"Cross legend guide — guide_legend_cross","title":"Cross legend guide — guide_legend_cross","text":"legend type similar guide_legend() displays crosses, : interactions, two variables.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_cross.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cross legend guide — guide_legend_cross","text":"","code":"guide_legend_cross( key = NULL, title = waiver(), swap = FALSE, col_text = element_text(angle = 90, vjust = 0.5), override.aes = list(), reverse = FALSE, theme = NULL, position = NULL, direction = NULL, order = 0 )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_cross.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cross legend guide — guide_legend_cross","text":"key One following key specifications: group split specification using legend display compound variable like paste(var1, var2). standard key specification, like key_auto(), crossing two separate variables across two scales. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. swap TRUE exchanges column row variables displayed legend. col_text object giving adjustments text column labels. Can NULL display column labels equal fashion row labels. override.aes named specifying aesthetic parameters key glyphs. See details examples guide_legend(). reverse whether order keys inverted, first value controls row order second value column order. Input recycled. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\". order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_cross.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cross legend guide — guide_legend_cross","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_cross.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cross legend guide — guide_legend_cross","text":"","code":"# Standard use for single aesthetic. The default is to split labels to # disentangle aesthetics that are already crossed (by e.g. `paste()`) ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = paste(year, drv))) + guides(colour = \"legend_cross\") # If legends should be merged between identical aesthetics, both need the # same legend type. ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = paste(year, drv), shape = paste(year, drv))) + guides(colour = \"legend_cross\", shape = \"legend_cross\") # Crossing two aesthetics requires a shared title and `key = \"auto\"`. The # easy way to achieve this is to predefine a shared guide. my_guide <- guide_legend_cross(key = \"auto\", title = \"My title\") ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = drv, shape = factor(year))) + guides(colour = my_guide, shape = my_guide) # You can cross more than 2 aesthetics but not more than 2 unique aesthetics. ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = drv, shape = factor(year), size = factor(drv))) + scale_size_ordinal() + guides(colour = my_guide, shape = my_guide, size = my_guide) # You can merge an aesthetic that is already crossed with an aesthetic that # contributes to only one side of the cross. ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = paste(year, drv), shape = drv)) + guides( colour = guide_legend_cross(title = \"My Title\"), shape = guide_legend_cross(title = \"My Title\", key = \"auto\") )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_group.html","id":null,"dir":"Reference","previous_headings":"","what":"Grouped legend — guide_legend_group","title":"Grouped legend — guide_legend_group","text":"legend resembles ggplot2::guide_legend(), ability keep groups blocks titles.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_group.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Grouped legend — guide_legend_group","text":"","code":"guide_legend_group( key = \"group_split\", title = waiver(), override.aes = list(), nrow = NULL, ncol = NULL, theme = NULL, position = NULL, direction = NULL, order = 0 )"},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_group.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Grouped legend — guide_legend_group","text":"key group key specification. Defaults key_group_split() split labels find groups. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. override.aes named specifying aesthetic parameters key glyphs. See details examples guide_legend(). nrow, ncol positive setting desired dimensions legend layout. Either nrow ncol can set, , theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\". order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_group.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Grouped legend — guide_legend_group","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/guide_legend_group.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Grouped legend — guide_legend_group","text":"","code":"# Standard plot for selection of `msleep` df <- msleep[c(9, 28, 11, 5, 34, 54, 64, 24, 53), ] p <- ggplot(df) + aes(bodywt, awake, colour = paste(order, name)) + geom_point() # By default, groups are inferred from the name p + guides(colour = \"legend_group\") # You can also use a look-up table for groups # The lookup table can be more expansive than just the data: # We're using the full 'msleep' data here instead of the subset lut <- key_group_lut(msleep$name, msleep$order) p + aes(colour = name) + guides(colour = guide_legend_group(key = lut)) # `nrow` and `ncol` apply within groups p + guides(colour = guide_legend_group(nrow = 1)) # Groups are arranged according to `direction` p + guides(colour = guide_legend_group(ncol = 1, direction = \"horizontal\")) + theme(legend.title.position = \"top\") # Customising the group titles p + guides(colour = \"legend_group\") + theme( legendry.legend.subtitle.position = \"left\", legendry.legend.subtitle = element_text( hjust = 1, vjust = 1, size = rel(0.9), margin = margin(t = 5.5, r = 5.5) ) ) # Changing the spacing between groups p + guides(colour = \"legend_group\") + theme(legendry.group.spacing = unit(0, \"cm\"))"},{"path":"https://teunbrand.github.io/legendry/reference/key_group.html","id":null,"dir":"Reference","previous_headings":"","what":"Group keys — key_group","title":"Group keys — key_group","text":"functions helper functions working grouped data keys guides. share goal creating guide key, different methods. key_group_split() function factory whose functions make attempt infer groups scale's labels. key_group_lut() function factory whose functions use look table sort group membership.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_group.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Group keys — key_group","text":"","code":"key_group_split(sep = \"[^[:alnum:]]+\", reverse = FALSE) key_group_lut(members, group, ungrouped = \"Other\")"},{"path":"https://teunbrand.github.io/legendry/reference/key_group.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Group keys — key_group","text":"sep giving regular expression use splitting labels provided scale using strsplit() function. defaults, labels splitted non-alphanumeric character. reverse FALSE (default) treats first part split string groups later parts members. TRUE, treats last part groups. members vector including scale's breaks values. group vector parallel members giving group member. ungrouped giving group label assign scale's breaks match values members argument.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_group.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Group keys — key_group","text":"function use key argument guide.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/key_group.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Group keys — key_group","text":"","code":"# Example scale values <- c(\"group A:value 1\", \"group A:value 2\", \"group B:value 1\") template <- scale_colour_discrete(limits = values) # Treat the 'group X' part as groups key <- key_group_split(sep = \":\") key(template) #> colour .value .label .group #> 1 #F8766D group A:value 1 value 1 group A #> 2 #00BA38 group A:value 2 value 2 group A #> 3 #619CFF group B:value 1 value 1 group B # Treat the 'value X' part as groups key <- key_group_split(sep = \":\", reverse = TRUE) key(template) #> colour .value .label .group #> 1 #F8766D group A:value 1 group A value 1 #> 2 #619CFF group B:value 1 group B value 1 #> 3 #00BA38 group A:value 2 group A value 2 # Example scale template <- scale_colour_discrete(limits = msleep$name[c(1, 7, 9, 23, 24)]) # A lookup table can have more entries than needed key <- key_group_lut(msleep$name, msleep$order) key(template) #> colour .value .label .group #> 1 #F8766D Cheetah Cheetah Carnivora #> 2 #A3A500 Northern fur seal Northern fur seal Carnivora #> 3 #00BF7D Dog Dog Carnivora #> 4 #00B0F6 Horse Horse Perissodactyla #> 5 #E76BF3 Donkey Donkey Perissodactyla # Or less entries than needed key <- key_group_lut( msleep$name[23:24], msleep$order[23:24], ungrouped = \"Other animals\" ) key(template) #> colour .value .label .group #> 1 #00B0F6 Horse Horse Perissodactyla #> 2 #E76BF3 Donkey Donkey Perissodactyla #> 3 #F8766D Cheetah Cheetah Other animals #> 4 #A3A500 Northern fur seal Northern fur seal Other animals #> 5 #00BF7D Dog Dog Other animals"},{"path":"https://teunbrand.github.io/legendry/reference/key_range.html","id":null,"dir":"Reference","previous_headings":"","what":"Range keys — key_range","title":"Range keys — key_range","text":"functions helper functions working ranged data keys guides. share goal creating guide key, different methods: key_range_auto() function factory whose functions make attempt infer ranges scale's labels. key_range_manual() uses user-provided vectors set ranges. key_range_map() makes mappings set ranges.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_range.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Range keys — key_range","text":"","code":"key_range_auto(sep = \"[^[:alnum:]]+\", reverse = FALSE, ...) key_range_manual(start, end, name = NULL, level = NULL, ...) key_range_map(data, ..., .call = caller_env())"},{"path":"https://teunbrand.github.io/legendry/reference/key_range.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Range keys — key_range","text":"sep giving regular expression use splitting labels provided scale using strsplit(). Defaults splitting non-alphanumeric character. reverse FALSE (default) treats first labels inner labels last labels outer labels. TRUE, thee first labels treated outer labels last labels treated inner labels. ... set mappings similar provided aes(), evaluated data argument. key_range_map(), must contain start end mappings. Can contain additional parameters text styling, namely colour, family, face, size, hjust, vjust, angle lineheight. start, end vector can interpreted scale, giving start end positions range respectively. name list expressions level giving depth range avoid overlaps different ranges. level smaller 1, brackets drawn. data similar object coerced fortify() , mapping argument evaluated. .call call display messages.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_range.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Range keys — key_range","text":"key_range_auto() function. key_range_manual() key_range_map() class.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_range.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Range keys — key_range","text":"level variable optional missing, guides use algorithm similar IRanges::disjointBins() avoid overlaps. key_range_auto() work expression labels.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/key_range.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Range keys — key_range","text":"","code":"# Example scale template <- scale_x_discrete(limits = c(\"A 1\", \"B 1\", \"C&1\", \"D&2\", \"E&2\")) # By default, splits on all non-alphanumeric characters auto <- key_range_auto() auto(template) #> start end .label .level #> 1 1 1 A 0 #> 2 2 2 B 0 #> 3 3 3 C 0 #> 4 4 4 D 0 #> 5 5 5 E 0 #> 6 1 3 1 1 #> 7 4 5 2 1 # Only split on a specific character auto <- key_range_auto(sep = \"&\") auto(template) #> Warning: Not all labels in `key_range_auto()` can be split into equal lengths. #> ℹ Is \"&\" the correct `sep` argument? #> start end .label .level #> 1 1 1 A 1 0 #> 2 2 2 B 1 0 #> 3 3 3 C 0 #> 4 4 4 D 0 #> 5 5 5 E 0 #> 6 3 3 1 1 #> 7 4 5 2 1 # Treating the letters as outer labels and numbers as inner labels auto <- key_range_auto(reverse = TRUE) auto(template) #> start end .label .level #> 1 1 1 1 0 #> 2 2 2 1 0 #> 3 3 3 1 0 #> 4 4 4 2 0 #> 5 5 5 2 0 #> 6 1 1 A 1 #> 7 2 2 B 1 #> 8 3 3 C 1 #> 9 4 4 D 1 #> 10 5 5 E 1 # Providing custom values key_range_manual( start = c(1, 5, 10), end = c(4, 15, 11), level = c(0, 2, 1), name = c(\"A\", \"B\", \"C\") ) #> start end .label .level #> 1 1 4 A 0 #> 2 5 15 B 2 #> 3 10 11 C 1 # Values from a key_range_map(presidential, start = start, end = end, name = name) #> start end .label #> 1 1953-01-20 1961-01-20 Eisenhower #> 2 1961-01-20 1963-11-22 Kennedy #> 3 1963-11-22 1969-01-20 Johnson #> 4 1969-01-20 1974-08-09 Nixon #> 5 1974-08-09 1977-01-20 Ford #> 6 1977-01-20 1981-01-20 Carter #> 7 1981-01-20 1989-01-20 Reagan #> 8 1989-01-20 1993-01-20 Bush #> 9 1993-01-20 2001-01-20 Clinton #> 10 2001-01-20 2009-01-20 Bush #> 11 2009-01-20 2017-01-20 Obama #> 12 2017-01-20 2021-01-20 Trump"},{"path":"https://teunbrand.github.io/legendry/reference/key_segments.html","id":null,"dir":"Reference","previous_headings":"","what":"Segment keys — key_segments","title":"Segment keys — key_segments","text":"functions helper functions working segment data keys guides. share goal creating guide key, different methods: key_segment_manual() directly uses user-provided vectors set segments. key_segment_map() makes mappings set segments. key_dendro() specialty case coercing dendrogram data segments. aware setting key alone affect scale limits, give misleading results used incorrectly!","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_segments.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Segment keys — key_segments","text":"","code":"key_segment_manual(value, oppo, value_end = value, oppo_end = oppo, ...) key_segment_map(data, ..., .call = caller_env()) key_dendro(dendro = NULL, type = \"rectangle\")"},{"path":"https://teunbrand.github.io/legendry/reference/key_segments.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Segment keys — key_segments","text":"value, value_end vector interpreted along scale guide codifies. oppo, oppo_end vector interpreted orthogonal value value_end variables. ... set mappings similar provided aes(), evaluated data argument. key_segments_map(), must contain value oppo mappings. data similar object coerced fortify() , mapping argument evaluated. .call call display messages. dendro data structure can coerced dendrogram .dendrogram() function. NULL (default) attempt made search data scale. type string, either \"rectangle\" \"triangle\", indicating shape edges nodes dendrogram.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_segments.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Segment keys — key_segments","text":"key_segments_manual() key_segments_map(), class.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/key_segments.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Segment keys — key_segments","text":"","code":"# Giving vectors directly key_segment_manual( value = 0:1, value_end = 2:3, oppo = 1:0, oppo_end = 3:2 ) #> value oppo value_end oppo_end #> 1 0 1 2 3 #> 2 1 0 3 2 # Taking columns of a data frame data <- data.frame(x = 0:1, y = 1:0, xend = 2:3, yend = 3:2) key_segment_map(data, value = x, oppo = y, value_end = xend, oppo_end = yend) #> value oppo value_end oppo_end #> 1 0 1 2 3 #> 2 1 0 3 2 # Using dendrogram data clust <- hclust(dist(USArrests), \"ave\") key_dendro(clust)(scale_x_discrete()) #> value oppo value_end oppo_end #> 1 17.994141 152.313999 4.765625 152.313999 #> 2 4.765625 152.313999 4.765625 77.605024 #> 3 17.994141 152.313999 31.222656 152.313999 #> 4 31.222656 152.313999 31.222656 89.232093 #> 5 4.765625 77.605024 1.500000 77.605024 #> 6 1.500000 77.605024 1.500000 38.527912 #> 7 4.765625 77.605024 8.031250 77.605024 #> 8 8.031250 77.605024 8.031250 44.283922 #> 9 1.500000 38.527912 1.000000 38.527912 #> 10 1.000000 38.527912 1.000000 0.000000 #> 11 1.500000 38.527912 2.000000 38.527912 #> 12 2.000000 38.527912 2.000000 0.000000 #> 13 8.031250 44.283922 3.875000 44.283922 #> 14 3.875000 44.283922 3.875000 28.012211 #> 15 8.031250 44.283922 12.187500 44.283922 #> 16 12.187500 44.283922 12.187500 39.394633 #> 17 3.875000 28.012211 3.000000 28.012211 #> 18 3.000000 28.012211 3.000000 0.000000 #> 19 3.875000 28.012211 4.750000 28.012211 #> 20 4.750000 28.012211 4.750000 15.453120 #> 21 4.750000 15.453120 4.000000 15.453120 #> 22 4.000000 15.453120 4.000000 0.000000 #> 23 4.750000 15.453120 5.500000 15.453120 #> 24 5.500000 15.453120 5.500000 13.896043 #> 25 5.500000 13.896043 5.000000 13.896043 #> 26 5.000000 13.896043 5.000000 0.000000 #> 27 5.500000 13.896043 6.000000 13.896043 #> 28 6.000000 13.896043 6.000000 0.000000 #> 29 12.187500 39.394633 9.625000 39.394633 #> 30 9.625000 39.394633 9.625000 26.363428 #> 31 12.187500 39.394633 14.750000 39.394633 #> 32 14.750000 39.394633 14.750000 28.095803 #> 33 9.625000 26.363428 7.750000 26.363428 #> 34 7.750000 26.363428 7.750000 16.891499 #> 35 9.625000 26.363428 11.500000 26.363428 #> 36 11.500000 26.363428 11.500000 18.417331 #> 37 7.750000 16.891499 7.000000 16.891499 #> 38 7.000000 16.891499 7.000000 0.000000 #> 39 7.750000 16.891499 8.500000 16.891499 #> 40 8.500000 16.891499 8.500000 15.454449 #> 41 8.500000 15.454449 8.000000 15.454449 #> 42 8.000000 15.454449 8.000000 0.000000 #> 43 8.500000 15.454449 9.000000 15.454449 #> 44 9.000000 15.454449 9.000000 0.000000 #> 45 11.500000 18.417331 10.500000 18.417331 #> 46 10.500000 18.417331 10.500000 6.236986 #> 47 11.500000 18.417331 12.500000 18.417331 #> 48 12.500000 18.417331 12.500000 13.297368 #> 49 10.500000 6.236986 10.000000 6.236986 #> 50 10.000000 6.236986 10.000000 0.000000 #> 51 10.500000 6.236986 11.000000 6.236986 #> 52 11.000000 6.236986 11.000000 0.000000 #> 53 12.500000 13.297368 12.000000 13.297368 #> 54 12.000000 13.297368 12.000000 0.000000 #> 55 12.500000 13.297368 13.000000 13.297368 #> 56 13.000000 13.297368 13.000000 0.000000 #> 57 14.750000 28.095803 14.000000 28.095803 #> 58 14.000000 28.095803 14.000000 0.000000 #> 59 14.750000 28.095803 15.500000 28.095803 #> 60 15.500000 28.095803 15.500000 21.167192 #> 61 15.500000 21.167192 15.000000 21.167192 #> 62 15.000000 21.167192 15.000000 0.000000 #> 63 15.500000 21.167192 16.000000 21.167192 #> 64 16.000000 21.167192 16.000000 0.000000 #> 65 31.222656 89.232093 23.796875 89.232093 #> 66 23.796875 89.232093 23.796875 44.837933 #> 67 31.222656 89.232093 38.648438 89.232093 #> 68 38.648438 89.232093 38.648438 54.746831 #> 69 23.796875 44.837933 20.343750 44.837933 #> 70 20.343750 44.837933 20.343750 26.713777 #> 71 23.796875 44.837933 27.250000 44.837933 #> 72 27.250000 44.837933 27.250000 29.054195 #> 73 20.343750 26.713777 17.937500 26.713777 #> 74 17.937500 26.713777 17.937500 16.425489 #> 75 20.343750 26.713777 22.750000 26.713777 #> 76 22.750000 26.713777 22.750000 22.595978 #> 77 17.937500 16.425489 17.000000 16.425489 #> 78 17.000000 16.425489 17.000000 0.000000 #> 79 17.937500 16.425489 18.875000 16.425489 #> 80 18.875000 16.425489 18.875000 12.878100 #> 81 18.875000 12.878100 18.000000 12.878100 #> 82 18.000000 12.878100 18.000000 0.000000 #> 83 18.875000 12.878100 19.750000 12.878100 #> 84 19.750000 12.878100 19.750000 10.736739 #> 85 19.750000 10.736739 19.000000 10.736739 #> 86 19.000000 10.736739 19.000000 0.000000 #> 87 19.750000 10.736739 20.500000 10.736739 #> 88 20.500000 10.736739 20.500000 7.355270 #> 89 20.500000 7.355270 20.000000 7.355270 #> 90 20.000000 7.355270 20.000000 0.000000 #> 91 20.500000 7.355270 21.000000 7.355270 #> 92 21.000000 7.355270 21.000000 0.000000 #> 93 22.750000 22.595978 22.000000 22.595978 #> 94 22.000000 22.595978 22.000000 0.000000 #> 95 22.750000 22.595978 23.500000 22.595978 #> 96 23.500000 22.595978 23.500000 11.456439 #> 97 23.500000 11.456439 23.000000 11.456439 #> 98 23.000000 11.456439 23.000000 0.000000 #> 99 23.500000 11.456439 24.000000 11.456439 #> 100 24.000000 11.456439 24.000000 0.000000 #> 101 27.250000 29.054195 25.750000 29.054195 #> 102 25.750000 29.054195 25.750000 20.198479 #> 103 27.250000 29.054195 28.750000 29.054195 #> 104 28.750000 29.054195 28.750000 23.972143 #> 105 25.750000 20.198479 25.000000 20.198479 #> 106 25.000000 20.198479 25.000000 0.000000 #> 107 25.750000 20.198479 26.500000 20.198479 #> 108 26.500000 20.198479 26.500000 12.614278 #> 109 26.500000 12.614278 26.000000 12.614278 #> 110 26.000000 12.614278 26.000000 0.000000 #> 111 26.500000 12.614278 27.000000 12.614278 #> 112 27.000000 12.614278 27.000000 0.000000 #> 113 28.750000 23.972143 28.000000 23.972143 #> 114 28.000000 23.972143 28.000000 0.000000 #> 115 28.750000 23.972143 29.500000 23.972143 #> 116 29.500000 23.972143 29.500000 14.501034 #> 117 29.500000 14.501034 29.000000 14.501034 #> 118 29.000000 14.501034 29.000000 0.000000 #> 119 29.500000 14.501034 30.000000 14.501034 #> 120 30.000000 14.501034 30.000000 0.000000 #> 121 38.648438 54.746831 34.437500 54.746831 #> 122 34.437500 54.746831 34.437500 20.598507 #> 123 38.648438 54.746831 42.859375 54.746831 #> 124 42.859375 54.746831 42.859375 41.094765 #> 125 34.437500 20.598507 31.875000 20.598507 #> 126 31.875000 20.598507 31.875000 15.026107 #> 127 34.437500 20.598507 37.000000 20.598507 #> 128 37.000000 20.598507 37.000000 15.122897 #> 129 31.875000 15.026107 31.000000 15.026107 #> 130 31.000000 15.026107 31.000000 0.000000 #> 131 31.875000 15.026107 32.750000 15.026107 #> 132 32.750000 15.026107 32.750000 12.438692 #> 133 32.750000 12.438692 32.000000 12.438692 #> 134 32.000000 12.438692 32.000000 0.000000 #> 135 32.750000 12.438692 33.500000 12.438692 #> 136 33.500000 12.438692 33.500000 3.834058 #> 137 33.500000 3.834058 33.000000 3.834058 #> 138 33.000000 3.834058 33.000000 0.000000 #> 139 33.500000 3.834058 34.000000 3.834058 #> 140 34.000000 3.834058 34.000000 0.000000 #> 141 37.000000 15.122897 35.500000 15.122897 #> 142 35.500000 15.122897 35.500000 6.637771 #> 143 37.000000 15.122897 38.500000 15.122897 #> 144 38.500000 15.122897 38.500000 13.352260 #> 145 35.500000 6.637771 35.000000 6.637771 #> 146 35.000000 6.637771 35.000000 0.000000 #> 147 35.500000 6.637771 36.000000 6.637771 #> 148 36.000000 6.637771 36.000000 0.000000 #> 149 38.500000 13.352260 37.500000 13.352260 #> 150 37.500000 13.352260 37.500000 3.929377 #> 151 38.500000 13.352260 39.500000 13.352260 #> 152 39.500000 13.352260 39.500000 8.027453 #> 153 37.500000 3.929377 37.000000 3.929377 #> 154 37.000000 3.929377 37.000000 0.000000 #> 155 37.500000 3.929377 38.000000 3.929377 #> 156 38.000000 3.929377 38.000000 0.000000 #> 157 39.500000 8.027453 39.000000 8.027453 #> 158 39.000000 8.027453 39.000000 0.000000 #> 159 39.500000 8.027453 40.000000 8.027453 #> 160 40.000000 8.027453 40.000000 0.000000 #> 161 42.859375 41.094765 41.000000 41.094765 #> 162 41.000000 41.094765 41.000000 0.000000 #> 163 42.859375 41.094765 44.718750 41.094765 #> 164 44.718750 41.094765 44.718750 33.117815 #> 165 44.718750 33.117815 42.750000 33.117815 #> 166 42.750000 33.117815 42.750000 10.771175 #> 167 44.718750 33.117815 46.687500 33.117815 #> 168 46.687500 33.117815 46.687500 27.779904 #> 169 42.750000 10.771175 42.000000 10.771175 #> 170 42.000000 10.771175 42.000000 0.000000 #> 171 42.750000 10.771175 43.500000 10.771175 #> 172 43.500000 10.771175 43.500000 8.537564 #> 173 43.500000 8.537564 43.000000 8.537564 #> 174 43.000000 8.537564 43.000000 0.000000 #> 175 43.500000 8.537564 44.000000 8.537564 #> 176 44.000000 8.537564 44.000000 0.000000 #> 177 46.687500 27.779904 45.500000 27.779904 #> 178 45.500000 27.779904 45.500000 13.044922 #> 179 46.687500 27.779904 47.875000 27.779904 #> 180 47.875000 27.779904 47.875000 18.993398 #> 181 45.500000 13.044922 45.000000 13.044922 #> 182 45.000000 13.044922 45.000000 0.000000 #> 183 45.500000 13.044922 46.000000 13.044922 #> 184 46.000000 13.044922 46.000000 0.000000 #> 185 47.875000 18.993398 47.000000 18.993398 #> 186 47.000000 18.993398 47.000000 0.000000 #> 187 47.875000 18.993398 48.750000 18.993398 #> 188 48.750000 18.993398 48.750000 10.184218 #> 189 48.750000 10.184218 48.000000 10.184218 #> 190 48.000000 10.184218 48.000000 0.000000 #> 191 48.750000 10.184218 49.500000 10.184218 #> 192 49.500000 10.184218 49.500000 2.291288 #> 193 49.500000 2.291288 49.000000 2.291288 #> 194 49.000000 2.291288 49.000000 0.000000 #> 195 49.500000 2.291288 50.000000 2.291288 #> 196 50.000000 2.291288 50.000000 0.000000"},{"path":"https://teunbrand.github.io/legendry/reference/key_specialty.html","id":null,"dir":"Reference","previous_headings":"","what":"Speciality keys — key_specialty","title":"Speciality keys — key_specialty","text":"functions helper functions working keys guides. functions described widely applicable may apply small subset guides. , fine adjust arguments speciality key, swapping types ill-advised. key_sequence() function factory whose functions create regularly spaced sequence limits scale. used colour bar guides. key_bins() function factory whose function create binned key given breaks scale. used colour steps guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_specialty.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Speciality keys — key_specialty","text":"","code":"key_sequence(n = 15) key_bins(even.steps = FALSE, show.limits = NULL)"},{"path":"https://teunbrand.github.io/legendry/reference/key_specialty.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Speciality keys — key_specialty","text":"n positive giving number colours use gradient. even.steps indicating whether size bins displayed equal (TRUE) proportional length data space (FALSE). show.limits stating whether limits scale shown labels ticks (TRUE) remain hidden (FALSE). Note breaks coinciding limits shown regardless setting. default, NULL, consults scale's show.limits setting defaults FALSE.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_specialty.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Speciality keys — key_specialty","text":"key_sequence() function.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/key_specialty.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Speciality keys — key_specialty","text":"","code":"# An example scale template <- scale_fill_viridis_c(limits = c(0, 10), breaks = c(2, 4, 6, 8)) # Retrieving colourbar and colourstep keys key_sequence()(template) #> fill .value #> 1 #440154 0.0000000 #> 2 #461F66 0.7142857 #> 3 #453478 1.4285714 #> 4 #414888 2.1428571 #> 5 #3C5B8A 2.8571429 #> 6 #336D8D 3.5714286 #> 7 #2B7F8D 4.2857143 #> 8 #2B9089 5.0000000 #> 9 #26A186 5.7142857 #> 10 #40B17B 6.4285714 #> 11 #5FBF69 7.1428571 #> 12 #76CE56 7.8571429 #> 13 #A4D848 8.5714286 #> 14 #D2E039 9.2857143 #> 15 #FDE725 10.0000000 key_bins()(template) #> fill min max .label .value #> 1 #46286D 0 2 NA #> 2 #3B5E8B 2 4 2 2 #> 3 #2B9089 4 6 4 4 #> 4 #5ABC6D 6 8 6 6 #> 5 #C0DD40 8 10 8 8 #> 6 NA NA NA"},{"path":"https://teunbrand.github.io/legendry/reference/key_standard.html","id":null,"dir":"Reference","previous_headings":"","what":"Standard keys — key_standard","title":"Standard keys — key_standard","text":"functions helper functions working tick marks keys guides. share goal creating guide key, different outcomes: key_auto() function factory whose functions extract typical key major breaks scale. key_manual() uses user-provided vectors make key. key_map() makes mappings make key. key_minor() function factory whose functions also extract minor break positions minor tick marks. key_log() function factory whose functions place ticks intervals log10 space. key_none() makes empty key entries.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_standard.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Standard keys — key_standard","text":"","code":"key_auto(...) key_manual( aesthetic, value = aesthetic, label = as.character(value), type = NULL, ... ) key_map(data, ..., .call = caller_env()) key_minor(...) key_log( prescale_base = NULL, negative_small = 0.1, expanded = TRUE, labeller = NULL, ... ) key_none()"},{"path":"https://teunbrand.github.io/legendry/reference/key_standard.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Standard keys — key_standard","text":"... set mappings similar provided aes(), evaluated data argument. must contain aesthetic mapping. aesthetic, value vector values guide represent equivalent breaks argument scales. aesthetic mapped, whereas value . intents purposes, aesthetic value identical. label list expressions use labels. type vector representing one break types: \"major\", \"minor\" \"mini\". NULL (default), breaks treated major breaks. data similar object coerced fortify() , mapping argument evaluated. .call call display messages. prescale_base giving base logarithm transform data manually. default, NULL, use scale transformation calculate positions. advisable set prescale_base argument data already log-transformed. using log-transform scale coord_trans(), default NULL recommended. negative_small setting smallest absolute value marked tick case scale limits include 0 negative numbers. expanded determining whether ticks cover entire range scale expansion (TRUE, default), restricted scale limits (FALSE). labeller receives major breaks returns formatted labels. key_log(), NULL default scales::label_log() strictly positive numbers custom labeller negative numbers included.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/key_standard.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Standard keys — key_standard","text":"key_auto(), key_minor() key_log() function. key_manual() key_map() class.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/key_standard.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Standard keys — key_standard","text":"","code":"# An example scale template <- scale_x_continuous(limits = c(0, 10)) # The auto, minor and log keys operate on scales key_auto()(template) #> x .value .label #> 1 0.0 0.0 0.0 #> 2 2.5 2.5 2.5 #> 3 5.0 5.0 5.0 #> 4 7.5 7.5 7.5 #> 5 10.0 10.0 10.0 key_minor()(template) #> x .value .label .type #> 1 0.00 0.00 0.0 major #> 2 2.50 2.50 2.5 major #> 3 5.00 5.00 5.0 major #> 4 7.50 7.50 7.5 major #> 5 10.00 10.00 10.0 major #> 6 1.25 1.25 minor #> 7 3.75 3.75 minor #> 8 6.25 6.25 minor #> 9 8.75 8.75 minor # So does the log key template <- scale_x_continuous(transform = \"log10\", limits = c(0.1, 10)) key_log()(template) # Providing custom values key_manual( aesthetic = 1:5, label = c(\"one\", \"two\", \"three\", \"four\", \"five\") ) #> aesthetic .value .label #> 1 1 1 one #> 2 2 2 two #> 3 3 3 three #> 4 4 4 four #> 5 5 5 five # Values from a `` key_map(ToothGrowth, aesthetic = unique(supp)) #> aesthetic .value .label #> 1 VC VC VC #> 2 OJ OJ OJ # Empty key key_none() #> [1] aesthetic .value .label #> <0 rows> (or 0-length row.names)"},{"path":"https://teunbrand.github.io/legendry/reference/legendry-package.html","id":null,"dir":"Reference","previous_headings":"","what":"legendry: Extended Legends and Axes for 'ggplot2' — legendry-package","title":"legendry: Extended Legends and Axes for 'ggplot2' — legendry-package","text":"'ggplot2' extension focusses expanding plotter's arsenal guides. Guides 'ggplot2' include axes legends. 'legendry' offers new axes annotation options, well new legends colour displays.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/legendry-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"legendry: Extended Legends and Axes for 'ggplot2' — legendry-package","text":"Maintainer: Teun van den Brand tahvdbrand@gmail.com (ORCID) [copyright holder]","code":""},{"path":"https://teunbrand.github.io/legendry/reference/legendry_extensions.html","id":null,"dir":"Reference","previous_headings":"","what":"ggproto objects in legendry — Compose","title":"ggproto objects in legendry — Compose","text":"legendry package relies extension system ggplot2 ggproto class objects, allow cross-package inheritance objects geoms, stats, facets, scales coordinate systems. purpose making plots, users invited wholly ignore objects, since interacting objects preferred various constructor functions. legendry package introduces new ggproto class support variations axes, legends colourbars.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitives: boxes — primitive_box","title":"Guide primitives: boxes — primitive_box","text":"function constructs boxes guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitives: boxes — primitive_box","text":"","code":"primitive_box( key = \"range_auto\", angle = waiver(), oob = \"squish\", drop_zero = TRUE, pad_discrete = 0.4, min_size = NULL, levels_box = NULL, levels_text = NULL, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitives: boxes — primitive_box","text":"key range key specification. See information linked topic. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. oob method dealing --bounds (oob) ranges. Can one \"squish\", \"censor\" \"none\". drop_zero whether drop near-zero width ranges (TRUE, default) preserve (FALSE). pad_discrete giving amount ranges extended given discrete variable. applied drop_zero setting. min_size [][grid::unit] setting minimal size box. levels_box list objects customise boxes appear every level. levels_text list objects customise text appears every level. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitives: boxes — primitive_box","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitives: boxes — primitive_box","text":"theme options determine styling guide, may differ depending whether guide used axis legend context. Common types following: legendry.box boxes draw.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitives: boxes — primitive_box","text":"axis.text.{x/y}.{position} text inside boxes.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitives: boxes — primitive_box","text":"legend.text text inside boxes.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_box.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitives: boxes — primitive_box","text":"","code":"# A standard plot p <- ggplot(mpg, aes(interaction(drv, year), displ)) + geom_point() key <- key_range_manual(c(2, 4), c(5, 6), c(\"A\", \"B\")) # Adding as secondary guides p + guides( x.sec = primitive_box(), y.sec = primitive_box(key = key) )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: brackets — primitive_bracket","title":"Guide primitive: brackets — primitive_bracket","text":"function constructs brackets guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: brackets — primitive_bracket","text":"","code":"primitive_bracket( key = \"range_auto\", bracket = \"line\", angle = waiver(), oob = \"squish\", drop_zero = TRUE, pad_discrete = 0.4, levels_brackets = NULL, levels_text = NULL, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: brackets — primitive_bracket","text":"key range key specification. See information linked topic. bracket bracket providing one following: bracket , bracket_square. naming bracket function without 'bracket_'-prefix, e.g. \"square\". two-column giving line coordinates bracket, like created bracket functions, bracket_round(). angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. oob method dealing --bounds (oob) ranges. Can one \"squish\", \"censor\" \"none\". drop_zero whether drop near-zero width ranges (TRUE, default) preserve (FALSE). pad_discrete giving amount ranges extended given discrete variable. applied drop_zero setting. levels_brackets list objects customise brackets appear every level. levels_text list objects customise text appears every level. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: brackets — primitive_bracket","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: brackets — primitive_bracket","text":"theme options determine styling guide, may differ depending whether guide used axis legend context. Common types following: legendry.bracket line used draw brackets. legendry.backet.size setting space afforded bracket.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: brackets — primitive_bracket","text":"axis.text.{x/y}.{position} text displayed brackets.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: brackets — primitive_bracket","text":"legend.text text displayed brackets.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_bracket.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: brackets — primitive_bracket","text":"","code":"# A standard plot p <- ggplot(mpg, aes(interaction(drv, year), displ)) + geom_point() key <- key_range_manual(c(2, 4), c(5, 6), c(\"A\", \"B\")) # Adding as secondary guides p + guides( x.sec = primitive_bracket(), y.sec = primitive_bracket(key = key) )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: fence — primitive_fence","title":"Guide primitive: fence — primitive_fence","text":"function constructs fence guide primitive. customisation options easier understand view fence 'post' vertical pieces real world fence, 'rail' horizontal pieces.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: fence — primitive_fence","text":"","code":"primitive_fence( key = \"range_auto\", rail = \"none\", angle = waiver(), oob = \"squish\", drop_zero = TRUE, pad_discrete = 0.5, levels_text = NULL, levels_post = NULL, levels_rail = NULL, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: fence — primitive_fence","text":"key range key specification. See information linked topic. rail giving option display fence railing. Can either \"none\" (default) display railings, \"inner\" draw one rail closer plot panel, \"outer\" display one rail farther plot panel, \"\" sandwich labels rails. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. oob method dealing --bounds (oob) ranges. Can one \"squish\", \"censor\" \"none\". drop_zero whether drop near-zero width ranges (TRUE, default) preserve (FALSE). pad_discrete giving amount ranges extended given discrete variable. applied drop_zero setting. levels_text list objects customise text appears every level. levels_post, levels_rail list objects customise fence posts rails displayed every level. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: fence — primitive_fence","text":" primitive guie can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: fence — primitive_fence","text":"theme options determine styling guide, may differ depending whether guide used axis legend context. Common types following: legendry.fence.post line used draw pieces orthogonal direction scale. legendry.fence.rail line used draw pieces parallel direction scale.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: fence — primitive_fence","text":"axis.text.{x/y}.{position} text displayed.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: fence — primitive_fence","text":"legend.text text displayed.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_fence.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: fence — primitive_fence","text":"","code":"# A standard plot p <- ggplot(mpg, aes(interaction(drv, year), displ)) + geom_point() key <- key_range_manual(c(2, 4), c(5, 6), c(\"A\", \"B\")) # Adding as secondary guides p + guides( x.sec = primitive_fence(rail = \"inner\"), y.sec = primitive_fence(key = key, rail = \"outer\") )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: labels — primitive_labels","title":"Guide primitive: labels — primitive_labels","text":"function constructs labels guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: labels — primitive_labels","text":"","code":"primitive_labels( key = NULL, angle = waiver(), n.dodge = 1, check.overlap = FALSE, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: labels — primitive_labels","text":"key standard key specification. See information linked topic. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. n.dodge positive setting number layers text labels can occupy avoid overlapping labels. check.overlap indicating whether check omit overlapping text. TRUE, first, last middle labels recursively prioritised order. FALSE, labels drawn. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: labels — primitive_labels","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: labels — primitive_labels","text":"theme options determine styling guide, may differ depending whether guide used axis legend context.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: labels — primitive_labels","text":"axis.text.{x/y}.{position} display labels.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"as-a-legend-guide-","dir":"Reference","previous_headings":"","what":"As a legend guide.","title":"Guide primitive: labels — primitive_labels","text":"legend.text display labels.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_labels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: labels — primitive_labels","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # Adding as secondary guides p + guides( x.sec = primitive_labels(), y.sec = primitive_labels(n.dodge = 2) )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: line — primitive_line","title":"Guide primitive: line — primitive_line","text":"function constructs line guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: line — primitive_line","text":"","code":"primitive_line(key = NULL, cap = \"none\", theme = NULL, position = waiver())"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: line — primitive_line","text":"key standard key specification. See information linked topic. cap method cap axes. One following: one following: \"none\" perform capping. \"\" cap line ends extreme breaks. \"upper\" cap line upper extreme break. \"lower\" cap line lower extreme break. [1], TRUE equivalent \"\" FALSE equivalent \"none\" options . sorted [2n] even number members. lines drawn every odd-even pair. takes scale's breaks first argument, scale's limits second argument returns [2n] described . theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: line — primitive_line","text":"PrimitiveLine primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: line — primitive_line","text":"theme options determine styling guide, may differ depending whether guide used axis legend context.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: line — primitive_line","text":"axis.line.{x/y}.{position} line style.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: line — primitive_line","text":"legend.axis.line line style.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_line.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: line — primitive_line","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + theme(axis.line = element_line()) # Adding as secondary guides p + guides( x.sec = primitive_line(), y.sec = primitive_line(cap = \"both\") )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitives: segments — primitive_segments","title":"Guide primitives: segments — primitive_segments","text":"function constructs guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitives: segments — primitive_segments","text":"","code":"primitive_segments( key = NULL, space = rel(10), vanish = FALSE, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitives: segments — primitive_segments","text":"key segment key specification. See information linked topic. Alternatively, object class automatically invokes key_dendro(). space Either object length 1 determining space allocated orthogonal direction. space argument class (default) base size taken tick length theme setting. vanish relevant guide used secondary theta position: whether continue draw segments meed center (TRUE) strictly observe space setting (FALSE). theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitives: segments — primitive_segments","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitives: segments — primitive_segments","text":"theme options determine style guide, may differ depending whether guide used axis legend context.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitives: segments — primitive_segments","text":"axis.ticks.{x/y}.{position} display segments. axis.ticks.length.{x/y}.{position} base size segments orthogonal direction.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitives: segments — primitive_segments","text":"legend.ticks display segments. legend.ticks.length base size segments orthogonal direction.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_segments.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitives: segments — primitive_segments","text":"","code":"# Building a key key <- key_segment_manual( value = c(1.6, 1.6, 3.4, 5.2), value_end = c(7.0, 7.0, 3.4, 5.2), oppo = c(1.0, 2.0, 0.0, 0.0), oppo_end = c(1.0, 2.0, 3.0, 3.0) ) # Using the primitive in a plot ggplot(mpg, aes(displ, hwy)) + geom_point() + scale_x_continuous( guide = primitive_segments(key = key) )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_spacer.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: spacer — primitive_spacer","title":"Guide primitive: spacer — primitive_spacer","text":"function constructs spacer guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_spacer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: spacer — primitive_spacer","text":"","code":"primitive_spacer( space = NULL, title = waiver(), theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_spacer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: spacer — primitive_spacer","text":"space [][grid::unit()] title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_spacer.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: spacer — primitive_spacer","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_spacer.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: spacer — primitive_spacer","text":"#' theme options determine styling guide. guide option dependent role axis legend. legendry.guide.spacing setting amount spacing space argument NULL.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_spacer.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: spacer — primitive_spacer","text":"","code":"ggplot(mpg, aes(displ, hwy)) + geom_point() + guides( x = guide_axis_stack(\"axis\", primitive_spacer(unit(1, \"cm\")), \"axis\") )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: line — primitive_ticks","title":"Guide primitive: line — primitive_ticks","text":"function constructs ticks guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: line — primitive_ticks","text":"","code":"primitive_ticks(key = NULL, bidi = FALSE, theme = NULL, position = waiver())"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: line — primitive_ticks","text":"key standard key specification. See information linked topic. bidi : whether ticks drawn bidirectionally (TRUE) single direction (FALSE, default). theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: line — primitive_ticks","text":"PrimitiveTicks primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: line — primitive_ticks","text":"theme options determine styling guide, may differ depending whether guide used axis legend context. Common types following:","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: line — primitive_ticks","text":"axis.ticks.{x/y}.{position} major tick lines. axis.minor.ticks.{x/y}.{position} minor tick lines. legendry.axis.mini.ticks internally inheriting minor ticks smallest ticks e.g. log axes. axis.ticks.length.{x/y}.{position} major ticks length. axis.minor.ticks.length.{x/y}.{position} minor ticks length. legendry.axis.mini.ticks.length internally inheriting minor tick length smallest ticks e.g. log axes.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: line — primitive_ticks","text":"legend.ticks major tick lines. legendry.legend.minor.ticks minor tick lines. legendry.legend.mini.ticks smallest ticks e.g. log axes. legend.ticks.length major ticks length. legendry.legend.minor.ticks.length minor ticks length. legendry.legend.mini.ticks.length smallest ticks e.g. log axes.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_ticks.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: line — primitive_ticks","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # Adding as secondary guides p + guides(x.sec = primitive_ticks(), y.sec = primitive_ticks())"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: title — primitive_title","title":"Guide primitive: title — primitive_title","text":"function constructs title guide primitive.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: title — primitive_title","text":"","code":"primitive_title( title = waiver(), angle = waiver(), theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: title — primitive_title","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: title — primitive_title","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: title — primitive_title","text":"theme options determine styling guide, may differ depending whether guide used axis legend context.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: title — primitive_title","text":"axis.title.{x/y}.{position} title display.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: title — primitive_title","text":"legend.title title display.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/primitive_title.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: title — primitive_title","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # Adding as secondary guides p + guides( x.sec = primitive_title(\"Horizontal Title\"), y.sec = primitive_title(c(\"along vertical\", \"Multiple tiles\")) )"},{"path":"https://teunbrand.github.io/legendry/reference/scale_x_dendro.html","id":null,"dir":"Reference","previous_headings":"","what":"Dendrogram scales — scale_x_dendro","title":"Dendrogram scales — scale_x_dendro","text":"speciality scales use hierarchically clustered data. scale automatically orders limits according clustering result comes dendrogram axis.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/scale_x_dendro.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Dendrogram scales — scale_x_dendro","text":"","code":"scale_x_dendro( clust, ..., expand = waiver(), guide = \"axis_dendro\", position = \"bottom\" ) scale_y_dendro( clust, ..., expand = waiver(), guide = \"axis_dendro\", position = \"left\" )"},{"path":"https://teunbrand.github.io/legendry/reference/scale_x_dendro.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Dendrogram scales — scale_x_dendro","text":"clust data structure can coerced object .hclust(). ... Arguments passed ggplot2::discrete_scale aesthetics names aesthetics scale works . palette palette function called single integer argument (number levels scale) returns values take (e.g., scales::pal_hue()). name name scale. Used axis legend title. waiver(), default, name scale taken first mapping used aesthetic. NULL, legend title omitted. breaks One : NULL breaks waiver() default breaks (scale limits) character vector breaks function takes limits input returns breaks output. Also accepts rlang lambda function notation. labels One : NULL labels waiver() default labels computed transformation object character vector giving labels (must length breaks) expression vector (must length breaks). See ?plotmath details. function takes breaks input returns labels output. Also accepts rlang lambda function notation. na.translate Unlike continuous scales, discrete scales can easily show missing values, default. want remove missing values discrete scale, specify na.translate = FALSE. na.value na.translate = TRUE, aesthetic value missing values displayed ? apply position scales NA always placed far right. drop unused factor levels omitted scale? default, TRUE, uses levels appear data; FALSE includes levels factor. Please note display every level legend, layer use show.legend = TRUE. call call used construct scale reporting messages. super super class use constructed scale expand position scales, vector range expansion constants used add padding around data ensure placed distance away axes. Use convenience function expansion() generate values expand argument. defaults expand scale 5% side continuous variables, 0.6 units side discrete variables. guide function used create guide name. See guides() information. position position scales, position axis. left right y axes, top bottom x axes.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/scale_x_dendro.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Dendrogram scales — scale_x_dendro","text":" object can added plot.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/scale_x_dendro.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Dendrogram scales — scale_x_dendro","text":"scale limits determined order labels clust argument. limits argument scales, breaks argument can still used selectively omit breaks labels can used formatting purposes.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/legendry/reference/scale_x_dendro.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Dendrogram scales — scale_x_dendro","text":"","code":"# Hierarchically cluster data, separately for rows and columns car_clust <- hclust(dist(scale(mtcars)), \"ave\") var_clust <- hclust(dist(scale(t(mtcars))), \"ave\") long_mtcars <- data.frame( car = rownames(mtcars)[row(mtcars)], var = colnames(mtcars)[col(mtcars)], value = as.vector(scale(mtcars)) ) # A standard heatmap adorned with dendrograms p <- ggplot(long_mtcars, aes(var, car, fill = value)) + geom_tile() + scale_x_dendro(var_clust) + scale_y_dendro(car_clust) p # Styling the dendrograms p + guides( y = guide_axis_dendro(key_dendro(type = \"triangle\")), x = guide_axis_dendro(space = rel(5)) ) + theme( axis.text.y.left = element_text(margin = margin(r = 3, l = 3)), axis.ticks.y = element_line(\"red\"), axis.ticks.x = element_line(linetype = \"dotted\") ) # In polar coordinates, plus some formatting p + coord_radial( theta = \"y\", inner.radius = 0.5, start = 0.25 * pi, end = 1.75 * pi ) + guides( theta = primitive_labels(angle = 90), theta.sec = primitive_segments(\"dendro\", vanish = TRUE), r = guide_axis_dendro(angle = 0) )"},{"path":"https://teunbrand.github.io/legendry/reference/theme_guide.html","id":null,"dir":"Reference","previous_headings":"","what":"Theme wrapper for guides — theme_guide","title":"Theme wrapper for guides — theme_guide","text":"function shorthand names theme elements relating guides. intended used guide_*(theme) argument. intent, due legends axes mutually exclusive theme elements, function sets elements simultaneously.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/theme_guide.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Theme wrapper for guides — theme_guide","text":"","code":"theme_guide( text = NULL, line = NULL, title = NULL, subtitle = NULL, text.position = NULL, title.position = NULL, subtitle.position = NULL, ticks = NULL, minor.ticks = NULL, mini.ticks = NULL, ticks.length = NULL, minor.ticks.length = NULL, mini.ticks.length = NULL, spacing = NULL, group.spacing = NULL, key = NULL, key.size = NULL, key.width = NULL, key.height = NULL, key.spacing = NULL, key.spacing.x = NULL, key.spacing.y = NULL, key.margin = NULL, frame = NULL, byrow = NULL, background = NULL, margin = NULL, bracket = NULL, bracket.size = NULL, box = NULL, fence = NULL, fence.post = NULL, fence.rail = NULL )"},{"path":"https://teunbrand.github.io/legendry/reference/theme_guide.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Theme wrapper for guides — theme_guide","text":"text setting legend.text axis.text elements. line setting legend.axis.line axis.line elements. title setting legend.title axis.title elements. subtitle setting legendry.legend.subtitle legendry.axis.subtitle elements. text.position, title.position, subtitle.position One \"top\", \"right\", \"bottom\" \"right\" setting following elements: text.position: sets legend.text.position. title.position: sets legend.title.position. subtitle.position sets legendry.legend.subtitle.position legendry.axis.subtitle.position ticks setting axis.ticks legend.ticks elements. minor.ticks setting legendry.legend.minor.ticks 6 axis.ticks.minor.{r/theta/x.top/x.bottom/y.left/y.right} elements. mini.ticks setting legendry.legend.mini.ticks legendry.axis.mini.ticks elements. ticks.length, minor.ticks.length, mini.ticks.length [][grid::unit()] setting following elements: ticks.length: sets legend.ticks.length axis.ticks.length. minor.ticks.length sets axis.minor.ticks.length legendry.legend.minor.ticks.length. mini.ticks.length sets legendry.axis.mini.ticks.length legendry.legend.mini.ticks.length. spacing, group.spacing [][grid::unit()] setting legendry.guide.spacing legendry.group.spacing theme elements. key setting legend.key element. key.size, key.width, key.height setting legend.key.size, legend.key.width legend.key.height elements respectively. key.spacing, key.spacing.x, key.spacing.y [][grid::unit()] setting legend.key.spacing, legend.key.spacing.x legend.key.spacing.y elements respectively. key.margin setting margin around legend glyphs. frame setting legend.frame element. byrow setting legend.byrow element. background setting legend.background element. margin setting legend.margin element. bracket setting legendry.bracket element. bracket.size [][grid::unit()] setting legendry.bracket.size element. box setting legendry.box element. fence, fence.post, fence.rail setting legendry.fence, legendry.fence.post legendry.fence.rail respectively.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/theme_guide.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Theme wrapper for guides — theme_guide","text":" object can provided guide.","code":""},{"path":"https://teunbrand.github.io/legendry/reference/theme_guide.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Theme wrapper for guides — theme_guide","text":"","code":"red_ticks <- theme_guide(ticks = element_line(colour = \"red\", linewidth = 0.5)) # Both axis and colourbar gain red ticks ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + guides( colour = guide_colourbar(theme = red_ticks), x = guide_axis(theme = red_ticks) )"},{"path":"https://teunbrand.github.io/legendry/news/index.html","id":"legendry-development-version","dir":"Changelog","previous_headings":"","what":"legendry (development version)","title":"legendry (development version)","text":"New scale functions scale_x_dendro() scale_y_dendro(). New full guide function: guide_axis_dendro(). New primitive guide function: primitive_segments() New key functions: key_segment_manual(), key_segment_map() key_dendro(). New supporting theme element legendry.legend.key.margin. Fixed bug guide_axis_nested(key = key_range_auto(...)) produced duplicated labels (#31).","code":""},{"path":"https://teunbrand.github.io/legendry/news/index.html","id":"legendry-010","dir":"Changelog","previous_headings":"","what":"legendry 0.1.0","title":"legendry 0.1.0","text":"CRAN release: 2024-11-01 First release. Thanks following people catching reporting early bugs mistakes: @davidhodge931 (#7, #8, #9, #12) @luisDVA (#18) @mthomas-ketchbrook (#21)","code":""}]