-
Notifications
You must be signed in to change notification settings - Fork 2.1k
WIP: show.key, a new parameter of guide_legend() to fix #3648 #3649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.