From bc1e7849819466e06ff4d98e3d248ac7c405c3f7 Mon Sep 17 00:00:00 2001 From: Pietro Vertechi Date: Fri, 28 Jan 2022 14:17:29 +0100 Subject: [PATCH] bump makie version (#323) * bump makie version * fix tests * update news and bump version --- NEWS.md | 6 ++++++ Project.toml | 4 ++-- src/algebra/layers.jl | 17 ++++++++++++++--- src/transformations/histogram.jl | 2 +- test/analyses.jl | 4 ++-- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/NEWS.md b/NEWS.md index 3892e4011..8be7b2f72 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,12 @@ - Customizable axis linking behavior. - Customizable legend and colorbar position and look. +- In v0.6.1, support `level` in `linear` analysis for confidence interval. + +## Internal changes + +- In v0.6.1, replaced tuples and named tuples in `Layer` and `Entry` with dictionaries from [Dictionaries.jl](https://github.com/andyferris/Dictionaries.jl). +- In v0.6.1, split internal `Entry` type into `ProcessedLayer` (to be used for analyses) and `Entry` (to be used for plotting). # AlgebraOfGraphics.jl v0.5 Release Notes diff --git a/Project.toml b/Project.toml index 21dc8de76..0af2b945a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "AlgebraOfGraphics" uuid = "cbdf2221-f076-402e-a563-3d30da359d67" authors = ["Pietro Vertechi "] -version = "0.6.0" +version = "0.6.1" [deps] Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" @@ -32,7 +32,7 @@ GeometryBasics = "0.4.1" GridLayoutBase = "0.6" KernelDensity = "0.6" Loess = "0.5.1" -Makie = "0.15.2" +Makie = "0.16.3" PlotUtils = "1" PooledArrays = "1" RelocatableFolders = "0.1" diff --git a/src/algebra/layers.jl b/src/algebra/layers.jl index 8ae62e90a..b90c0afa9 100644 --- a/src/algebra/layers.jl +++ b/src/algebra/layers.jl @@ -37,7 +37,10 @@ function compute_processedlayers_grid(processedlayers, categoricalscales) return pls_grid end -function compute_attributes(attributes, primary, named) +function compute_attributes(pl::ProcessedLayer) + plottype, primary, positional, named, attributes = + pl.plottype, pl.primary, pl.positional, pl.named, pl.attributes + attrs = NamedArguments() merge!(attrs, attributes) merge!(attrs, primary) @@ -53,6 +56,13 @@ function compute_attributes(attributes, primary, named) merge!(attrs, Dictionary(valid_options(; color, cycle))) + # avoid automatic bar width computation in Makie + if (plottype <: BarPlot) && !haskey(attrs, :width) + x = first(positional) + width = (x isa AbstractRange) && (length(positional) == 2) ? step(x) : 1.0 + insert!(attrs, :width, width) + end + # remove unnecessary information return filterkeys(!in((:col, :row, :layout, :alpha)), attrs) end @@ -68,6 +78,7 @@ function compute_entries_continuousscales(pls_grid) for idx in eachindex(pls_grid), pl in pls_grid[idx] # Apply continuous transformations positional = map(contextfree_rescale, pl.positional) + named = map(contextfree_rescale, pl.named) plottype = Makie.plottype(pl.plottype, positional...) # Compute continuous scales with correct plottype, to figure out role of color @@ -75,8 +86,8 @@ function compute_entries_continuousscales(pls_grid) mergewith!(mergescales, continuousscales_grid[idx], continuousscales) # Compute `Entry` with rescaled columns - named = compute_attributes(pl.attributes, pl.primary, map(contextfree_rescale, pl.named)) - entry = Entry(plottype, positional, named) + attrs = compute_attributes(ProcessedLayer(pl; plottype, positional, named)) + entry = Entry(plottype, positional, attrs) push!(entries_grid[idx], entry) end diff --git a/src/transformations/histogram.jl b/src/transformations/histogram.jl index b8e95852e..fcdbdd967 100644 --- a/src/transformations/histogram.jl +++ b/src/transformations/histogram.jl @@ -48,7 +48,7 @@ function (h::HistogramAnalysis)(input::ProcessedLayer) label = h.normalization == :none ? "count" : string(h.normalization) labels = set(output.labels, N+1 => label) attributes = if N == 1 - set(output.attributes, :dodge_gap => 0, :x_gap => 0) + set(output.attributes, :gap => 0, :dodge_gap => 0) else output.attributes end diff --git a/test/analyses.jl b/test/analyses.jl index 20d468078..804be868e 100644 --- a/test/analyses.jl +++ b/test/analyses.jl @@ -288,7 +288,7 @@ end @test processedlayer.primary == NamedArguments((color=["a", "b"],)) @test isempty(processedlayer.named) - @test processedlayer.attributes == NamedArguments((dodge_gap=0, x_gap=0)) + @test processedlayer.attributes == NamedArguments((gap=0, dodge_gap=0)) @test processedlayer.plottype == AlgebraOfGraphics.BarPlot labels = MixedArguments() @@ -327,7 +327,7 @@ end @test processedlayer.primary == NamedArguments((color=["a", "b"],)) @test isempty(processedlayer.named) - @test processedlayer.attributes == NamedArguments((dodge_gap=0, x_gap=0)) + @test processedlayer.attributes == NamedArguments((gap=0, dodge_gap=0)) @test processedlayer.plottype == AlgebraOfGraphics.BarPlot labels = MixedArguments()