From 39b271201297c3786d06310355e78647550f6700 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 13 Mar 2024 15:44:59 -0500 Subject: [PATCH] shift things around a little for docs --- .github/workflows/CI.yml | 2 +- docs/Project.toml | 1 + docs/src/plotting.md | 1 + ext/LighthouseMakieExt.jl | 24 ++---------------------- src/plotting.jl | 22 ++++++++++++++++++++++ 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d8862ce..2b40436 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -65,7 +65,7 @@ jobs: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: - version: '1.6' + version: '1.10' - uses: julia-actions/cache@v1 with: cache-compiled: true diff --git a/docs/Project.toml b/docs/Project.toml index 54f344c..bb49311 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,6 +1,7 @@ [deps] CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +Lighthouse = "ac2c24cd-07f0-4848-96b2-1b82c3ea0e59" StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" [compat] diff --git a/docs/src/plotting.md b/docs/src/plotting.md index ce9d57b..e3b3ead 100644 --- a/docs/src/plotting.md +++ b/docs/src/plotting.md @@ -82,6 +82,7 @@ Note that all curve plot types accepts these types: Lighthouse.XYVector Lighthouse.SeriesCurves ``` + ## Theming All generic series and axis attributes can be themed via `SeriesPlot.Series` / `SeriesPlot.Axis`. diff --git a/ext/LighthouseMakieExt.jl b/ext/LighthouseMakieExt.jl index cd9eed2..55e4ed6 100644 --- a/ext/LighthouseMakieExt.jl +++ b/ext/LighthouseMakieExt.jl @@ -6,6 +6,8 @@ using Printf using Lighthouse: has_value, evaluation_metrics +using Lighthouse: XYVector, SeriesCurves, NumberLike, NumberVector, NumberMatrix + # all the methods we're actually defining and which call each other using Lighthouse: evaluation_metrics_plot, plot_confusion_matrix, plot_confusion_matrix!, plot_reliability_calibration_curves, plot_reliability_calibration_curves!, @@ -16,14 +18,6 @@ using Lighthouse: evaluation_metrics_plot, plot_confusion_matrix, plot_confusion get_parent(x::Makie.GridPosition) = x.layout.parent -# We can't rely on inference to always give us fully typed -# Vector{<: Number} so we add `{T} where T` to the the mix -# This makes the number like type a bit absurd, but is still nice for -# documentation purposes! -const NumberLike = Union{Number,Missing,Nothing,T} where {T} -const NumberVector = AbstractVector{<:NumberLike} -const NumberMatrix = AbstractMatrix{<:NumberLike} - ##### ##### Helpers for theming and color generation...May want to move them to Colors.jl / Makie.jl ##### @@ -60,20 +54,6 @@ function high_contrast(background_color::Colorant, target_color::Colorant; return RGBAf(color[1], Makie.Colors.alpha(target_color)) end -""" - Tuple{<:NumberVector, <: NumberVector} - -Tuple of X, Y coordinates -""" -const XYVector = Tuple{<:NumberVector,<:NumberVector} - -""" - Union{XYVector, AbstractVector{<: XYVector}} - -A series of XYVectors, or a single xyvector. -""" -const SeriesCurves = Union{XYVector,AbstractVector{<:XYVector}} - function series_plot!(subfig::GridPosition, per_class_pr_curves::SeriesCurves, class_labels::Union{Nothing,AbstractVector{String}}; legend=:lt, title="No title", diff --git a/src/plotting.jl b/src/plotting.jl index 51e5370..665dbc8 100644 --- a/src/plotting.jl +++ b/src/plotting.jl @@ -1,3 +1,25 @@ +# We can't rely on inference to always give us fully typed +# Vector{<: Number} so we add `{T} where T` to the the mix +# This makes the number like type a bit absurd, but is still nice for +# documentation purposes! +const NumberLike = Union{Number,Missing,Nothing,T} where {T} +const NumberVector = AbstractVector{<:NumberLike} +const NumberMatrix = AbstractMatrix{<:NumberLike} + +""" + Tuple{<:NumberVector, <: NumberVector} + +Tuple of X, Y coordinates +""" +const XYVector = Tuple{<:NumberVector,<:NumberVector} + +""" + Union{XYVector, AbstractVector{<: XYVector}} + +A series of XYVectors, or a single xyvector. +""" +const SeriesCurves = Union{XYVector,AbstractVector{<:XYVector}} + """ evaluation_metrics_plot(data::Dict; size=(1000, 1000), fontsize=12) evaluation_metrics_plot(row::EvaluationV1; kwargs...)