Skip to content
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

Guide.manual_discrete_key #1441

Merged
merged 2 commits into from
May 27, 2020
Merged

Conversation

Mattriks
Copy link
Member

@Mattriks Mattriks commented May 24, 2020

  • I've updated the documentation to reflect these changes
  • I've added an entry to NEWS.md
  • I've added and/or updated the unit tests
  • I've run the regression tests
  • I've built the docs and confirmed these changes don't cause new errors

This PR:

  • adds Guide.manual_discrete_key
  • Guide.manual_color_key is updated with new features (e.g. pos, shape, size)

Example

using DataFrames, RDatasets
points = DataFrame(index=rand(0:10,30), val=rand(1:10,30))
line = DataFrame(val=rand(1:10,11), index=collect(0:10))
p1 = plot(layer(points, x=:index, y=:val, color=[colorant"green"]),
    layer(line, x=:index, y=:val, Geom.line),
    Guide.manual_color_key("Legend", ["Points", "Line"], ["green", "deepskyblue"],
        shape=[Shape.circle, Shape.hline]))

D = dataset("COUNT", "titanicgrp")
D = join(D, by(D, :Class, :Cases=>sum), on=:Class)
D.prcnt = 100*D.Survive./D.Cases_sum 
p2 = plot(stack(D, [:Age, :Sex]), xgroup=:Class,
    Geom.subplot_grid(Guide.xlabel(orientation=:horizontal),
        layer(x=:variable, y=:prcnt, color=:value, Geom.bar),        
    ),  Scale.x_discrete, Guide.ylabel("Survival (%)"),
    Guide.manual_color_key("Age", ["children","adults"], 1:2),
    Guide.manual_color_key("Sex", ["women","men"], 3:4),
    Theme(bar_spacing=1mm, key_position=:none, 
        key_swatch_shape=Shape.square, point_size=4pt))
hstack(p1, p2)

manual_color_key

@codecov-commenter
Copy link

codecov-commenter commented May 24, 2020

Codecov Report

Merging #1441 into master will decrease coverage by 0.04%.
The diff coverage is 88.37%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1441      +/-   ##
==========================================
- Coverage   89.42%   89.37%   -0.05%     
==========================================
  Files          39       39              
  Lines        4369     4378       +9     
==========================================
+ Hits         3907     3913       +6     
- Misses        462      465       +3     
Impacted Files Coverage Δ
src/guide.jl 90.48% <ø> (+1.26%) ⬆️
src/theme.jl 65.07% <ø> (ø)
src/guide/keys.jl 82.69% <88.09%> (+0.87%) ⬆️
src/poetry.jl 90.74% <100.00%> (ø)
src/statistics.jl 96.44% <0.00%> (-0.58%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 44d9ca8...cc9539c. Read the comment docs.

@Mattriks
Copy link
Member Author

Tests pass, but getting an error in the doc build (not due to docs).

@Mattriks Mattriks closed this May 27, 2020
@Mattriks Mattriks reopened this May 27, 2020
@Mattriks Mattriks merged commit f4764c8 into GiovineItalia:master May 27, 2020
tomyun added a commit to cropbox/Cropbox.jl that referenced this pull request Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants