This commit is contained in:
Thomas Breloff 2016-05-17 10:33:10 -04:00
parent 3084b0c41c
commit 2ac17afe30
3 changed files with 20 additions and 28 deletions

View File

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

View File

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

View File

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