added aspect_ratio keyword and implemented in pyplot

This commit is contained in:
Thomas Breloff 2016-04-26 15:35:26 -04:00
parent 8d6974f67d
commit 5dfd3d2f5d
3 changed files with 9 additions and 1 deletions

View File

@ -203,6 +203,7 @@ _plotDefaults[:grid] = true
_plotDefaults[:annotation] = nothing # annotation tuple(s)... (x,y,annotation) _plotDefaults[:annotation] = nothing # annotation tuple(s)... (x,y,annotation)
_plotDefaults[:overwrite_figure] = false _plotDefaults[:overwrite_figure] = false
_plotDefaults[:polar] = false _plotDefaults[:polar] = false
_plotDefaults[:aspect_ratio] = :none # choose from :none or :equal
# TODO: x/y scales # TODO: x/y scales
@ -329,6 +330,7 @@ add_aliases(:xerror, :xerr, :xerrorbar)
add_aliases(:yerror, :yerr, :yerrorbar, :err, :errorbar) add_aliases(:yerror, :yerr, :yerrorbar, :err, :errorbar)
add_aliases(:quiver, :velocity, :quiver2d, :gradient) add_aliases(:quiver, :velocity, :quiver2d, :gradient)
add_aliases(:normalize, :norm, :normed, :normalized) add_aliases(:normalize, :norm, :normed, :normalized)
add_aliases(:aspect_ratio, :aspectratio, :axis_ratio, :axisratio, :ratio)
# add all pluralized forms to the _keyAliases dict # add all pluralized forms to the _keyAliases dict

View File

@ -824,6 +824,12 @@ function _update_plot(plt::Plot{PyPlotBackend}, d::KW)
end end
end end
end end
# do we want to change the aspect ratio?
aratio = get(d, :aspect_ratio, :none)
if aratio != :none
ax[:set_aspect](isa(aratio, Symbol) ? string(aratio) : aratio, anchor = "C")
end
end end

View File

@ -104,7 +104,7 @@ supportedArgs(::PyPlotBackend) = [
:orientation, :orientation,
:overwrite_figure, :overwrite_figure,
:polar, :polar,
:normalize, :weights, :contours :normalize, :weights, :contours, :aspect_ratio
] ]
supportedAxes(::PyPlotBackend) = _allAxes supportedAxes(::PyPlotBackend) = _allAxes
supportedTypes(::PyPlotBackend) = [ supportedTypes(::PyPlotBackend) = [