title: Gnuplot: CSV and Date on X-Axis
body: <p>I want to plot cryptocurrency data which is stored in a CSV file.</p>
  
  <p>This is what the CSV file looking at the moment:</p>
  
  <pre><code>Date,Total,XMR,ETH,BTC,BCH
  2018-01-20 14:28:09,-48.31496473496111,-2.618473974057121,9.759254879456023,-32.73371338624,-22.72203225412001
  2018-01-20 14:32:42,-48.70059864440001,-2.6060653245296663,9.414353657705647,-32.67846583748799,-22.830421140088
  2018-01-20 14:35:22,-48.63036074628374,-2.5440902562853935,9.414353657705647,-32.67846583748799,-22.822158310216004
  2018-01-20 14:39:31,-48.541251796683724,-2.5440902562853935,9.414353657705647,-32.58935688788797,-22.822158310216004
  </code></pre>
  
  <p>This is my gnuplot script so far:</p>
  
  <pre><code>set key inside bottom right
  set title 'Revenues'
  set datafile separator ','
  set ylabel 'EUR'
  set grid
  plot for [col=2:5] "data.txt" using 0:col with lines lw 2 title columnheader
  </code></pre>
  
  <p>This is what the result looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/qDpWb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qDpWb.png" alt="enter image description here"></a></p>
  
  <p>But as you can see in the first column, every data set has a date which I also want to use. It should appear as the x axis label in a shorter form (e.g. 18/20/01) and the axis should also scale correctly.</p>
  
  <p>My approach was this:</p>
  
  <pre><code>set xtics rotate
  set timefmt '%Y-%m-%d %H-%M-%S'
  set format x "%d-%m"
  set xdata time
  plot for [col=2:5] "data.txt" using 0:col:xtic(1) with lines lw 2 title columnheader
  </code></pre>
  
  <p>...which results in...</p>
  
  <p><a href="https://i.stack.imgur.com/ylQii.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ylQii.png" alt="enter image description here"></a></p>
  
  <p>As you can see, the label for the x axis is the correct column but it's neither the format I want nor it's scaled (mention that I changed the last date to 2019).</p>
  
  <p>Can you tell me how I can achieve this?</p>