respect layout

This commit is contained in:
Simon Christ 2019-11-19 17:30:26 +01:00
parent 10e7cb8eba
commit 66e8f6615e
2 changed files with 27 additions and 2 deletions

View File

@ -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

View File

@ -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