Skip to content

Commit

Permalink
Merge branch 'master' into compathelper/new_version/2024-08-27-01-02-…
Browse files Browse the repository at this point in the history
…23-731-02574193590
  • Loading branch information
sefffal authored Oct 25, 2024
2 parents 47e45fc + dbf01fc commit 655e8d8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PairPlots"
uuid = "43a3c2be-4208-490b-832a-a21dcd55d7da"
authors = ["William Thompson <wthompson@uvic.ca>"]
version = "2.9.1"
version = "2.9.3"

[deps]
Contour = "d38c429a-6771-53c6-b99e-75d170b6e991"
Expand Down
49 changes: 45 additions & 4 deletions src/PairPlots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,10 @@ function _apply_user_format_string(format)
end
end


"""
MarginConfidenceLimits(format_string::AbstractString; kwargs...)
MarginConfidenceLimits(formatter::Base.Callable=margin_confidence_default_formatter; kwargs...)
MarginConfidenceLimits(format_string::AbstractString, (0.16,0.5,0.84); kwargs...)
MarginConfidenceLimits(formatter::Base.Callable=margin_confidence_default_formatter, (0.16,0.5,0.84); kwargs...)
"""
struct MarginConfidenceLimits <: VizTypeDiag
Expand All @@ -331,6 +332,23 @@ struct MarginConfidenceLimits <: VizTypeDiag
end
end

"""
MarginQuantileLines(format_string::AbstractString; kwargs...)
MarginQuantileLines(formatter::Base.Callable=margin_confidence_default_formatter; kwargs...)
"""
struct MarginQuantileLines <: VizTypeDiag
formatter::Base.Callable
quantiles::NTuple{3,Number}
kwargs
function MarginQuantileLines(format::AbstractString, quantiles=(0.16, 0.5, 0.84); kwargs...)
return new(_apply_user_format_string(format), quantiles, kwargs)
end
function MarginQuantileLines(formatter::Base.Callable=margin_confidence_default_formatter, quantiles=(0.16, 0.5, 0.84); kwargs...)
return new(formatter, quantiles, kwargs)
end
end

"""
MarginHist(;kwargs...)
MarginHist(histprep_function; kwargs...)
Expand Down Expand Up @@ -588,9 +606,9 @@ function pairplot(
return pairplot(grid, map(defaults1, datapairs)...; kwargs...)
elseif len_datapairs_not_truth <= 5
defaults_upto5((data,vizlayers)::Pair) = SeriesDefaults(data) => vizlayers
defaults_upto5(series::Series) = series => multi_series_default_viz3
defaults_upto5(series::Series) = series => multi_series_default_viz
defaults_upto5(truths::Truth) = truths => truths_default_viz
defaults_upto5(data::Any) = SeriesDefaults(data) => multi_series_default_viz3
defaults_upto5(data::Any) = SeriesDefaults(data) => multi_series_default_viz
return pairplot(grid, map(defaults_upto5, datapairs)...; kwargs...)
else # More than 5 series
defaults_morethan5((data,vizlayers)::Pair) = SeriesDefaults(data) => vizlayers
Expand Down Expand Up @@ -1160,6 +1178,29 @@ function diagplot(ax::Makie.Axis, viz::MarginConfidenceLimits, series::AbstractS
)
end


function diagplot(ax::Makie.Axis, viz::MarginQuantileLines, series::AbstractSeries, colname)
cn = columnnames(series)
if colname cn
return
end
dat = ustrip(disallowmissing(vec(getcolumn(series, colname))))

quantiles = quantile(dat, viz.quantiles)
mid = quantiles[2]
low = mid - quantiles[1]
high = quantiles[3] - mid

Makie.vlines!(
ax,
[mid-low, mid, mid+high];
linestyle=:dash,
depth_shift=-10f0,
delete(NamedTuple(series.kwargs), invalid_attrs_lines2)...,
delete(NamedTuple(viz.kwargs), invalid_attrs_lines2)...,
)
end

function diagplot(ax::Makie.Axis, viz::MarginLines, series::AbstractSeries, colname)
cn = columnnames(series)
if colname cn
Expand Down
3 changes: 1 addition & 2 deletions src/defaults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ const single_series_default_viz = (
),
PairPlots.MarginConfidenceLimits()
)
# const
multi_series_default_viz3 = (
const multi_series_default_viz = (
PairPlots.Scatter(filtersigma=2),
PairPlots.Contour(sigmas=2:2),
PairPlots.Contourf(alpha=0.6,sigmas=1:1),
Expand Down

2 comments on commit 655e8d8

@sefffal
Copy link
Owner Author

Choose a reason for hiding this comment

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

@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/118067

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 v2.9.3 -m "<description of version>" 655e8d8ea1caa0da7f02b04d10d3d6ce152551e8
git push origin v2.9.3

Please sign in to comment.