From 2be5756cb86695d8b0ed6d682654d19f7c25b998 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Fri, 16 Oct 2020 18:19:31 +0200 Subject: [PATCH 1/3] fix guide position in 3d plots in GR --- src/backends/gr.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 5e1c6785..9ac117b1 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -1451,7 +1451,7 @@ function gr_label_axis_3d(sp, letter) x_offset = -gr_axis_width(sp, ax) y_offset = 0 end - gr_text(x + x_offset, y - y_offset, ax[:guide]) + gr_text(x + x_offset, y + y_offset, ax[:guide]) GR.restorestate() end end From 2a09bd8266bbe2ce83b153765ba174db7b7d44b0 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Fri, 16 Oct 2020 18:35:47 +0200 Subject: [PATCH 2/3] fix z axis rotation --- src/backends/gr.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 9ac117b1..9cf15144 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -1451,6 +1451,7 @@ function gr_label_axis_3d(sp, letter) x_offset = -gr_axis_width(sp, ax) y_offset = 0 end + letter === :z && GR.setcharup(-1, 0) gr_text(x + x_offset, y + y_offset, ax[:guide]) GR.restorestate() end From 072b6f42f65f9722db7936caad687fafb0d39155 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Sat, 17 Oct 2020 08:35:49 +0200 Subject: [PATCH 3/3] add test example --- src/examples.jl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/examples.jl b/src/examples.jl index 1b44c11b..3273b93b 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -1048,6 +1048,25 @@ const _examples = PlotExample[ heatmap(z, projection = :polar) end] ), + PlotExample( # 50 + "3D surface with axis guides", + "", + [quote + f(x,a) = 1/x + a*x^2 + xs = collect(0.1:0.05:2.0); + as = collect(0.2:0.1:2.0); + + x_grid = [x for x in xs for y in as]; + a_grid = [y for x in xs for y in as]; + + plot(x_grid, a_grid, f.(x_grid,a_grid), + st = :surface, + xlabel = "longer xlabel", + ylabel = "longer ylabel", + zlabel = "longer zlabel", + ) + end] + ), ] # Some constants for PlotDocs and PlotReferenceImages