|
From: Patrick D. <pd...@gm...> - 2018-10-14 01:39:48
|
===========================================================================
Patrick DUPRÉ | | email: pd...@gm...
Laboratoire de Physico-Chimie de l'Atmosphère | |
Université du Littoral-Côte d'Opale | |
Tel. (33)-(0)3 28 23 76 12 | | Fax: 03 28 65 82 44
189A, avenue Maurice Schumann | | 59140 Dunkerque, France
===========================================================================
> Sent: Saturday, October 13, 2018 at 7:16 PM
> From: "Ethan A Merritt" <eam...@gm...>
> To: gnu...@li...
> Cc: "Patrick Dupre" <pd...@gm...>
> Subject: Re: [Gnuplot-info] sprintf
>
> On Friday, 12 October 2018 03:08:49 Patrick Dupre wrote:
> > Hello,
> >
> > When I use:
> > set table "0f_Lor_fitted.asc" ; plot [x_min:x_max] '+' u 1:(ampl*Lor_D(x-x0,W)+offset+y_lin(x-x0,slope)) with table ; unset table
> >
> > I get a proper file.
> > But, when I do (to get more control on the data format)
> >
> > set table "0f_Lor_fitted.asc" ; plot [x_min:x_max] '+' u (sprintf("%g,$1)):(ampl*Lor_D(x-x0,W)+offset+y_lin(x-x0,slope)) with table ; unset table
> >
> > I get:
> > nan
> > instead of the expected value.
> >
> > I thought that I did like it is described in the manual.
> > What did I miss?
>
> When I try to reproduce this problem I get an error because
> there is a missing quote to terminate "%g". If I add the
> quote, then it works with no error. But I had to invent
> functions and constants fro ampl Lor_D W and so on.
> Can you either provide the full script or reduce the problem
> to a stand-alone command?
Here is an example
y_lin(x,a) = a * x
set table "tmp.asc" ; plot [-10:10] '+' u 1:(y_lin (x,2)) with table ; unset table
set table "tmp.asc" ; plot [-10:10] '+' u (sprintf("%g",$1)):(y_lin (x,2)) with table ; unset table
|