GnuPlot auto set xlabel (or ylabel), reading from column head of CSV file
<p>In GnuPlot, I can auto set a plot legend with <code>title columnhead</code> option in a plot command like:</p>

<pre><code>plot 'test.txt' using 0:1 w linespoints title columnhead
</code></pre>

<p>So it reads the column name from the CSV file and use it in the legend.</p>

<p><a href="http://i.stack.imgur.com/1YO6S.png" rel="nofollow"><img src="http://i.stack.imgur.com/1YO6S.png" alt="enter image description here"></a>
<a href="http://i.stack.imgur.com/TdF9v.png" rel="nofollow"><img src="http://i.stack.imgur.com/TdF9v.png" alt="enter image description here"></a></p>

<p>I would like the same to set xlabel and ylabel. Is is possible?</p>

<p>(Also, I'm interested in knowing how one will do such thing in Python. Is it better than GnuPlot? Should I learn Python instead?)</p>

<p>as pointed out by @Christoph, the <code>system</code> command is probably the only viable solution - in your particular case, you could do:</p>

<pre><code>fname="test.txt"

getTitle(colNum)=system(sprintf("head -n1 '%s' | cut -f%d -d';'", fname, colNum+1))

set xlabel getTitle(0)
set ylabel getTitle(1)
</code></pre>

python gnuplot