From 59b436d35874d330ef98838105fcc1e71c1564cd Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Tue, 16 Jan 2024 13:28:54 +0100 Subject: [PATCH] add PGFPlotsX imports --- ext/PlotsPGFPlotsXExt/PlotsPGFPlotsXExt.jl | 7 ++++++- ext/PlotsPGFPlotsXExt/initialization.jl | 10 +--------- src/abstract_backend.jl | 8 +++++++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ext/PlotsPGFPlotsXExt/PlotsPGFPlotsXExt.jl b/ext/PlotsPGFPlotsXExt/PlotsPGFPlotsXExt.jl index cc1e7e21f..5da92a197 100644 --- a/ext/PlotsPGFPlotsXExt/PlotsPGFPlotsXExt.jl +++ b/ext/PlotsPGFPlotsXExt/PlotsPGFPlotsXExt.jl @@ -1,6 +1,11 @@ -module PlotsPGFPlotsExt +module PlotsPGFPlotsXExt using PGFPlotsX +using LaTeXStrings: LaTeXString +using UUIDs: uuid4 +using Latexify: Latexify +using Contour: Contour # TODO: this could become its own extension + using Plots: Plots, isijulia, texmath2unicode, straightline_data, shape_data # TODO: eliminate this list using Plots: diff --git a/ext/PlotsPGFPlotsXExt/initialization.jl b/ext/PlotsPGFPlotsXExt/initialization.jl index 29bda4ddf..9328c0535 100644 --- a/ext/PlotsPGFPlotsXExt/initialization.jl +++ b/ext/PlotsPGFPlotsXExt/initialization.jl @@ -26,14 +26,6 @@ end Plots.backend_name(::T) = sym Plots.backend_package_name(::T) = Plots.backend_package_name(sym) -# Maybe this is not needed as PGFPlotsX relies on pkgextensions too -# _pre_imports(::T) = @eval Plots begin -# import LaTeXStrings: LaTeXString -# import UUIDs: uuid4 -# import Latexify -# import Contour -# @require_backend PGFPlotsX -# end const _pgfplotsx_attr = merge_with_base_supported([ :annotations, @@ -226,4 +218,4 @@ end # Plots.supported_attrs(::GRbackend) -> ::Vector{Symbol} # ... # Plots.supported_scales(::GRbackend) -> ::Vector{Symbol} -# ----------------------------------------------------------------------------- \ No newline at end of file +# ----------------------------------------------------------------------------- diff --git a/src/abstract_backend.jl b/src/abstract_backend.jl index 52273230a..2695ddace 100644 --- a/src/abstract_backend.jl +++ b/src/abstract_backend.jl @@ -153,6 +153,12 @@ function unicodeplots(; kw...) end export unicodeplots +function pgfplotsx(; kw...) + default(; reset = false, kw...) + backend(:pgfplotsx) +end +export pgfplotsx + # Consider moving to a macro: # $sym(; kw...) = (default(; reset = false, kw...); backend($T())) @@ -231,4 +237,4 @@ function warn_on_unsupported_scales(pkg::AbstractBackend, plotattributes::AKW) end end end -end \ No newline at end of file +end