From 279ef2075fb963e72409470c9e1e711be52fac00 Mon Sep 17 00:00:00 2001 From: Godisemo Date: Thu, 13 Sep 2018 11:22:49 +0200 Subject: [PATCH] Add option to change guide positions in pyplot --- src/args.jl | 1 + src/backends/pyplot.jl | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/args.jl b/src/args.jl index 8a3e92b1..1065f12e 100644 --- a/src/args.jl +++ b/src/args.jl @@ -350,6 +350,7 @@ const _subplot_defaults = KW( const _axis_defaults = KW( :guide => "", + :guide_position => :auto, :lims => :auto, :ticks => :auto, :scale => :identity, diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index f6fc6ee4..4524e967 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -14,7 +14,7 @@ const _pyplot_attr = merge_with_base_supported([ :bins, :bar_width, :bar_edges, :bar_position, :title, :title_location, :titlefont, :window_title, - :guide, :lims, :ticks, :scale, :flip, :rotation, + :guide, :guide_position, :lims, :ticks, :scale, :flip, :rotation, :titlefontfamily, :titlefontsize, :titlefontcolor, :legendfontfamily, :legendfontsize, :legendfontcolor, :tickfontfamily, :tickfontsize, :tickfontcolor, @@ -1053,6 +1053,9 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend}) pyaxis[:set_ticks_position]("both") # the hash marks pyaxis[Symbol(:tick_, pos)]() # the tick labels end + if axis[:guide_position] != :auto && letter != :z + pyaxis[:set_label_position](axis[:guide_position]) + end py_set_scale(ax, axis) axis[:ticks] != :native ? py_set_lims(ax, axis) : nothing if ispolar(sp) && letter == :y