diff --git a/Code/Mantid/MantidPlot/src/Graph.cpp b/Code/Mantid/MantidPlot/src/Graph.cpp index 11cf2bcd77ad263dd7303d1cd2f82d5ac6cd41ee..1beb028565aaa6524822f812f1af6d7d0b640015 100644 --- a/Code/Mantid/MantidPlot/src/Graph.cpp +++ b/Code/Mantid/MantidPlot/src/Graph.cpp @@ -1367,7 +1367,8 @@ void Graph::setAxisScale(int axis, double start, double end, int type, double st } else if (type == GraphOptions::Power) { - if (start <= 0 && sc_engine->nthPower() < 0) + double const nth_power = sc_engine->nthPower(); + if (start <= 0 && nth_power < 0) { double s_min = DBL_MAX; // for the y axis rely on the bounding rects @@ -1409,6 +1410,18 @@ void Graph::setAxisScale(int axis, double start, double end, int type, double st end = 0.01 * start; } } + // If n is +ve even integer then negative scale values are not valid + // so set start of axis to 0 + if (start < 0 && + std::floor(nth_power) == nth_power && + (long)nth_power % 2 == 0) + { + start = 0; + if (end < 0) + { + end = 1; + } + } } if (axis == QwtPlot::yRight)