<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to 2140: Selecting columns using strcol adds extra spaces</title><link href="https://sourceforge.net/p/gnuplot/bugs/2140/" rel="alternate"/><link href="https://sourceforge.net/p/gnuplot/bugs/2140/feed.atom" rel="self"/><id>https://sourceforge.net/p/gnuplot/bugs/2140/</id><updated>2019-02-25T18:35:35.373000Z</updated><subtitle>Recent changes to 2140: Selecting columns using strcol adds extra spaces</subtitle><entry><title>#2140 Selecting columns using strcol adds extra spaces</title><link href="https://sourceforge.net/p/gnuplot/bugs/2140/?limit=25#fcba/ce82/a7a9/e38e/ae2b" rel="alternate"/><published>2019-02-25T18:35:35.373000Z</published><updated>2019-02-25T18:35:35.373000Z</updated><author><name>Mike Tegtmeyer</name><uri>https://sourceforge.net/u/mtegtmeyer/</uri></author><id>https://sourceforge.net03205d67e822b37e76af33f2076523d3964b1b86</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I hear what you are saying but I would counter then that 'separator tab' directives don't actually do what they claim to do. To me, delimited data means that everything that is between the delimiters is considered data. I'm somewhat familiar with RFC4180 and in my reading, I believe RFC 4180 agrees with this. That is, in CSV&lt;/p&gt;
&lt;p&gt;&lt;code&gt;foo,bar&lt;/code&gt; is not the same as &lt;code&gt;foo, bar&lt;/code&gt; (note the space)&lt;/p&gt;
&lt;p&gt;And from the RFC 4180 BNF:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;TEXTDATA =  %x20-21 / %x23-2B / %x2D-7E&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Here hex 0x20 is the space character&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The command &lt;code&gt;set datafile separator&lt;/code&gt; tells &lt;code&gt;gnuplot&lt;/code&gt; that data fields in&lt;br/&gt;
 subsequent input files are separated by a specific character rather than by&lt;br/&gt;
 whitespace. ...&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If what gnuplot is actually going to do is insert a tab (as directed by 'separator tab') and then add some additional whitespace but the user should just consider the tab and any additional whitespace a column separator, then 'separator tab' doesn't actually add any real functionality. Meaning 'separator tab' is basically equivelant to 'separator whitespace'&lt;/p&gt;
