# HG changeset patch # User John W. Eaton # Date 1328369390 18000 # Node ID a646cee995cf1c672b7e714456bd5c47739b0982 # Parent 45f5a5d5656fd30b527cab87e7464f13ed27eb69 disable zoom-box zooming for negative log scales; enable zooming for positive log scales * graphics.cc (axes::properties::zoom): Disable zooming if either axis is log and negative. (axes::properties::zoom_about_point): Enable zooming for positive log scale axes. diff --git a/src/graphics.cc b/src/graphics.cc --- a/src/graphics.cc +++ b/src/graphics.cc @@ -6463,10 +6463,10 @@ double max_neg_y = -octave_Inf; get_children_limits (miny, maxy, min_pos_y, max_neg_y, kids, 'y'); - if (! xscale_is ("log")) + if (! (xscale_is ("log") && xlims(0) < 0 && xlims(1) < 0)) xlims = do_zoom (x, factor, xlims, xscale_is ("log")); - if (! yscale_is ("log")) + if (! (yscale_is ("log") && ylims(0) < 0 && ylims(1) < 0)) ylims = do_zoom (y, factor, ylims, yscale_is ("log")); zoom (xlims, ylims, push_to_zoom_stack); @@ -6475,6 +6475,14 @@ void axes::properties::zoom (const Matrix& xl, const Matrix& yl, bool push_to_zoom_stack) { + // FIXME: Do we need error checking here? + Matrix xlims = get_xlim ().matrix_value (); + Matrix ylims = get_ylim ().matrix_value (); + + if ((xscale_is ("log") && xlims(0) < 0 && xlims(1) < 0) + || (yscale_is ("log") && ylims(0) < 0 && ylims(1) < 0)) + return; + if (push_to_zoom_stack) { zoom_stack.push_front (xlimmode.get ());