Merge pull request #3074 from daschw/gr-guides

fix guide position in 3d plots in GR
This commit is contained in:
Daniel Schwabeneder 2020-10-17 09:08:58 +02:00 committed by GitHub
commit c7955420e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -1451,7 +1451,8 @@ function gr_label_axis_3d(sp, letter)
x_offset = -gr_axis_width(sp, ax) x_offset = -gr_axis_width(sp, ax)
y_offset = 0 y_offset = 0
end end
gr_text(x + x_offset, y - y_offset, ax[:guide]) letter === :z && GR.setcharup(-1, 0)
gr_text(x + x_offset, y + y_offset, ax[:guide])
GR.restorestate() GR.restorestate()
end end
end end

View File

@ -1048,6 +1048,25 @@ const _examples = PlotExample[
heatmap(z, projection = :polar) heatmap(z, projection = :polar)
end] 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 # Some constants for PlotDocs and PlotReferenceImages