&lt;p&gt;In my opinion, what we are talking about here is not a language (which I agree should be insensitive to whitespace), we are talking about datafile where the data may or may not contain whitespace as valid data. gnuplot can assume that it doesn't (separator whitespace). However, if the data does contain some and the user is explicitly stating how their data is/should be laid out and what or what is not considered data by using the 'separator' directive, then there is a reason for it and gnuplot should respect that. &lt;/p&gt;
&lt;p&gt;In the end, I'm suggesting that gnuplot's CSV handling should be in accordance with RFC 4180 and tab-separated data should be the same with the exception of exchanging the comma for the tab. I think that this follows the principle of least surprise. That is, if I give gnuplot:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;data[tab]data&lt;/code&gt;, gnuplot shouldn't rewrite it as &lt;code&gt;data[tab][space]data&lt;/code&gt; and tell me is the same thing.&lt;/p&gt;
&lt;p&gt;I'm struggling to come up with another application that adds additional whitespace to field separators after you've set it to be a tab. Certainly not excel, Matlab, Octave, or Maple.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#2140 Selecting columns using strcol adds extra spaces</title><link href="https://sourceforge.net/p/gnuplot/bugs/2140/?limit=25#fcba/ce82/a7a9/e38e" rel="alternate"/><published>2019-02-25T17:26:41.869000Z</published><updated>2019-02-25T17:26:41.869000Z</updated><author><name>Ethan Merritt</name><uri>https://sourceforge.net/u/sfeam/</uri></author><id>https://sourceforge.netf5c361b6c635d37b0c9b37bee9c140fb345d3e24</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;My view is that any algorithm, format, or language that is sensitive to the amount of whitespace is broken  or badly designed or however you want to state it.  Even Fortran eventually outgrew that craziness.  I have more sympathy for the complaint that programs (excel, soffice, etc) are inconsistant about whether string values are placed in quotes.  This is explicitly allowed by the RFC 4180 standard but that doesn't make it any less annoying. So far as I know the standard says nothing about leading or trailing blank space.&lt;/p&gt;
&lt;p&gt;However,  note that the C documentation says that string input via %s "stops at white space or at the maximum field width, whichever occurs first", which implies that input is insensitive to the amount of trailing whitespace.  So it might be better to favor "%s&amp;lt;blank&amp;gt;" over "&amp;lt;blank&amp;gt;%s" on output.&amp;lt;/blank&amp;gt;&amp;lt;/blank&amp;gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#2140 Selecting columns using strcol adds extra spaces</title><link href="https://sourceforge.net/p/gnuplot/bugs/2140/?limit=25#fcba/ce82/a7a9" rel="alternate"/><published>2019-02-25T15:19:12.343000Z</published><updated>2019-02-25T15:19:12.343000Z</updated><author><name>Mike Tegtmeyer</name><uri>https://sourceforge.net/u/mtegtmeyer/</uri></author><id>https://sourceforge.nete7f5fc98393aec070f3979b7ad915b5c94c2ba83</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Ethan,&lt;/p&gt;
&lt;p&gt;I think the trim command will be useful in general. I was achieving a similar workaround using the word call.&lt;/p&gt;
&lt;p&gt;I think that there still is an underlying bug however. It seems that the &lt;code&gt;with table&lt;/code&gt; command prepends characters to your data (specifically the space char) when it shouldn't. It is reasonable to expect gnuplot to change how your data is &lt;em&gt;delimited&lt;/em&gt; (since it was set via a separator) but I think that it is unreasonable for gnuplot (or any application for that matter) to &lt;em&gt;modify&lt;/em&gt; the data in some irreparable way during basic I/O. If someone is using the tab character as a column separator then it is reasonable to expect that the data might be padded with whitespace characters and should be preserved. For example with the current proposed fix, it appears to be impossible to load in string data prepended with X spaces and write them back out (either as a file or as a datablock) and preserve the X spaces. Either they will be increased by 1 (which the user didn't ask for) or they will be stripped (via a trim-like operation).&lt;/p&gt;
&lt;p&gt;To me, round-tripping data by reading in a tab-separated file of potentially space-padded string data using &lt;code&gt;set datafile separator tab&lt;/code&gt;  and then writing it back out again using &lt;code&gt;set table ... separator tab&lt;/code&gt; should succeed. Ie the input data and the output data should be the same.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#2140 Selecting columns using strcol adds extra spaces</title><link href="https://sourceforge.net/p/gnuplot/bugs/2140/?limit=25#fcba/ce82" rel="alternate"/><published>2019-02-23T23:08:59.668000Z</published><updated>2019-02-23T23:08:59.668000Z</updated><author><name>Ethan Merritt</name><uri>https://sourceforge.net/u/sfeam/</uri></author><id>https://sourceforge.netfbc14b7297c7ecbd7cb144e1208c814a64a4e223</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Now in 5.3:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;gnuplot&amp;gt; help trim

 `trim("  padded string ")` returns the original string stripped of leading
 and trailing whitespace.  This is useful for string comparisons of input
 data fields that may contain extra whitespace. For example
      plot FOO using 1:( trim(strcol(3)) eq "A" ? $2 : NaN )
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>#2140 Selecting columns using strcol adds extra spaces</title><link href="https://sourceforge.net/p/gnuplot/bugs/2140/?limit=25#fcba" rel="alternate"/><published>2019-02-23T00:43:16.559000Z</published><updated>2019-02-23T00:43:16.559000Z</updated><author><name>Ethan Merritt</name><uri>https://sourceforge.net/u/sfeam/</uri></author><id>https://sourceforge.net09b0dc4cf20a5f6700af3a83e0568d36b05474d7</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;For numerical values the extra whitespace is ignored.&lt;br/&gt;
For string content, If you know that the string itself does not contain internal blanks then it would be sufficient to say&lt;br/&gt;
&lt;code&gt;set datafile separator whitespace&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Beyond that, maybe we should add a built-in string operator &lt;code&gt;trim(str)&lt;/code&gt; as in perl6 or perl5 String::Util     That could be quite useful.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#2140 Selecting columns using strcol adds extra spaces</title><link href="https://sourceforge.net/p/gnuplot/bugs/2140/?limit=25#aa33" rel="alternate"/><published>2019-02-22T20:09:38.032000Z</published><updated>2019-02-22T20:09:38.032000Z</updated><author><name>Mike Tegtmeyer</name><uri>https://sourceforge.net/u/mtegtmeyer/</uri></author><id>https://sourceforge.net829ad3438ba974c626619871afdb9d392905a5df</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;ul&gt;
&lt;li&gt;Description has changed:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Diff:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gd"&gt;--- old&lt;/span&gt;
&lt;span class="gi"&gt;+++ new&lt;/span&gt;
&lt;span class="gu"&gt;@@ -1,4 +1,4 @@&lt;/span&gt;
&lt;span class="gd"&gt;-Plotting columns of tab-separated data with table using strcol inserts additional spaces that prevents use of common comparative operations. That is, given a column of the letter 'a',  plotting using (strcol(1) eq 'a' ? true_val : false_val) on a datablock will always be false because the value extracted from the original data is padded with a space character eg  '&amp;lt;space&amp;gt;a'&lt;/span&gt;
&lt;span class="gi"&gt;+Plotting columns of tab-separated data with table using strcol inserts additional spaces that prevents use of common comparative operations. That is, given a column of the letter 'a',  plotting using `(strcol(1) eq 'a' ? true_val : false_val)` on a datablock will always be false because the value extracted from the original data is padded with a space character eg  '`&amp;lt;space&amp;gt;a`'&lt;/span&gt;

 Steps to reproduce:

&lt;span class="gu"&gt;@@ -16,7 +16,7 @@&lt;/span&gt;
 a^Ib^Ic
 a^Ib^Ic
 [14:28:18]:tmp$ gnuplot -d -e "set datafile separator tab; set table 'out.tsv' separator tab; plot 'in.tsv' using (strcol(1)):(strcol(2)) with table; unset table;"
&lt;span class="gd"&gt;-[14:29:42]:tmp$ cat -t out.tsv &lt;/span&gt;
&lt;span class="gi"&gt;+[14:29:42]:tmp$ cat -t out.tsv # basically &amp;lt;space&amp;gt;a&amp;lt;tab&amp;gt;&amp;lt;space&amp;gt;b&amp;lt;newline&amp;gt;&lt;/span&gt;
  a^I b
  a^I b
  a^I b
&lt;span class="gu"&gt;@@ -28,9 +28,7 @@&lt;/span&gt;
  a^I b
  a^I b
 ~~~
&lt;span class="gd"&gt;- &lt;/span&gt;
&lt;span class="gd"&gt;- Or basically &amp;lt;space&amp;gt;a&amp;lt;tab&amp;gt;&amp;lt;space&amp;gt;b&amp;lt;newline&amp;gt;&lt;/span&gt;
&lt;span class="gd"&gt;- &lt;/span&gt;
&lt;span class="gi"&gt;+  &lt;/span&gt;
  Comparison failure can be reproduced via:

 ~~~
&lt;/pre&gt;&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Group&lt;/strong&gt;:  --&amp;gt; &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Priority&lt;/strong&gt;:  --&amp;gt; &lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</summary></entry><entry><title>Selecting columns using strcol adds extra spaces</title><link href="https://sourceforge.net/p/gnuplot/bugs/2140/" rel="alternate"/><published>2019-02-22T20:06:37.618000Z</published><updated>2019-02-22T20:06:37.618000Z</updated><author><name>Mike Tegtmeyer</name><uri>https://sourceforge.net/u/mtegtmeyer/</uri></author><id>https://sourceforge.net2977daac7dc6196ce616e8e6396f8de18aac5018</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Plotting columns of tab-separated data with table using strcol inserts additional spaces that prevents use of common comparative operations. That is, given a column of the letter 'a',  plotting using (strcol(1) eq 'a' ? true_val : false_val) on a datablock will always be false because the value extracted from the original data is padded with a space character eg  '&amp;lt;space&amp;gt;a'&amp;lt;/space&amp;gt;&lt;/p&gt;
&lt;p&gt;Steps to reproduce:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nd"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="nt"&gt;printf&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;in&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;tsv&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nt"&gt;for&lt;/span&gt; &lt;span class="nt"&gt;i&lt;/span&gt; &lt;span class="nt"&gt;in&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;1..10&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nt"&gt;do&lt;/span&gt; &lt;span class="nt"&gt;printf&lt;/span&gt; &lt;span class="s2"&gt;"a\tb\tc\n"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;in&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;tsv&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nt"&gt;done&lt;/span&gt;
&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;07&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nd"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="nt"&gt;cat&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; &lt;span class="nt"&gt;in&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;tsv&lt;/span&gt;  &lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nt"&gt;basically&lt;/span&gt; &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;tab&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;b&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;tab&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;c&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;newline&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ib&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ic&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ib&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ic&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ib&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ic&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ib&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ic&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ib&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ic&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ib&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ic&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ib&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ic&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ib&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ic&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ib&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ic&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ib&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;Ic&lt;/span&gt;
&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nd"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="nt"&gt;gnuplot&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"set datafile separator tab; set table 'out.tsv' separator tab; plot 'in.tsv' using (strcol(1)):(strcol(2)) with table; unset table;"&lt;/span&gt;
&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;29&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nd"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="nt"&gt;cat&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; &lt;span class="nt"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;tsv&lt;/span&gt; 
 &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;I&lt;/span&gt; &lt;span class="nt"&gt;b&lt;/span&gt;
 &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;I&lt;/span&gt; &lt;span class="nt"&gt;b&lt;/span&gt;
 &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;I&lt;/span&gt; &lt;span class="nt"&gt;b&lt;/span&gt;
 &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;I&lt;/span&gt; &lt;span class="nt"&gt;b&lt;/span&gt;
 &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;I&lt;/span&gt; &lt;span class="nt"&gt;b&lt;/span&gt;
 &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;I&lt;/span&gt; &lt;span class="nt"&gt;b&lt;/span&gt;
 &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;I&lt;/span&gt; &lt;span class="nt"&gt;b&lt;/span&gt;
 &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;I&lt;/span&gt; &lt;span class="nt"&gt;b&lt;/span&gt;
 &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;I&lt;/span&gt; &lt;span class="nt"&gt;b&lt;/span&gt;
 &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nt"&gt;I&lt;/span&gt; &lt;span class="nt"&gt;b&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Or basically &amp;lt;space&amp;gt;a&amp;lt;tab&amp;gt;&amp;lt;space&amp;gt;b&amp;lt;newline&amp;gt;&amp;lt;/newline&amp;gt;&amp;lt;/space&amp;gt;&amp;lt;/tab&amp;gt;&amp;lt;/space&amp;gt;&lt;/p&gt;
&lt;p&gt;Comparison failure can be reproduced via:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt; &lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;02&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;26&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nd"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="nt"&gt;gnuplot&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"fn(val,pred)=(val eq pred ? 'true' : 'false'); \&lt;/span&gt;
&lt;span class="s2"&gt;&amp;gt; set datafile separator tab; \&lt;/span&gt;
&lt;span class="s2"&gt;&amp;gt; set table \$BLOCK separator tab; \&lt;/span&gt;
&lt;span class="s2"&gt;&amp;gt; plot 'in.tsv' using (strcol(1)):(strcol(2)) with table; \&lt;/span&gt;
&lt;span class="s2"&gt;&amp;gt; unset table; \&lt;/span&gt;
&lt;span class="s2"&gt;&amp;gt; set table 'out2.tsv' separator tab; \&lt;/span&gt;
&lt;span class="s2"&gt;&amp;gt; plot \$BLOCK using (fn(strcol(1),'a')):(fn(strcol(2),'b')) with table; \&lt;/span&gt;
&lt;span class="s2"&gt;&amp;gt; unset table;"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;cat&lt;/span&gt; &lt;span class="nt"&gt;out2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;tsv&lt;/span&gt; 
 &lt;span class="nt"&gt;false&lt;/span&gt;   &lt;span class="nt"&gt;true&lt;/span&gt;
 &lt;span class="nt"&gt;false&lt;/span&gt;   &lt;span class="nt"&gt;true&lt;/span&gt;
 &lt;span class="nt"&gt;false&lt;/span&gt;   &lt;span class="nt"&gt;true&lt;/span&gt;
 &lt;span class="nt"&gt;false&lt;/span&gt;   &lt;span class="nt"&gt;true&lt;/span&gt;
 &lt;span class="nt"&gt;false&lt;/span&gt;   &lt;span class="nt"&gt;true&lt;/span&gt;
 &lt;span class="nt"&gt;false&lt;/span&gt;   &lt;span class="nt"&gt;true&lt;/span&gt;
 &lt;span class="nt"&gt;false&lt;/span&gt;   &lt;span class="nt"&gt;true&lt;/span&gt;
 &lt;span class="nt"&gt;false&lt;/span&gt;   &lt;span class="nt"&gt;true&lt;/span&gt;
 &lt;span class="nt"&gt;false&lt;/span&gt;   &lt;span class="nt"&gt;true&lt;/span&gt;
 &lt;span class="nt"&gt;false&lt;/span&gt;   &lt;span class="nt"&gt;true&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Behavior confirmed on 5.2.4-5.2.6 and branch-5-2-stable&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ git log -n1
commit d83adc16f5a572f5d004963ead8326591498dd41 &lt;span class="o"&gt;(&lt;/span&gt;HEAD -&amp;gt; branch-5-2-stable, origin/branch-5-2-stable&lt;span class="o"&gt;)&lt;/span&gt;
Author: Ethan A Merritt &amp;lt;merritt@u.washington.edu&amp;gt;
Date:   Tue Feb &lt;span class="m"&gt;19&lt;/span&gt; &lt;span class="m"&gt;23&lt;/span&gt;:10:08 &lt;span class="m"&gt;2019&lt;/span&gt; -0800

    Clear STATS_* variables before performing &lt;span class="s1"&gt;'stats'&lt;/span&gt; analysis
