diff --git a/Project.toml b/Project.toml index 087277df..e8ffda4a 100644 --- a/Project.toml +++ b/Project.toml @@ -47,6 +47,7 @@ ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1" Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0" LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433" +PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925" RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd" @@ -55,4 +56,4 @@ UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228" VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92" [targets] -test = ["FileIO", "GeometryTypes", "Gtk", "ImageMagick", "Images", "LaTeXStrings", "LibGit2", "Random", "RDatasets", "StatsPlots", "Test", "UnicodePlots", "VisualRegressionTests"] +test = ["FileIO", "GeometryTypes", "Gtk", "ImageMagick", "Images", "LaTeXStrings", "LibGit2", "PGFPlotsX", "Random", "RDatasets", "StatsPlots", "Test", "UnicodePlots", "VisualRegressionTests"] diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index 0093e35a..2b7ea449 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -567,18 +567,22 @@ function _update_plot_object(plt::Plot{PGFPlotsXBackend}) end function _show(io::IO, mime::MIME"image/svg+xml", plt::Plot{PGFPlotsXBackend}) + _update_plot_object(plt) show(io, mime, plt.o) end function _show(io::IO, mime::MIME"application/pdf", plt::Plot{PGFPlotsXBackend}) + _update_plot_object(plt) show(io, mime, plt.o) end function _show(io::IO, mime::MIME"image/png", plt::Plot{PGFPlotsXBackend}) + _update_plot_object(plt) show(io, mime, plt.o) end function _show(io::IO, mime::MIME"application/x-tex", plt::Plot{PGFPlotsXBackend}) + _update_plot_object(plt) PGFPlotsX.print_tex(plt.o) end diff --git a/test/runtests.jl b/test/runtests.jl index 55c7e963..16ad485f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -8,6 +8,8 @@ using Gtk using LibGit2 using GeometryTypes +include("test_pgfplotsx.jl") + reference_dir(args...) = joinpath(homedir(), ".julia", "dev", "PlotReferenceImages", args...) function reference_file(backend, i, version) diff --git a/test/test_pgfplotsx.jl b/test/test_pgfplotsx.jl new file mode 100644 index 00000000..a46a0a35 --- /dev/null +++ b/test/test_pgfplotsx.jl @@ -0,0 +1,13 @@ +using Plots, Test +pgfplotsx() + +function create_plot( args...; kwargs... ) + pgfx_plot = plot(args..., kwargs...) + return pgfx_plot, repr("application/x-tex", pgfx_plot) +end + +@testset "PGFPlotsX" begin + pgfx_plot, pgfx_tex = create_plot(1:5) + + @test pgfx_plot.o isa PGFPlotsX.GroupPlot +end # testset