title: Avoid interpolation of discontinuities for periodic data
body: <p>I have a complex-valued data file and I want to plot the phase information separate from the absolute values in a flat pm3d plot. I defined a cyclic color palette between <code>-pi</code> and <code>pi</code> like this</p>
  
  <pre><code>set palette model HSV
  set palette define (-pi 0 1 1, pi 1 1 1)
  set palette maxcolors 1000
  </code></pre>
  
  <p>i.e. I assign the two 'reds' on the rim of the HSV color wheel to the end points of the phase domain (±pi). I then go about to plot the data like this:</p>
  
  <pre><code>set pm3d map
  set cbrange [-pi:pi]
  splot 'datafile' w pm3d
  </code></pre>
  
  <p>The result looks like this:
  <a href="https://i.stack.imgur.com/zzeCz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zzeCz.png" alt="Phase plot with apparent discontinuity at +/- pi"></a></p>
  
  <p>As you can see, there is an artifact in places where the phase value jumps from -pi to pi as the plot algorithm interpolates the two opposite values, yielding a color close to 0 (cyan). Is there a way to avoid this artifact <em>from within gnuplot</em>? Of course, I could always manipulate the data in a way that avoids a discontinuity and assigns phases outside the standard <code>[-pi:pi]</code> domain but I'd rather not.</p>
  
  <hr>
  
  <p><strong>EDIT:</strong>
  You can reproduce a plot similar to the above one with a function instead of a data file:</p>
  
  <pre><code>I = {0,1}
  set xrange [0:3]
  set yrange [0:3]
  set isosample 100
  splot arg(exp(I*x*y)) w pm3d
  </code></pre>