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

Stacked guides #1423

Merged
merged 3 commits into from
Apr 23, 2020
Merged

Stacked guides #1423

merged 3 commits into from
Apr 23, 2020

Conversation

Mattriks
Copy link
Member

@Mattriks Mattriks commented Apr 20, 2020

  • 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

Examples

using RDatasets
Dsleep = dataset("ggplot2", "msleep")
Dsleep = dropmissing!(Dsleep[:,[:Vore, :BodyWt, :SleepTotal, :SleepRem]])
Dsleep.SleepTime = Dsleep.SleepTotal .> 8
p1 = plot(Dsleep, x=:BodyWt, y=:SleepRem, Geom.point, color=:Vore, shape=:SleepTime,
    Scale.x_log10, Guide.colorkey(),
    Guide.shapekey(title="Sleep\n(hours) ", labels=[">8","≤8"]),
    Theme(point_size=5pt, key_swatch_color="slategrey",         
        point_shapes=[Shape.utriangle, Shape.dtriangle],
        discrete_highlight_color=identity, alphas=[0.1])
)

stacked_p1

The number of key columns is automated. In this example I reduce the size of the testscript plot,
so the keys gain 2 columns. The max number of columns is controlled by Theme(key_max_columns=4).

p2 = evalfile(dirname(pathof(Gadfly))*"/../test/testscripts/point_color_shape_size.jl")
draw(PNG(5inch, 3.3inch), p2)

stacked_p2

@codecov-io
Copy link

codecov-io commented Apr 21, 2020

Codecov Report

Merging #1423 into master will decrease coverage by 0.18%.
The diff coverage is 75.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1423      +/-   ##
==========================================
- Coverage   89.57%   89.39%   -0.19%     
==========================================
  Files          39       39              
  Lines        4288     4318      +30     
==========================================
+ Hits         3841     3860      +19     
- Misses        447      458      +11     
Impacted Files Coverage Δ
src/guide/keys.jl 81.81% <66.66%> (-0.83%) ⬇️
src/guide.jl 88.99% <76.74%> (-1.65%) ⬇️

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 0e51e2a...3c9ae73. Read the comment docs.

@Mattriks
Copy link
Member Author

This is ready to merge - if there are no comments

@bjarthur
Copy link
Member

it's beautiful! does it appear in the gallery, tests, and docs?

@Mattriks
Copy link
Member Author

Mattriks commented Apr 23, 2020

Yes in testscripts "Guide.shape_key" and "point_color_shape_size.jl". I changed a gallery example Guide.shapekey to show stacked guides (note there are other examples in the gallery with inside guides). Done!

@Mattriks Mattriks merged commit 72ec042 into GiovineItalia:master Apr 23, 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.

Feature request: map multiple numerical and categorical data to plots
3 participants