Menu

Using data file for labelling axes

Help
Nico
2009-03-21
2013-02-10
  • Nico

    Nico - 2009-03-21

    Hi,

    Let's consider a data file like this:

    Col1  Col2  Col3
    0       1      2
    1       2      3
    ...

    How can I use in gnuplot script the name of the columns ("Col1", "Col2", "Col3") to label my axes or to define the title ?

    Thanks

     
    • Edoardo Pasca

      Edoardo Pasca - 2009-03-21

      I generally preprocess the files with gawk or similar.

      In your case I'd make something like this

      gawk '{if (NR==1) print "set title \"$0\"; else {print "plot \"myfile.dat\" u 1:2 w etcetc "}}' myfile.dat > plot.gpi

      so that plot.gpi contains

        set title "Col1 Col2 Col3"
        plot "myfile.dat" u 1:2 w etcetc

      then I'd issue

      gnuplot plot.gpi

      Edo

       
    • Ethan Merritt

      Ethan Merritt - 2009-03-21

      To set the plot titles:

        set key autotitle columnhead

      It's not clear how the column head values relate to axis labels.  What value would appear where?

       
      • Nico

        Nico - 2009-03-22

        this method (set key autotitle columnhead) gives a partial answer...
        How can I do the same for the xlabel (or the title...) ?

        Thanks

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.