...
$ uname -a
Darwin pinion.local &lt;span class="m"&gt;18&lt;/span&gt;.2.0 Darwin Kernel Version &lt;span class="m"&gt;18&lt;/span&gt;.2.0: Mon Nov &lt;span class="m"&gt;12&lt;/span&gt; &lt;span class="m"&gt;20&lt;/span&gt;:24:46 PST &lt;span class="m"&gt;2018&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>Selecting columns using strcol adds extra spaces</title><link href="https://sourceforge.net/p/gnuplot/bugs/2140/" rel="alternate"/><published>2019-02-22T20:06:37.618000Z</published><updated>2019-02-22T20:06:37.618000Z</updated><author><name>Mike Tegtmeyer</name><uri>https://sourceforge.net/u/mtegtmeyer/</uri></author><id>https://sourceforge.net0ccdc322e4514e2849a247cba1d1c88a178cd420</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Ticket 2140 has been modified: Selecting columns using strcol adds extra spaces&lt;br/&gt;
Edited By: Mike Tegtmeyer (mtegtmeyer)&lt;br/&gt;
Description updated:&lt;br/&gt;
--- description-old&lt;/p&gt;
&lt;p&gt;+++ description-new&lt;/p&gt;
&lt;p&gt;@@ -1,4 +1,4 @@&lt;/p&gt;
&lt;p&gt;-Plotting columns of tab-separated data with table using strcol inserts additional spaces that prevents use of common comparative operations. That is, given a column of the letter 'a',  plotting using (strcol(1) eq 'a' ? true_val : false_val) on a datablock will always be false because the value extracted from the original data is padded with a space character eg  '&amp;lt;space&amp;gt;a'&lt;br/&gt;
+Plotting columns of tab-separated data with table using strcol inserts additional spaces that prevents use of common comparative operations. That is, given a column of the letter 'a',  plotting using &lt;code&gt;(strcol(1) eq 'a' ? true_val : false_val)&lt;/code&gt; on a datablock will always be false because the value extracted from the original data is padded with a space character eg  '&lt;code&gt;&amp;lt;space&amp;gt;a&lt;/code&gt;'&amp;lt;/space&amp;gt;&lt;/p&gt;
&lt;p&gt;Steps to reproduce:&lt;/p&gt;
&lt;p&gt;@@ -16,7 +16,7 @@&lt;/p&gt;
&lt;p&gt;a^Ib^Ic&lt;br/&gt;
 a^Ib^Ic&lt;br/&gt;
&lt;span&gt;[14:28:18]&lt;/span&gt;:tmp$ gnuplot -d -e "set datafile separator tab; set table 'out.tsv' separator tab; plot 'in.tsv' using (strcol(1)):(strcol(2)) with table; unset table;"&lt;br/&gt;
-&lt;span&gt;[14:29:42]&lt;/span&gt;:tmp$ cat -t out.tsv &lt;br/&gt;
+&lt;span&gt;[14:29:42]&lt;/span&gt;:tmp$ cat -t out.tsv # basically &amp;lt;space&amp;gt;a&amp;lt;tab&amp;gt;&amp;lt;space&amp;gt;b&amp;lt;newline&amp;gt;&lt;br/&gt;
  a^I b&lt;br/&gt;
  a^I b&lt;br/&gt;
  a^I b&lt;br/&gt;
@@ -28,9 +28,7 @@&amp;lt;/newline&amp;gt;&amp;lt;/space&amp;gt;&amp;lt;/tab&amp;gt;&amp;lt;/space&amp;gt;&lt;/p&gt;
&lt;p&gt;a^I b&lt;br/&gt;
  a^I b&lt;br/&gt;
 ~~~&lt;br/&gt;
- &lt;br/&gt;
- Or basically &amp;lt;space&amp;gt;a&amp;lt;tab&amp;gt;&amp;lt;space&amp;gt;b&amp;lt;newline&amp;gt;&lt;br/&gt;
- &lt;br/&gt;
+&lt;br/&gt;
  Comparison failure can be reproduced via:&amp;lt;/newline&amp;gt;&amp;lt;/space&amp;gt;&amp;lt;/tab&amp;gt;&amp;lt;/space&amp;gt;&lt;/p&gt;
&lt;p&gt;~~~&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>