From 2ac17afe308afe81db79a2ef6f21161593f98d88 Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Tue, 17 May 2016 10:33:10 -0400 Subject: [PATCH] fixes --- src/args.jl | 7 +++++++ src/backends/pyplot.jl | 31 +++++++------------------------ src/subplots.jl | 10 ++++++---- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/args.jl b/src/args.jl index 43e6542f..ddf25034 100644 --- a/src/args.jl +++ b/src/args.jl @@ -350,6 +350,7 @@ add_aliases(:quiver, :velocity, :quiver2d, :gradient) add_aliases(:normalize, :norm, :normed, :normalized) add_aliases(:aspect_ratio, :aspectratio, :axis_ratio, :axisratio, :ratio) add_aliases(:match_dimensions, :transpose, :transpose_z) +add_aliases(:subplot, :sp, :subplt, :splt) # add all pluralized forms to the _keyAliases dict @@ -925,6 +926,12 @@ function _update_subplot_args(plt::Plot, sp::Subplot, d_in::KW) # update the axis update!(axis, args...; kw...) + + # update the axis colors + color_or_match!(axis.d, :foreground_color_axis, fg) + color_or_match!(axis.d, :foreground_color_border, fg) + color_or_match!(axis.d, :foreground_color_guide, fg) + color_or_match!(axis.d, :foreground_color_text, fg) end end diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 6fd5e6d4..a6c3377e 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -309,22 +309,6 @@ end # --------------------------------------------------------------------------- -# function used_width(sp::Subplot{PyPlotBackend}) -# ax = sp.o -# width(py_bbox_axis(ax,"y")) -# end -# -# function used_height(sp::Subplot{PyPlotBackend}) -# ax = sp.o -# height(py_bbox_axis(ax,"x")) + height(py_bbox_title(ax)) -# end - - -# # bounding box (relative to canvas) for plot area -# function plotarea_bbox(sp::Subplot{PyPlotBackend}) -# crop(bbox(sp), BoundingBox()) -# end - function update_position!(sp::Subplot{PyPlotBackend}) ax = sp.o bb = plotarea_bbox(sp) @@ -336,9 +320,9 @@ function _initialize_subplot(plt::Plot{PyPlotBackend}, sp::Subplot{PyPlotBackend fig = plt.o # add a new axis, and force it to create a new one by setting a distinct label ax = fig[:add_axes]([0,0,1,1], label = string(gensym())) - for axis in (:xaxis, :yaxis) - ax[axis][:_autolabelpos] = false - end + # for axis in (:xaxis, :yaxis) + # ax[axis][:_autolabelpos] = false + # end sp.o = ax end @@ -1031,17 +1015,16 @@ end function updateAxisColors(ax, a::Axis) - guidecolor = getPyPlotColor(a[:foreground_color_guide]) for (loc, spine) in ax[:spines] spine[:set_color](getPyPlotColor(a[:foreground_color_border])) end # for letter in ("x", "y", "z") - axis = axis_symbol(letter, "axis") - if haskey(ax, axis) - ax[:tick_params](axis=letter, which="both", + axissym = symbol(a[:letter], :axis) + if haskey(ax, axissym) + ax[:tick_params](axis=string(a[:letter]), which="both", colors=getPyPlotColor(a[:foreground_color_axis]), labelcolor=getPyPlotColor(a[:foreground_color_text])) - ax[axis][:label][:set_color](guidecolor) + ax[axissym][:label][:set_color](getPyPlotColor(a[:foreground_color_guide])) end # end end diff --git a/src/subplots.jl b/src/subplots.jl index be7168ea..b1a6362e 100644 --- a/src/subplots.jl +++ b/src/subplots.jl @@ -151,20 +151,22 @@ function update_bboxes!(layout::GridLayout) #, parent_bbox::BoundingBox = Boundi # l, b = 0.0, 0.0 rights = zeros(nc) - tops = zeros(nr) + bottoms = ones(nr) for r=1:nr, c=1:nc # compute the child's bounding box relative to the parent child = layout[r,c] usedw, usedh = used_size(child) left = (c == 1 ? 0 : rights[c-1]) - bottom = (r == 1 ? 0 : tops[r-1]) + top = (r == 1 ? 1 : bottoms[r-1]) + # bottom = (r == 1 ? 0 : bottoms[r-1]) right = left + usedw + freew * layout.widths[c] - top = bottom + usedh + freeh * layout.heights[r] + bottom = top - usedh - freeh * layout.heights[r] + # top = bottom + usedh + freeh * layout.heights[r] child_bbox = BoundingBox(left, bottom, right, top) rights[c] = right - tops[r] = top + bottoms[r] = bottom # then compute the bounding box relative to the canvas, and cache it in the child object bbox!(child, crop(bbox(layout), child_bbox))