#355 Ability to use MAXCOL with "using" keyword


In the documentation, I Gnuplot / Expressions / Summation, we can see that variable MAXCOL can be used :

plot ’data’ using 1 : (sum [col=2:MAXCOL] column(col))

What I would like is to be able to use syntax like

plot 'myfile' using MAXCOL:xtic(1) with boxes

Thus, I do not have to hard code the value of last column number.


  • Ethan Merritt

    Ethan Merritt - 2012-12-03

    I think you have misinterpreted the documentation of the sum() function. It is not saying that there is a pre-existing variable MAXCOL that knows about your data file. The example command is assuming that you yourself previously defined such a variable.

    Nevertheless, a preliminary version of the capability you ask for is in the development version (4.7). It defines pseudo-column -3 as referring to the last column in the line of data. So your command would be
    plot 'myfile' using (column(-3)):xtic(1) with boxes

    Please treat this new feature as EXPERIMENTAL. The details may change before it is included in an official release of gnuplot. But please try it out and let us know if you run into any problems if you can suggest improvements.

  • Ethan Merritt

    Ethan Merritt - 2012-12-03
    • status: open --> open-out-of-date
  • Ethan Merritt

    Ethan Merritt - 2012-12-26
    • status: open-out-of-date --> closed-out-of-date
  • Ethan Merritt

    Ethan Merritt - 2012-12-26

    stats now reports the number of columns in STATS_columns.
    This variable can be used in a subsequent plot command either by itself of as an iteration limit.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks