WIP: show.key, a new parameter of guide_legend() to fix #3648#3649
WIP: show.key, a new parameter of guide_legend() to fix #3648#3649microly wants to merge 6 commits intotidyverse:mainfrom
Conversation
Clean up theme addition (tidyverse#3570)
update to tidyverse edition 20191118
update to tidyverse edition 20191129
|
Some example: |
|
The first example below shows how ggplot2 draws the keys: The users can not control two things:
Show.key can give full control of the two things above to users! Show.key is a list with length n, which is the number of the breaks of the scale. Let's see the example 2 below: Firstly, we code the layers with their order in the plot code: 1 geom_polygon, 2 geom_line, 3 geom_point. Secondly, we can see that show.key is a list of length 3. The first element of show.key, c(2, 3), control the first key of legend. c(2,3) means that the geoms of "2 geom_line" and "3 geom_point" will be drawn in the first key, the drawing order is that "2 geom_line" is first and "3 geom_point" is second. Generally, if the layer code (e.g. 1 for geom_polygon) is in the nth element of show.key, its geom (e.g. polygon) will be drawn in the nth key of lenged. |
|
Another example: using show.key in a convenient way. Let's take care the first key: firstly, draw a polygon glyph; secondly, draw a line glyph; at last, draw a point glyph . |
|
Hi @microly, we have found an automated way of extracting the layer-key interaction so we'll use that instead of this PR. Thank you for testing out solutions and preparing this PR to address the issue; we're glad that you were willing to contribute. |







fix #3648
This is only a pr draft to show my solution to #3648.
The documemtation is lack, and the codes may need improve.
Any comment is welcome!
I will add documemtation and anything needed later.