Plot Packages
Example to define the plot package to be used:
using SignalTables
usePlotPackage("PyPlot") # or ENV["SignalTablesPlotPackage"] = "PyPlot"The following plot packages are supported:
"PyPlot"(PyPlot plots with Matplotlib from Python; via SignalTablesInterface_PyPlot.jl),"GLMakie"(GLMakie provides interactive plots in an OpenGL window; via SignalTablesInterface_GLMakie.jl),"WGLMakie"(WGLMakie provides interactive plots in a browser window; via SignalTablesInterface_WGLMakie.jl),"CairoMakie"(CairoMakie provides static plots on file with publication quality; via SignalTablesInterface_CairoMakie.jl)."SilentNoPlot"(= all plot calls are silently ignored).
Typically, runtests.jl is defined as:
using SignalTables
usePlotPackage("SilentNoPlot") # Define Plot Package (previously defined one is put on a stack)
include("include_all.jl") # Include all tests that use a plot package
usePreviousPlotPackage() # Use previously defined Plot packageThe following functions are provided to define/inquire the current plot package.
SignalTables.jl exports all symbols of this table.
Modia.jl reexports all symbols.
| Plot package functions | Description |
|---|---|
@usingPlotPackage | Expands into using PlotPackage_<PlotPackageName> |
usePlotPackage | Define the plot package to be used. |
usePreviousPlotPackage | Define the previously defined plot package to be used. |
currentPlotPackage | Return name defined with usePlotPackage |
SignalTables.@usingPlotPackage — Macro@usingPlotPackage()Execute using XXX, where XXX is the Plot package that was activated with usePlotPackage(plotPackage).
SignalTables.usePlotPackage — FunctionusePlotPackage(plotPackage::String)Define the plot package that shall be used by command @usingPlotPackage. If a PlotPackage package is already defined, save it on an internal stack (can be reactivated with usePreviousPlotPackage().
Possible values for plotPackage:
"PyPlot""GLMakie""WGLMakie""CairoMakie""SilentNoPlot"
Example
using SignalTables
usePlotPackage("GLMakie")
module MyTest
using SignalTables
@usingPlotPackage
t = range(0.0, stop=10.0, length=100)
result = Dict{String,Any}("time" => t, "phi" => sin.(t))
plot(result, "phi") # use GLMakie for the rendering
endSignalTables.usePreviousPlotPackage — FunctionusePreviousPlotPackage()Pop the last saved PlotPackage package from an internal stack and call usePlotPackage(<popped PlotPackage package>).
SignalTables.currentPlotPackage — FunctioncurrentPlotPackage()Return the name of the plot package as a string that was defined with usePlotPackage. For example, the function may return "GLMakie", "PyPlot" or "NoPlot" or or "", if no PlotPackage is defined.