diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index 77d75e92..933afbfa 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -447,7 +447,14 @@ end # IDEA: use functor to only build plot once function _update_plot_object(plt::Plot{PGFPlotsXBackend}) plt.o = PGFPlotsX.TikzDocument() - push!(plt.o, PGFPlotsX.TikzPicture(PGFPlotsX.GroupPlot())) + cols, rows = size(plt.layout.grid) + push!(plt.o, PGFPlotsX.TikzPicture(PGFPlotsX.GroupPlot( + PGFPlotsX.Options( + "group style" => PGFPlotsX.Options( + "group size" => string(cols)*" by "*string(rows) + ) + ) + ))) pushed_colormap = false for sp in plt.subplots diff --git a/test/test_pgfplotsx.jl b/test/test_pgfplotsx.jl index 47f76ccf..748d1739 100644 --- a/test/test_pgfplotsx.jl +++ b/test/test_pgfplotsx.jl @@ -54,7 +54,7 @@ end end # testset @testset "Layout" begin plot(Plots.fakedata(100, 10), layout=4, palette=[:grays :blues :heat :lightrainbow], bg_inside=[:orange :pink :darkblue :black]) - # TODO: add layouting + # TODO: no extra space for outer legends end # testset @testset "Polar plots" begin Θ = range(0, stop=1.5π, length=100) @@ -62,4 +62,22 @@ end plot(Θ, r, proj=:polar, m=2) # TODO: handle polar plots end # testset + @testset "Histogram 2D" begin + histogram2d(randn(10000), randn(10000), nbins=20) + # TODO: totally broken, errors also for pgfplots + end # testset + @testset "Contours" begin + x = 1:0.5:20 + y = 1:0.5:10 + f(x, y) = begin + (3x + y ^ 2) * abs(sin(x) + cos(y)) + end + X = repeat(reshape(x, 1, :), length(y), 1) + Y = repeat(y, 1, length(x)) + Z = map(f, X, Y) + p1 = contour(x, y, f, fill=true) + p2 = contour(x, y, Z) + plot(p1, p2) + # TODO: totally broken, also errors for pgfplots + end # testset end # testset