#360 create a "set decimalsign" variant for each file in a plot


Please add a datafile-modifier to the plot and fit commands (and to other commands which can read files) which can set the decimalsign used for input numbers on a per file base.
e.g.: plot 'datawithcommas.data' decimalsign ',' using 1:2, 'numberswithpoints.data' decimalsign '.' using 1:2

I get data form two different sources (devices), one uses commas as decimalsign, the other uses a dot for that purpose. I'd like to plot both in one plot. Currently I can't do that as I only can choose "set decimalsign locale 'German_Germany.1252'" on a global scope.
For scripting purposes it would be nice to not touch the data files. The current workaround is to change one of the two file types by "search and replace" into the other one.

Version 4.6 patchlevel 0 last modified 2012-03-04
Build System: MS-Windows 32 bit
on Win7, 64bit


  • Ethan Merritt

    Ethan Merritt - 2013-04-02

    There is a misunderstanding here. The "set decimalsign" command does not affect how files are read. It only affects how gnuplot itself formats numbers when creating labels for axis ticks or other plot elements. The interpretation of numerical input is left entirely to the C language library routines atof() and scanf(). These are affected by the current LOCALE settings, but not by "set decimalsign".

  • Kraus

    Kraus - 2013-04-02

    That's correct and I am aware of this.
    Let me rephrase:

    Can a datafile-modifier be introduced that allows to set different locale values for each file used in one plot?
    e.g.: plot 'datawithcommas.data' locale 'German_Germany.1252' using 1:2, 'datawithdots.data' locale 'English_United States.1252' using 1:2

    I want to plot 2 sets of data into the same plot. They come from different sources, one uses the comma as decimal sign (locale German_Germany.1252) and the other uses dots as decimal sign (locale English_United States.1252).

    Or: Is there a way to run "set decimalsign locale 'English_United States.1252'" in the middle of a plot command?

  • Christoph Bersch

    Maybe it is an option for you to filter one dataset before plotting it:

    plot 'datawithcommas.data', '< tr . , < datawithdots.data'


    plot '< tr , . < datawithcommas.data', 'datawithdots.data'


  • Kraus

    Kraus - 2013-04-02

    Thank you,
    using this Unix command line magic is an acceptable workaround:
    After getting tr for windows from the CoreUtils for Windows http://gnuwin32.sourceforge.net/packages/coreutils.htm
    and switching to the console version of gnuplot

    plot "datawithdots.data" using 1:2 axes x1y1, "< tr ',' '.' < datawithcommas.data" using 1:2 axes x1y2

    gave me the plot I was looking for.
    Though a gnuplot internal solution would be highly appreciated.


Log in to post a comment.

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

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks