Skip to content
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
11 changes: 10 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,26 @@ Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"

[extensions]
TabularFunctionsRecipesBaseExt = "RecipesBase"

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

[compat]
Adapt = "4"
Aqua = "0.8"
DocStringExtensions = "0.9"
KernelAbstractions = "0.9"
Plots = "1"
RecipesBase = "1"
Test = "1"
julia = "1"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "Test"]
test = ["Aqua", "Plots", "Test"]
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
TabularFunctions = "7add9882-6fce-4afb-882d-af036a41bc9c"
14 changes: 2 additions & 12 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using Documenter
using Plots
using TabularFunctions

DocMeta.setdocmeta!(TabularFunctions, :DocTestSetup, :(using TabularFunctions); recursive=true)
# meshes_ext = Base.get_extension(Exodus, :ExodusMeshesExt)
# unitful_ext = Base.get_extension(Exodus, :ExodusUnitfulExt)
# recipes_ext = Base.get_extension(TabularFunctions, :TabularFunctionsRecipesBaseExt)
makedocs(;
# modules=[Exodus, meshes_ext, unitful_ext],
modules=[TabularFunctions],
Expand All @@ -18,18 +20,6 @@ makedocs(;
size_threshold=nothing
),
pages=[
# "Exodus" => "index.md",
# "Installation" => "installation.md",
# "Opening Files" => "opening_files.md",
# "Reading Data" => "reading_data.md",
# "Writing Data" => "writing_data.md",
# "Use With MPI" => "use_with_mpi.md",
# "Exodus Methods" => "methods.md",
# "Exodus Types" => "types.md",
# "ExodusMeshesExt" => "meshes_ext.md",
# "ExodusUnitfulExt" => "unitful_ext.md",
# "Glossary" => "glossary.md"
# "README" => "../README.md"
"TabularFunctions" => "index.md"
],
)
Expand Down
11 changes: 11 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ $$
then we can use the maco ```@piecewise_analytic``` to define the above function as follows

```jldoctest analytic
using Plots
using TabularFunctions
func = @piecewise_analytic begin
0.0, x -> x
Expand Down Expand Up @@ -66,6 +67,16 @@ y = func(x)
2.25
```

If you have loaded ```Plots.jl``` or any other plotting package that can leverage ```RecipesBase.jl```, then you can readily plot types in ```TabularFunctions.jl``` using the following syntax (```Plots.jl```)
```jldoctest analytic
xs = -5.:0.01:5. |> collect
p = plot(xs, func)
nothing

# output

```

Note that closures are not necessary in the macro definition. The following is also valid syntax for the ```@piecewise_analytic``` macro
```jldoctest; output=false
using TabularFunctions
Expand Down
16 changes: 16 additions & 0 deletions ext/TabularFunctionsRecipesBaseExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module TabularFunctionsRecipesBaseExt

using RecipesBase
using TabularFunctions

@recipe function f(x, func::TabularFunctions.AbstractTabularFunction)
xlabel --> "x"
ylabel --> "y"

@series begin
seriestype := :path
x, func.(x)
end
end

end # module
4 changes: 3 additions & 1 deletion src/TabularFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ function Base.show(io::IO, ::XsNotMonotonicallyIncreasing)
end

function _monotonic_error()
throw(XsNotMonotonicallyIncreasing())
exc = XsNotMonotonicallyIncreasing()
@show exc
throw(exc)
end

# Abstract types
Expand Down