title: suffix notation in gnuplot kilo mega mili micro nano pico
body: <p>I know how to use suffix notation in gnuplot axis : </p>
  
  <pre><code>set ytics format "%.1s%c"
  </code></pre>
  
  <p>howver that is not taken into account in sprintf ...</p>
  
  <blockquote>
  <pre><code>gnuplot&gt; pr sprintf("%s", 2e+3)
       f_sprintf: attempt to print numeric value with string format
  </code></pre>
  </blockquote>
  
  <p>So I made my own function :</p>
  
  <pre><code>suffixNotation(x)=sprintf("%g%s",\
  (x&gt;=1e+9&amp;&amp;x&lt;1e+12 ) ? x*1e-9 :\
  (x&gt;=1e+6&amp;&amp;x&lt;1e+9 ) ? x*1e-6 :\
  (x&gt;=1e+3&amp;&amp;x&lt;1e+6 ) ? x*1e-3 :\
  (x&gt;=1e-3&amp;&amp;x&lt;1    ) ? x*1e+3 :\
  (x&gt;=1e-6&amp;&amp;x&lt;1e-3 ) ? x*1e+6 :\
  (x&gt;=1e-9&amp;&amp;x&lt;1e-6 ) ? x*1e+9 :\
  (x&gt;=1e-12&amp;&amp;x&lt;1e-9) ? x*1e+12 : x\
  ,\
  (x&gt;=1e+6&amp;&amp;x&lt;1e+12 ) ? "G" :\
  (x&gt;=1e+6&amp;&amp;x&lt;1e+9 ) ? "M" :\
  (x&gt;=1e+3&amp;&amp;x&lt;1e+6 ) ? "k" :\
  (x&gt;=1e-3&amp;&amp;x&lt;1    ) ? "u" :\
  (x&gt;=1e-6&amp;&amp;x&lt;1e-3 ) ? "n" :\
  (x&gt;=1e-9&amp;&amp;x&lt;1e-6 ) ? "p" :\
  (x&gt;=1e-12&amp;&amp;x&lt;1e-9) ? "f" : ""\
  )
  
  # gnuplot&gt; i=4.321e-13 ; while (i&lt;10e6) { pr suffixNotation(i); i=i*10;}
  # 4.321e-13 4.321f 43.21f 432.1f 4.321p 43.21p 432.1p 4.321n 43.21n 432.1n 4.321u 43.21u 432.1u 4.321 43.21 432.1 4.321k 43.21k 432.1k 4.321G
  </code></pre>
  
  <p>Question 1 ? Does anyone knows if this function already exist in gnuplot ?</p>
  
  <p>Question 2 ? Is it planned by gnuplot developer to add it in sprintf ?</p>
  
  <p>Question 3 ? How do we handle 'package' in gnuplot like load("$GNUPLOTPATH/suffixNotation.gp"), I mean properly.</p>