title: qwt/pyqt custom scale for image plot (pixel to mm conversion)
body: <p>I've decided to use <a href="https://pythonhosted.org/guiqwt/" rel="nofollow">guiqwt</a> as my main plot library in Python and it works quite well. However, I'm missing a contour plot feature, so I had to work out my own contours in my image plots. That was quite easy by using scikit. Now I have my plot showing the image and the contours on top. Scale unit in x and y-direction is pixel as the image raw data is given per pixel and the calculated contours as well.</p>
  
  <p>My problem is to convert the pixel-scale into e. g. mm-scale without scaling the image. I want to replace the original scale with a scale that represents the measured distances. The distances are available in an array.</p>
  
  <p>In my first attempt I tried to change the <a href="http://qwt.sourceforge.net/class_qwt_scale_div.html#details" rel="nofollow">AxisScaleDivision</a> by creating a new one and using QwtPlot::setAxisScaleDiv. But that seems to work like a zoom-function as the image is reduced to the new interval.</p>
  
  <p>Here is my code for a small example:</p>
  
  <pre><code>from guiqwt.plot import ImageDialog
  from guiqwt.builder import make
  from skimage import measure
  import numpy as np
  
  data = np.random.rand(80,30)
  
  contours = measure.find_contours(data, 0.1)
  
  win = ImageDialog(edit=False, toolbar=True, wintitle="Contrast test", 
      options=dict(show_contrast=True))
  
  img = make.image(data)
  
  plot = win.get_plot()
  plot.add_item(img)
  
  for n, contour in enumerate(contours):
      curve = make.curve(contour[:, 1], contour[:, 0], 'k-')
      plot.add_item(curve)
  
  win.show()
  
  scaleEng = plot.axisScaleEngine(2)
  scaleDiv = scaleEng.divideScale(20, 30, 5, 5, 0)
  
  plot.setAxisScaleDiv(2, scaleDiv)
  plot.replot()
  </code></pre>
  
  <p>The syntax is very close to qwt, so I think anybody who is familiar with qwt might be able to help me :)</p>
  
  <p>The image zoom should stay unaltered. Only the axis should be recalculated to a mm-scale and afterwards, of course, adapted when the zoom function is used.</p>