Skip to content

Commit

Permalink
bump version and add deprecation (#478)
Browse files Browse the repository at this point in the history
* bump version and add deprecation

* plottype changes

* bump makie
  • Loading branch information
piever committed Nov 24, 2023
1 parent 5713cce commit 762601c
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 8 deletions.
8 changes: 4 additions & 4 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"]
version = "0.6.16"
version = "0.6.17"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand All @@ -17,8 +17,8 @@ Loess = "4345ca2d-374a-55d4-8d30-97f9976e7612"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
PlotUtils = "995b91a9-d308-5afd-9ec6-746e21dbc043"
PooledArrays = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
RelocatableFolders = "05181044-ff0b-4ac5-8273-598c1e38db00"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
RelocatableFolders = "05181044-ff0b-4ac5-8273-598c1e38db00"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
Expand All @@ -33,11 +33,11 @@ GeometryBasics = "0.4.1"
GridLayoutBase = "0.6, 0.7, 0.8, 0.9, 0.10"
KernelDensity = "0.6"
Loess = "0.5.1, 0.6.1"
Makie = "0.20"
Makie = "0.20.1"
PlotUtils = "1"
PooledArrays = "1"
RelocatableFolders = "0.1, 0.2, 0.3, 1.0"
PrecompileTools = "1"
RelocatableFolders = "0.1, 0.2, 0.3, 1.0"
StatsBase = "0.33, 0.34"
StructArrays = "0.5, 0.6"
Tables = "1.4"
Expand Down
2 changes: 1 addition & 1 deletion src/algebra/layer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ end
## Format for layer after processing

Base.@kwdef struct ProcessedLayer <: AbstractDrawable
plottype::PlotType=Plot{Any}
plottype::PlotType=Plot{plot}
primary::NamedArguments=NamedArguments()
positional::Arguments=Arguments()
named::NamedArguments=NamedArguments()
Expand Down
8 changes: 6 additions & 2 deletions src/transformations/visual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ struct Visual
plottype::PlotType
attributes::NamedArguments
end
Visual(plottype=Plot{Any}; kwargs...) = Visual(plottype, NamedArguments(kwargs))
Visual(plottype::PlotType=Plot{plot}; kwargs...) = Visual(plottype, NamedArguments(kwargs))

function (v::Visual)(input::ProcessedLayer)
plottype = Makie.plottype(v.plottype, input.plottype)
attributes = merge(input.attributes, v.attributes)
return ProcessedLayer(input; plottype, attributes)
end

visual(plottype=Plot{Any}; kwargs...) = transformation(Visual(plottype; kwargs...))
# In the future, consider switching from `visual(Plot{T})` to `visual(T)`.
visual(plottype::PlotType=Plot{plot}; kwargs...) = transformation(Visual(plottype; kwargs...))

# For backward compatibility, still allow `visual(Any)`.
@deprecate visual(::Type{Any}; kwargs...) visual(; kwargs...)
2 changes: 1 addition & 1 deletion test/algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ end
end
@test length(processedlayers) == 6
for i in 1: 6
@test processedlayers[i].plottype === Plot{Any}
@test processedlayers[i].plottype === Plot{plot}
@test isempty(processedlayers[i].attributes)
@test processedlayers[i].labels[1] == "x"
@test processedlayers[i].labels[2] == (i 3 ? "y" : "z")
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import Shapefile, GeometryBasics
Random.seed!(1234)

include("utils.jl")
include("visual.jl")
include("algebra.jl")
include("analyses.jl")
include("scales.jl")
Expand Down
29 changes: 29 additions & 0 deletions test/visual.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@testset "visual attributes" begin
attrs = NamedArguments([:color, :marker], ["red", :circle])
pl = ProcessedLayer(attributes=attrs)
v = visual(Any, color="blue", linewidth=2)
pl′ = v.transformation(pl)
@test pl′.plottype === Plot{plot}
collect(keys(pl′.attributes)) == [:color, :marker, :linewidth]
pl′.attributes[:color] == "blue"
pl′.attributes[:marker] == :circle
pl′.attributes[:linewidth] == 2
end

@testset "visual plottype" begin
@test visual(Any).transformation.plottype === Plot{plot}
@test visual(Plot{plot}).transformation.plottype === Plot{plot}

v1, v2 = visual(), visual(BarPlot)
pl1, pl2 = ProcessedLayer(), ProcessedLayer(plottype=Scatter)

@test v1.transformation.plottype === Plot{plot}
@test v2.transformation.plottype === BarPlot
@test pl1.plottype === Plot{plot}
@test pl2.plottype === Scatter

@test v1.transformation(pl1).plottype === Plot{plot}
@test v1.transformation(pl2).plottype === Scatter
@test v2.transformation(pl1).plottype === BarPlot
@test v2.transformation(pl2).plottype === BarPlot
end

2 comments on commit 762601c

@piever
Copy link
Collaborator Author

@piever piever commented on 762601c Nov 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/95897

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.17 -m "<description of version>" 762601c01217c924218e1d286ab52c55ceb46cb4
git push origin v0.6.17

Please sign in to comment.