diff --git a/src/args.jl b/src/args.jl index c9e0a039..6d279a42 100644 --- a/src/args.jl +++ b/src/args.jl @@ -203,6 +203,7 @@ _plotDefaults[:grid] = true _plotDefaults[:annotation] = nothing # annotation tuple(s)... (x,y,annotation) _plotDefaults[:overwrite_figure] = false _plotDefaults[:polar] = false +_plotDefaults[:aspect_ratio] = :none # choose from :none or :equal # TODO: x/y scales @@ -329,6 +330,7 @@ add_aliases(:xerror, :xerr, :xerrorbar) add_aliases(:yerror, :yerr, :yerrorbar, :err, :errorbar) add_aliases(:quiver, :velocity, :quiver2d, :gradient) add_aliases(:normalize, :norm, :normed, :normalized) +add_aliases(:aspect_ratio, :aspectratio, :axis_ratio, :axisratio, :ratio) # add all pluralized forms to the _keyAliases dict diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 8466720e..ed213f81 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -824,6 +824,12 @@ function _update_plot(plt::Plot{PyPlotBackend}, d::KW) 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 diff --git a/src/backends/supported.jl b/src/backends/supported.jl index fccef3e6..0797ca27 100644 --- a/src/backends/supported.jl +++ b/src/backends/supported.jl @@ -104,7 +104,7 @@ supportedArgs(::PyPlotBackend) = [ :orientation, :overwrite_figure, :polar, - :normalize, :weights, :contours + :normalize, :weights, :contours, :aspect_ratio ] supportedAxes(::PyPlotBackend) = _allAxes supportedTypes(::PyPlotBackend) = [