fixes
This commit is contained in:
parent
3084b0c41c
commit
2ac17afe30
@ -350,6 +350,7 @@ 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_aliases(:aspect_ratio, :aspectratio, :axis_ratio, :axisratio, :ratio)
|
||||||
add_aliases(:match_dimensions, :transpose, :transpose_z)
|
add_aliases(:match_dimensions, :transpose, :transpose_z)
|
||||||
|
add_aliases(:subplot, :sp, :subplt, :splt)
|
||||||
|
|
||||||
|
|
||||||
# add all pluralized forms to the _keyAliases dict
|
# 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 the axis
|
||||||
update!(axis, args...; kw...)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -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})
|
function update_position!(sp::Subplot{PyPlotBackend})
|
||||||
ax = sp.o
|
ax = sp.o
|
||||||
bb = plotarea_bbox(sp)
|
bb = plotarea_bbox(sp)
|
||||||
@ -336,9 +320,9 @@ function _initialize_subplot(plt::Plot{PyPlotBackend}, sp::Subplot{PyPlotBackend
|
|||||||
fig = plt.o
|
fig = plt.o
|
||||||
# add a new axis, and force it to create a new one by setting a distinct label
|
# 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()))
|
ax = fig[:add_axes]([0,0,1,1], label = string(gensym()))
|
||||||
for axis in (:xaxis, :yaxis)
|
# for axis in (:xaxis, :yaxis)
|
||||||
ax[axis][:_autolabelpos] = false
|
# ax[axis][:_autolabelpos] = false
|
||||||
end
|
# end
|
||||||
sp.o = ax
|
sp.o = ax
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1031,17 +1015,16 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function updateAxisColors(ax, a::Axis)
|
function updateAxisColors(ax, a::Axis)
|
||||||
guidecolor = getPyPlotColor(a[:foreground_color_guide])
|
|
||||||
for (loc, spine) in ax[:spines]
|
for (loc, spine) in ax[:spines]
|
||||||
spine[:set_color](getPyPlotColor(a[:foreground_color_border]))
|
spine[:set_color](getPyPlotColor(a[:foreground_color_border]))
|
||||||
end
|
end
|
||||||
# for letter in ("x", "y", "z")
|
# for letter in ("x", "y", "z")
|
||||||
axis = axis_symbol(letter, "axis")
|
axissym = symbol(a[:letter], :axis)
|
||||||
if haskey(ax, axis)
|
if haskey(ax, axissym)
|
||||||
ax[:tick_params](axis=letter, which="both",
|
ax[:tick_params](axis=string(a[:letter]), which="both",
|
||||||
colors=getPyPlotColor(a[:foreground_color_axis]),
|
colors=getPyPlotColor(a[:foreground_color_axis]),
|
||||||
labelcolor=getPyPlotColor(a[:foreground_color_text]))
|
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
|
# end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -151,20 +151,22 @@ function update_bboxes!(layout::GridLayout) #, parent_bbox::BoundingBox = Boundi
|
|||||||
|
|
||||||
# l, b = 0.0, 0.0
|
# l, b = 0.0, 0.0
|
||||||
rights = zeros(nc)
|
rights = zeros(nc)
|
||||||
tops = zeros(nr)
|
bottoms = ones(nr)
|
||||||
for r=1:nr, c=1:nc
|
for r=1:nr, c=1:nc
|
||||||
# compute the child's bounding box relative to the parent
|
# compute the child's bounding box relative to the parent
|
||||||
child = layout[r,c]
|
child = layout[r,c]
|
||||||
usedw, usedh = used_size(child)
|
usedw, usedh = used_size(child)
|
||||||
|
|
||||||
left = (c == 1 ? 0 : rights[c-1])
|
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]
|
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)
|
child_bbox = BoundingBox(left, bottom, right, top)
|
||||||
|
|
||||||
rights[c] = right
|
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
|
# then compute the bounding box relative to the canvas, and cache it in the child object
|
||||||
bbox!(child, crop(bbox(layout), child_bbox))
|
bbox!(child, crop(bbox(layout), child_bbox))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user