title: Using Gnuplot to plot point colors conditionally
body: <p>I have a file with four columns of data. I am using just the first three to plot a 3D plot and do not need the fourth one right now.</p>
  
  <p>I want to know how to change the color of a point if it meets certain conditions. For example, if a point's values <strong><em>(x,y,z)</em></strong> are greater than <strong><em>(16,400,65)</em></strong>, I want to plot it in grey. If they are lesser than that, I want to use red.</p>
  
  <p>I am trying to use <code>awk</code> for the same and it plots just two points in a different color. Here is my code.</p>
  
  <pre><code>gnuplot&gt;splot "&lt; awk '{if( ($2 &gt; \"16\") || ($1 &gt; \"400\") || ($3 &gt; \"65\"))  print}'                                       
  ./8_77_non_pareto_data.dat " u 2:1:3 w p pt 8 lc rgb "grey", \
  "&lt; awk '{if( ($2 &lt; \"16\") || ($1 &lt; \"400\") || ($3 &lt; \"65\"))  print}' 
  ./8_77_non_pareto_data.dat " u 2:1:3 w p pt 8 lc rgb "red", \
  "./8_77_pareto_data.dat" u 2:1:3 w i lt 1 lc rgb "blue" t "Pareto points"
  </code></pre>
  
  <p>My data file looks like this:</p>
  
  <pre><code>48      15.057599573464184      68      361
  93      14.950459657063462      73      361
  48      14.065204842090914      69      361
  280     13.16320458043516       69      361
  120     15.05281009307949       66      361
  48      15.133322961840786      59      361
  48      16.161631503473544      73      361
  470     17.763180586730847      77      361
  </code></pre>
  
  <p>X axis ranges from 6 to 22.</p>
  
  <p>Y-axis ranges from 0 to 500.</p>
  
  <p>Z-axis ranges from 35 to 85.</p>
  
  <p>I would like to visualize this as having a bounding box around <strong><em>(16,400,65)</em></strong> in a three dimensional way. Anything inside the box is red, anything outside it is grey.</p>
  
  <p>Hope someone can help me here.</p>
  
  <p>P.S : The blue points are printing just fine and though the sample data here does not show some conditions being met, there are points that meet that condition. I did not post the whole file here.</p>