Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #1591 > unrolled thread

formating title using columnhead

Started byab <ab.3942@googlemail.com>
First post2013-01-31 23:13 -0800
Last post2013-02-04 16:21 +0100
Articles 4 — 2 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  formating  title using columnhead ab <ab.3942@googlemail.com> - 2013-01-31 23:13 -0800
    Re: formating  title using columnhead Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2013-02-01 20:15 +0100
      Re: formating  title using columnhead ab <ab.3942@googlemail.com> - 2013-02-03 23:46 -0800
        Re: formating  title using columnhead Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2013-02-04 16:21 +0100

#1591 — formating title using columnhead

Fromab <ab.3942@googlemail.com>
Date2013-01-31 23:13 -0800
Subjectformating title using columnhead
Message-ID<1d5df7fa-7ff8-4801-ac19-8d504595481f@googlegroups.com>
Hi,
with gnuplot 4.6   i do 
  plot "data" u 1:5  title columnhead(5)

which works fine.  My columnhead is a real number which i want to format.

   plot "data" u 1:5  title gprintf("%5.2e",columnhead(5))
does not work, it shows a 0.0  as title.

Is this a bug or a non- implemented feature?

I can use gprintf with a string argument like:
   plot "data" u 1:5  title gprintf("%5.2e","345.345")

I can manipulate the columnhead string:
  plot "data" u 1:5  title "Title :".columnhead(5)

But the combination does not work.
Any ideas how to solve this?



[toc] | [next] | [standalone]


#1594

FromHans-Bernhard Bröker <HBBroeker@t-online.de>
Date2013-02-01 20:15 +0100
Message-ID<an2iifFrnr6U1@mid.dfncis.de>
In reply to#1591
On 01.02.2013 08:13, ab wrote:
>
>     plot "data" u 1:5  title gprintf("%5.2e",columnhead(5))
> does not work, it shows a 0.0  as title.

That's not particularly surprising, what with columnhead() being a 
_string_ valued function, but you're promising to gprintf() that you'll 
be passing a number.

> Is this a bug or a non- implemented feature?
>
> I can use gprintf with a string argument like:
>     plot "data" u 1:5  title gprintf("%5.2e","345.345")

The line between string and numeric literals have become somewhat 
blurred in recent gnuplot.  Otherwise this wouldn't have worked either.

[toc] | [prev] | [next] | [standalone]


#1598

Fromab <ab.3942@googlemail.com>
Date2013-02-03 23:46 -0800
Message-ID<75e33740-1cc6-4053-95f9-565346b37f69@googlegroups.com>
In reply to#1594
>> 
>>     plot "data" u 1:5  title gprintf("%5.2e",columnhead(5)) 
>> does not work, it shows a 0.0  as title. 

> That's not particularly surprising, what with columnhead() being a 
> _string_ valued function, but you're promising to gprintf() that you'll 
> be passing a number. 

There is no explicit command to convert strings to numbers.
The manual states:
"A string which contains a numerical value is promoted to the corresponding
 integer or real value if used in a numerical expression."
In my opinion it is therefore allowed to use gprintf with a string. 

[toc] | [prev] | [next] | [standalone]


#1599

FromHans-Bernhard Bröker <HBBroeker@t-online.de>
Date2013-02-04 16:21 +0100
Message-ID<ana20nFi9duU1@mid.dfncis.de>
In reply to#1598
On 04.02.2013 08:46, ab wrote:

> The manual states:
> "A string which contains a numerical value is promoted to the corresponding
>   integer or real value if used in a numerical expression."

That might apply if columnvalue() hat been used in a numerical 
expression here.  But using it as the argument of gprintf() doesn't 
really satisfy such a condition.

I would probably try something like

	gprintf("%5.2e", 0.0+columnhead(5) )

That is actually using columnhead(5) in a numeric expression.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web