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

bump makie version #323

Merged
merged 3 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AlgebraOfGraphics"
uuid = "cbdf2221-f076-402e-a563-3d30da359d67"
authors = ["Pietro Vertechi <pietro.vertechi@veos.digital>"]
version = "0.6.0"
version = "0.6.1"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand Down Expand Up @@ -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"
Expand Down
17 changes: 14 additions & 3 deletions src/algebra/layers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -68,15 +78,16 @@ 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
continuousscales = AlgebraOfGraphics.continuousscales(ProcessedLayer(pl; plottype))
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

Expand Down
2 changes: 1 addition & 1 deletion src/transformations/histogram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/analyses.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down