Mercurial > octave
changeset 28784:9d7f90354b4f stable
subplot.m: Use layout and index to search existing axes (bug #59076)
* subplot.m: Use __subplotrcn__ appdata (layout and index) to decide if
an axes should be reused.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Mon, 07 Sep 2020 21:59:10 +0200 |
parents | 0ee399c4659c |
children | 02c2d6500c1f 396d3e1df78b |
files | scripts/plot/util/subplot.m |
diffstat | 1 files changed, 6 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/subplot.m Tue Sep 22 19:42:16 2020 +0200 +++ b/scripts/plot/util/subplot.m Mon Sep 07 21:59:10 2020 +0200 @@ -249,15 +249,12 @@ continue; endif - if (isappdata (child, "__subplotposition__")) - objpos = getappdata (child, "__subplotposition__"); - else - objpos = get (child, "position"); - endif - if (all (abs (objpos - pos) < eps) && ! replace_axes) - ## If the new axes are in exactly the same position - ## as an existing axes object, or if they share the same - ## appdata "__subplotposition__", use the existing axes. + ## Check if this axes is a subplot with the same layout and + ## index as the requested one + rcn = getappdata (child, "__subplotrcn__"); + + if (! replace_axes && all (size (rcn) == [1 3]) + && rcn{1} == rows && rcn{2} == cols && all (rcn{3} == index)) found = true; hsubplot = child; else