diff --git a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/MantidQwtIMDWorkspaceData.h b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/MantidQwtIMDWorkspaceData.h
index a59ff3a13f6c4809e9b09dd3722d0fc99bd49d33..9b75c9ffa58d22b8c117eee987d8ecbe8c0ac276 100644
--- a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/MantidQwtIMDWorkspaceData.h
+++ b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/MantidQwtIMDWorkspaceData.h
@@ -62,6 +62,7 @@ public:
 private:
 
   void cacheLinePlot();
+  void calculateMinMax();
   void choosePlotAxis();
 
   friend class MantidMatrixCurve;
@@ -72,9 +73,15 @@ private:
   /// Indicates that the data is plotted on a log y scale
   bool m_logScale;
 
+  /// lowest y value
+  double m_minY;
+
   /// lowest positive y value
   double m_minPositive;
 
+  /// highest y value
+  double m_maxY;
+
   /// Are we in preview mode?
   bool m_preview;
 
diff --git a/Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp b/Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp
index 43d7edfc99864105c18975f94ae5ce61b627e277..1bfe4524224b907966d6809ac9e54ad2f59a8bd5 100644
--- a/Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp
+++ b/Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp
@@ -44,7 +44,7 @@ MantidQwtIMDWorkspaceData::MantidQwtIMDWorkspaceData(Mantid::API::IMDWorkspace_c
     Mantid::API::MDNormalization normalize,
     bool isDistribution)
  : m_workspace(workspace),
-   m_logScale(logScale), m_minPositive(0),
+   m_logScale(logScale),
    m_preview(false),
    m_start(start),
    m_end(end),
@@ -91,12 +91,13 @@ MantidQwtIMDWorkspaceData::MantidQwtIMDWorkspaceData(Mantid::API::IMDWorkspace_c
   m_dir.normalize();
   // And cache the X/Y values
   this->cacheLinePlot();
+
+  this->calculateMinMax();
 }
 
 //-----------------------------------------------------------------------------
 /// Copy constructor
-MantidQwtIMDWorkspaceData::MantidQwtIMDWorkspaceData(const MantidQwtIMDWorkspaceData& data) :
-  m_minPositive(0.0)
+MantidQwtIMDWorkspaceData::MantidQwtIMDWorkspaceData(const MantidQwtIMDWorkspaceData& data)
 {
   this->operator =(data);
 }
@@ -166,6 +167,42 @@ void MantidQwtIMDWorkspaceData::cacheLinePlot()
 //  std::cout << "Plotting from " << m_start << " to " << m_end << std::endl;
 }
 
+//-----------------------------------------------------------------------------
+/// Calculate the MinY and MaxY values
+void MantidQwtIMDWorkspaceData::calculateMinMax()
+{
+  double curMin = m_Y[0];
+  double curMinPos = m_Y[0];
+  double curMax = m_Y[0];
+  for(size_t i = 1; i < m_Y.size(); ++i)
+  {
+    // skip NaNs
+    if ((boost::math::isnan)(m_Y[i]) || (boost::math::isinf)(m_Y[i]))
+      continue;
+
+    // Try and get rid any starting NaNs as soon as possible
+    if ((boost::math::isnan)(curMin) || (boost::math::isinf)(curMin))
+      curMin = m_Y[i];
+    if ((boost::math::isnan)(curMinPos) || (boost::math::isinf)(curMinPos))
+      curMinPos = m_Y[i];
+    if ((boost::math::isnan)(curMax) || (boost::math::isinf)(curMax))
+      curMax = m_Y[i];
+
+    // Update our values as appropriate
+    if (m_Y[i] < curMin)
+        curMin = m_Y[i];
+    if (m_Y[i] < curMinPos && m_Y[i] > 0)
+        curMinPos = m_Y[i];
+    if (m_Y[i] > curMax)
+      curMax = m_Y[i];
+  }
+
+  // Save the results
+  m_minY = curMin;
+  m_minPositive = curMinPos;
+  m_maxY = curMax;
+}
+
 
 //-----------------------------------------------------------------------------
 /** Size of the data set
@@ -201,12 +238,11 @@ double MantidQwtIMDWorkspaceData::x(size_t i) const
 */
 double MantidQwtIMDWorkspaceData::y(size_t i) const
 {
-  Mantid::signal_t tmp = m_Y[i];
-  if (m_logScale && tmp <= 0.)
-  {
-    tmp = m_minPositive;
-  }
-  return tmp;
+  Mantid::signal_t val = m_Y[i];
+  if (m_logScale && val <= 0.)
+    return m_minPositive;
+  else
+    return val;
 }
 
 /// Returns the x position of the error bar for the i-th data point (bin)
@@ -241,20 +277,10 @@ size_t MantidQwtIMDWorkspaceData::esize() const
  */
 double MantidQwtIMDWorkspaceData::getYMin() const
 {
-  double temp = m_Y[0];
-  for(size_t i = 1; i < m_Y.size(); ++i)
-  {
-    if ((boost::math::isnan)(temp) || (boost::math::isinf)(temp))
-      temp = m_Y[i];
-    else if (m_Y[i] < temp && !(boost::math::isnan)(m_Y[i]) &&
-        !(boost::math::isinf)(m_Y[i]))
-      temp = m_Y[i];
-  }
-  if (m_logScale && temp <= 0.)
-  {
-    temp = m_minPositive;
-  }
-  return temp;
+  if (m_logScale)
+    return m_minPositive;
+  else
+    return m_minY;
 }
 
 /**
@@ -263,20 +289,10 @@ double MantidQwtIMDWorkspaceData::getYMin() const
  */
 double MantidQwtIMDWorkspaceData::getYMax() const
 {
-  double temp = m_Y[0];
-  for(size_t i = 1; i < m_Y.size(); ++i)
-  {
-    if ((boost::math::isnan)(temp) || (boost::math::isinf)(temp))
-      temp = m_Y[i];
-    else if (m_Y[i] > temp && !(boost::math::isnan)(m_Y[i]) &&
-        !(boost::math::isinf)(m_Y[i]))
-      temp = m_Y[i];
-  }
-  if (m_logScale && temp <= 0.)
-  {
-    temp = m_minPositive;
-  }
-  return temp;
+  if (m_logScale && m_maxY <= 0)
+    return m_minPositive;
+  else
+    return m_maxY;
 }
 
 void MantidQwtIMDWorkspaceData::setLogScale(bool on)
@@ -493,4 +509,3 @@ QString MantidQwtIMDWorkspaceData::getYAxisLabel() const
   }
   return "Unknown";
 }
-