From 43ca81624aa7b149aad7c9fce18c2604f054aafa Mon Sep 17 00:00:00 2001 From: Mattriks Date: Mon, 4 Nov 2019 06:28:48 +1100 Subject: [PATCH] issue1338 --- src/aesthetics.jl | 2 +- src/geom/point.jl | 2 +- test/testscripts/issue1338.jl | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 test/testscripts/issue1338.jl diff --git a/src/aesthetics.jl b/src/aesthetics.jl index b1cef4a77..415ef69fa 100755 --- a/src/aesthetics.jl +++ b/src/aesthetics.jl @@ -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 diff --git a/src/geom/point.jl b/src/geom/point.jl index dd35ab2a0..6d91d030f 100644 --- a/src/geom/point.jl +++ b/src/geom/point.jl @@ -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]] diff --git a/test/testscripts/issue1338.jl b/test/testscripts/issue1338.jl new file mode 100644 index 000000000..b715d85e8 --- /dev/null +++ b/test/testscripts/issue1338.jl @@ -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) + \ No newline at end of file