Skip to content

Commit

Permalink
Merge pull request #1339 from Mattriks/shape_fixes
Browse files Browse the repository at this point in the history
Fixes #1338
  • Loading branch information
bjarthur authored Nov 17, 2019
2 parents d4abe78 + 43ca816 commit b54852e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/aesthetics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ function by_xy_group(aes::T, xgroup, ygroup,
end

vals = getfield(aes, var)
if typeof(vals) <: AbstractArray
if isa(vals, AbstractArray) && length(vals)>1
if xgroup !== nothing && length(vals) !== length(xgroup) ||
ygroup !== nothing && length(vals) !== length(ygroup)
continue
Expand Down
2 changes: 1 addition & 1 deletion src/geom/point.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function render(geom::PointGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics
Gadfly.assert_aesthetics_equal_length("Geom.point", aes, :x, :y)

default_aes = Gadfly.Aesthetics()
default_aes.shape = Function[Shape.circle]
default_aes.shape = Function[theme.point_shapes[1]]
default_aes.color = discretize_make_ia(RGBA{Float32}[theme.default_color])
default_aes.size = Measure[theme.point_size]
default_aes.alpha = [theme.alphas[1]]
Expand Down
17 changes: 17 additions & 0 deletions test/testscripts/issue1338.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using DataFrames, Gadfly

set_default_plot_size(6.6inch,3.3inch)

y = [0.71, 0.88, 0.97, 0.8, 0.16, 0.12, 0.52, 0.52, 0.67, 0.31]
df = DataFrame(x=repeat(1:5,2), y=y, z=repeat(["a","b"], inner=5))

stylef(shape::Function) = style(point_shapes=[shape], point_size=2mm)
p2 = plot( layer(x=1:10, y=y, stylef(Shape.cross)),
layer(x=1:10, y=y.+0.3, stylef(Shape.xcross)) )

p3 = plot(df, xgroup=:z, x=:x, y=:y, shape=[Shape.square], alpha=[0.1],
Geom.subplot_grid(Geom.point),
Theme(point_size=5pt, key_position=:none, discrete_highlight_color=identity) )

hstack(p2, p3)

0 comments on commit b54852e

Please sign in to comment.