title: Is it possible to plot array data in imshow with a Y-axis that starts off linear but changes to non-linear steps towards the end
body: <p>Firstly, a big thanks to everyone who responds to these questions. I've made it this far without having to ask a question because I find that someone before me has inevitably encountered the same issue.</p>
  <p>However, I find myself with a question that I've not been able to locate. I would like to plot a 2D array within <code>imshow</code> that started off with a linear Y-axis, which I have had to offset and adjust and is now non-linear after a certain point. Is this possible?</p>
  <ul>
  <li>see below for a chart and example.</li>
  </ul>
  <p>The orange line is the original Y-axis step which has a linear and regular step.
  The blue line has been corrected with an offset and a varying step change towards the end. As seen it is linear up to a point before deviating to a non-linear step at the end.</p>
  <p><a href="https://i.stack.imgur.com/sNXxX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sNXxX.png" alt="Original Y-axis vs new Y-axis" /></a></p>
  <p>I am using <code>extent</code> to set the bounds of the axes and as I understand it <code>imshow</code> will plot the data with a regular and linear step between the start and end points. I would like to fix the new (blue) Y-axis reference to the data to be plotted so that the data is presented at the correct position with respect to the Y-Axis value.</p>
  <p>As an example I have the following code:</p>
  <pre><code>testData = np.array([[1,1,1,1], [2,2,2,2], [3,3,3,3], [4,4,4,4]])
  
  x_axisTest = [1,2,3,4]
  y_axisTest = [2,4,8,12]
  
  fig, (ax1) = plt.subplots()
  pcm = ax1.imshow(testData, interpolation='nearest', cmap=cm.jet, origin='upper',
                   aspect='auto', # vmin = 20, vmax = 60,
                   extent =[x_axisTest[0], x_axisTest[3], y_axisTest[3], 
                                  y_axisTest[0]])
  </code></pre>
  <p><a href="https://i.stack.imgur.com/wecph.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wecph.png" alt="example plot" /></a></p>
  <p>As seen the data is linearly plotted even though the Y-axis step changes from 2 (2,4...) to 4 (...8, 12). What I would like is the data to be interpreted or stretched/compressed between Y-axis values 4 to 12 based on the new step value.</p>
  <p>I've been looking into resampling the data which is maybe the preferred option but again I'm not sure how best to apply this and ensure I keep the Y-axis matched with the data. My concern is that I may also shift the linear portion of the data. I would appreciate a nudge in the right direction.</p>
  <p>Thank you in advance for your assistance.</p>