From f157c8dc3f37b155f54344b137d357397453ffff Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Wed, 7 Oct 2020 23:11:51 +0200 Subject: [PATCH] fix 3d plotting with pyplot --- src/backends/pyplot.jl | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index c039d3b2..8b18365a 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -1022,15 +1022,27 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend}) end # Set ticks - fontProperties = PyPlot.PyCall.PyDict(Dict("family" => axis[:tickfontfamily], - "size" => py_thickness_scale(plt, axis[:tickfontsize]), - # "useTex" => false, - "rotation" => axis[:tickfontrotation])) - + fontProperties = PyPlot.PyCall.PyDict( + Dict( + "family" => axis[:tickfontfamily], + "size" => py_thickness_scale(plt, axis[:tickfontsize]), + "rotation" => axis[:tickfontrotation], + ) + ) positions = getproperty(ax, Symbol("get_",letter,"ticks"))() pyaxis.set_major_locator(pyticker.FixedLocator(positions)) - getproperty(ax, Symbol("set_",letter,"ticklabels"))(positions, fontdict=fontProperties) + if RecipesPipeline.is3d(sp) + getproperty(ax, Symbol("set_",letter,"ticklabels"))( + positions; + (Symbol(k) => v for (k, v) in fontProperties)... + ) + else + getproperty(ax, Symbol("set_",letter,"ticklabels"))( + positions, + fontdict=fontProperties, + ) + end # workaround to set mathtext.fontspec per Text element env = "\\mathregular" # matches the outer fonts https://matplotlib.org/tutorials/text/mathtext.html