-
Notifications
You must be signed in to change notification settings - Fork 251
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
Scale.alpha_continuous & Scale.alpha_discrete #1257
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1257 +/- ##
=========================================
- Coverage 85.74% 85.5% -0.25%
=========================================
Files 35 35
Lines 4119 4139 +20
=========================================
+ Hits 3532 3539 +7
- Misses 587 600 +13
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! thanks for fixing the git problems. just a few comments.
src/scale.jl
Outdated
@@ -313,7 +325,7 @@ anything in the data that's not respresented in `levels` will be set to | |||
default order. | |||
|
|||
See also [`group_discrete`](@ref), [`shape_discrete`](@ref), | |||
[`size_discrete`](@ref), and [`linestyle_discrete`](@ref). | |||
[`size_discrete`](@ref), and [`linestyle_discrete`](@ref), and [`alpha_discrete`](@ref). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the "and" before linestyle_discrete could be removed as it was in #1252
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
for (k,g) in enumerate(ug) | ||
i = groups.==[g] | ||
polys[k] = polygon_points(aes_x[i], aes_y[i], geom.preserve_order) | ||
colors[k] = first(aes_color[i]) | ||
line_styles[k] = mod1(first(aes_linestyle[i]), linestyle_palette_length) | ||
line_styles[k] = mod1(first(aes_linestyle[i]), linestyle_palette_length) | ||
alphas[k] = first(alpha_discrete ? theme.alphas[aes_alpha[i]] : aes_alpha[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what git weirdness is causing the line_style[k]
line to be highlight as a change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird - no idea.
src/geom/ribbon.jl
Outdated
@@ -10,41 +10,42 @@ RibbonGeometry(default_statistic=Gadfly.Stat.identity(); fill=true, tag=empty_ta | |||
Geom.ribbon | |||
|
|||
Draw a ribbon at the positions in `x` bounded above and below by `ymax` and | |||
`ymin`, respectively. Optionally draw multiple ribbons by grouping with `color`. | |||
`ymin`, respectively. Optionally draw multiple ribbons by grouping with `color` and `alpha` or `linestyle`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does "color and alpha or linestyle" mean? the boolean logic is unclear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've clarified this. It differs whether the ribbon is filled or not filled:
Lines 75 to 76 in 99f54e4
geom.fill ? compose!(ctx, Compose.polygon(polys, geom.tag), fill(colors), fillopacity(alphas)) : | |
compose!(ctx, Compose.line(lines, geom.tag), fill(nothing), stroke(colors), strokedash(linestyles)) |
Theme(default_color="green", discrete_highlight_color=c->"gray", | ||
point_size=2mm, alphas=[0.0,0.2,0.4,0.6,0.8,1.0]) | ||
) | ||
hstack(p1,p2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both of these tests are near identical to the docs, the only difference being the hard-coded random numbers. seems redundant. ideally i like to see real data, say from RDatasets, used in the docs that is particularly pretty, and very simple made up cases for the tests with focus on execution speed (we time out sometimes) and code coverage. this is a bit of a nit-pick, but can you at least make the docs and the tests less redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this example because it illustrates e.g. "color aesthetic, fixed alpha" and "alpha aesthetic, fixed color". If I used an example from RDatasets to illustrate the alpha
aesthetic, I would use something like the Diamonds
dataset (53940 points). In my next PR I'm going to halve the time it takes to plot that: Geom.point
currently suffers from using a new context for every point.
NEWS.md
Same as #1252, but now with
alpha
info in the docstrings forGeom.point
,Geom.polygon
andGeom.ribbon