Merge pull request #3047 from daschw:pyplot-3d

Fix 3d plotting with pyplot
This commit is contained in:
Daniel Schwabeneder 2020-10-07 23:20:28 +02:00 committed by GitHub
commit 2ef13c19ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 7 deletions

View File

@ -1,7 +1,7 @@
name = "Plots"
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
author = ["Tom Breloff (@tbreloff)"]
version = "1.6.9"
version = "1.6.10"
[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

View File

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