Skip to content

Commit

Permalink
move plot support to package extension
Browse files Browse the repository at this point in the history
  • Loading branch information
daanhb committed Sep 20, 2024
1 parent c816339 commit 7f8d134
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- '1.9'
- '1'
os:
- ubuntu-latest
Expand Down
17 changes: 10 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FrameFun"
uuid = "bbafa164-4497-5d18-87cf-33e911f89480"
authors = ["daanhb,roelmatthysen,marcusdavidwebb,vincentcp"]
version = "0.5.6"
version = "0.5.7"

[deps]
BasisFunctions = "4343a256-5453-507d-8aad-01a9d7189916"
Expand All @@ -15,17 +15,21 @@ InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LowRankApprox = "898213cb-b102-5a47-900c-97e73b919f73"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[weakdeps]
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"

[extensions]
FrameFunRecipesBaseExt = "RecipesBase"

[compat]
BasisFunctions = "0.6.4"
BasisFunctions = "0.6.5"
CompositeTypes = "0.1.3"
DomainSets = "0.7"
FillArrays = "0.13,1"
Expand All @@ -34,13 +38,12 @@ GenericLinearAlgebra = "0.3"
GridArrays = "0.2.2"
LowRankApprox = "0.5"
MacroTools = "0.5"
PGFPlotsX = "1.4"
QuadGK = "2.4"
RecipesBase = "1.0"
Reexport = "1.0"
SpecialFunctions = "1.0, 2.0"
StaticArrays = "1.4"
julia = "1.7"
julia = "1.9"

[extras]
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
Expand All @@ -51,4 +54,4 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Calculus", "Conda", "GR", "Plots", "Random", "Test"]
test = ["Calculus", "Conda", "GR", "Plots", "Random", "RecipesBase", "Test"]
8 changes: 8 additions & 0 deletions ext/FrameFunRecipesBaseExt/FrameFunRecipesBaseExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module FrameFunRecipesBaseExt

using FrameFun, RecipesBase
using FrameFun: AbstractFun

@recipe f(::Type{<:AbstractFun}, F::AbstractFun) = expansion(F)

end
4 changes: 2 additions & 2 deletions src/FrameFun.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module FrameFun

using FillArrays, GridArrays, StaticArrays
using LinearAlgebra, LowRankApprox
using Printf, RecipesBase, Reexport
using Printf, Reexport
using SpecialFunctions
using DomainSets
using QuadGK
Expand Down Expand Up @@ -46,7 +46,7 @@ include("applications/high_dimensional.jl")
include("generic/adaptivity.jl")
include("generic/funs.jl")

include("recipes.jl")
include("util/plot.jl")

export chebvariable, chebvariables,
funvariable, funvariables
Expand Down
14 changes: 0 additions & 14 deletions src/recipes.jl

This file was deleted.

14 changes: 14 additions & 0 deletions src/util/plot.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

import BasisFunctions:
plotgrid,
plot_postprocess

# Postprocessing when the set is a frame: set values outside the domain to NaN
function plot_postprocess(D::Domain, grid, vals, value=NaN)
mgrid = GridArrays.MaskedGrid(grid, D)
vals[.!(mask(mgrid))] .= value
vals
end
plot_postprocess(B::ExtensionFrame, args...) = plot_postprocess(support(B), args...)
# Plotgrids are determined by the underlying set
plotgrid(B::ExtensionFrame, n) = plotgrid(basis(B),n)

2 comments on commit 7f8d134

@daanhb
Copy link
Member Author

@daanhb daanhb commented on 7f8d134 Sep 20, 2024

Choose a reason for hiding this comment

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

@JuliaRegistrator register

Release notes:

  • move plot support to package extension conditional on loading RecipesBase

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

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.5.7 -m "<description of version>" 7f8d13446d3277df0e0226d3685befa35c925a48
git push origin v0.5.7

Please sign in to comment.