span><span class="op">)</span><span class="op">)</span> 
    
    <span class="co"># Define function to convert grid graphics coordinates to data coordinates</span>
    <span class="va">new_range_transform</span> <span class="op">&lt;-</span> <span class="kw">function</span><span class="op">(</span><span class="va">x_old</span>, <span class="va">range_old</span>, <span class="va">range_new</span><span class="op">)</span> <span class="op">{</span>
      <span class="op">(</span><span class="va">x_old</span> 