Interaction with gnuplot

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Interaction with gnuplot

John L Daschbach

I have used the following technique to setup gnuplot from within
octave functions.

tstring = sprintf("set title \"%s\" ",title);
eval(tstring);

This works, but I can't set the number format for the axies becuase
sprintf won't handle \% and you would need:


tstring = sprintf("set format x \%.2e");

or something similar.  sprintf() complains that \% is not a recognized
escape sequence.  I have tried \%, \\%, \\\%, all to no avail.

You can of course set it at an octave prompt, but you have to remember
to do this by hand.

Any ideas?

-John

John L. Daschbach
Environmental Molecular Sciences Laboratory
Pacific Northwest Laboratory
[hidden email]
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Interaction with gnuplot

Vinayak Dutt


#
# I have used the following technique to setup gnuplot from within
# octave functions.
#
# tstring = sprintf("set title \"%s\" ",title);
# eval(tstring);
#
# This works, but I can't set the number format for the axies becuase
# sprintf won't handle \% and you would need:
#
#
# tstring = sprintf("set format x \%.2e");

try:

tstring = sprintf("set format '%%.2e'");
eval(tstring)
 


--vinayak-
/*
 * vinayak dutt
 * ex-graduate student, ultrasound research
 * mayo graduate school, rochester mn
 *
 * e-mail: [hidden email]
 *         [hidden email]
 *         [hidden email]
 *
 */
#include "disclaimer.h"

Reply | Threaded
Open this post in threaded view
|

Interaction with gnuplot

John W. Eaton-6
In reply to this post by John L Daschbach
John L. Daschbach <[hidden email]> wrote:

: sprintf() complains that \% is not a recognized
: escape sequence.  I have tried \%, \\%, \\\%, all to no avail.

The format strings for the printf functions are similar to those from
the standard C library.  To print `%', use `%%' in the format string:

  octave:13> sprintf ("99%% of all statistics are made up")
  ans = 99% of all statistics are made up

jwe