fix 3d plotting with pyplot

This commit is contained in:
Daniel Schwabeneder 2020-10-07 23:11:51 +02:00
parent ade0a2dfdc
commit f157c8dc3f

View File

@ -1022,15 +1022,27 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
end end
# Set ticks # Set ticks
fontProperties = PyPlot.PyCall.PyDict(Dict("family" => axis[:tickfontfamily], fontProperties = PyPlot.PyCall.PyDict(
"size" => py_thickness_scale(plt, axis[:tickfontsize]), Dict(
# "useTex" => false, "family" => axis[:tickfontfamily],
"rotation" => axis[:tickfontrotation])) "size" => py_thickness_scale(plt, axis[:tickfontsize]),
"rotation" => axis[:tickfontrotation],
)
)
positions = getproperty(ax, Symbol("get_",letter,"ticks"))() positions = getproperty(ax, Symbol("get_",letter,"ticks"))()
pyaxis.set_major_locator(pyticker.FixedLocator(positions)) 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 # workaround to set mathtext.fontspec per Text element
env = "\\mathregular" # matches the outer fonts https://matplotlib.org/tutorials/text/mathtext.html env = "\\mathregular" # matches the outer fonts https://matplotlib.org/tutorials/text/mathtext.html