Chaturapadh Nakavachara <

[hidden email]> wrote:

: I got prob.. in plotting when I try to use for loop for plot

: like if i make

: x=[2 4 5 6 7 8 12 32 .....]

: and i use

: for k=1:n

: plot([1:k],x(1:k))

: hold on

: endfor

: so does gnuplot allow me only n=32 for maximum number for replot?

: if it is so how can do you know how can i do if i need to use

: n>32

You don't say what error you are seeing, or exactly what problem you

are having, but perhaps it is the one described below (see the `Actual

Bugs' section in the manual):

* If you get messages like

Input line too long

when trying to plot many lines on one graph, you have probably

generated a plot command that is too larger for `gnuplot''s

fixed-length buffer for commands. Splitting up the plot command

doesn't help because replot is implemented in gnuplot by simply

appending the new plotting commands to the old command line and

then evaluating it again.

You can demonstrate this `feature' by running gnuplot and doing

something like

plot sin (x), sin (x), sin (x), ... lots more ..., sin (x)

and then

replot sin (x), sin (x), sin (x), ... lots more ..., sin (x)

after repeating the replot command a few times, gnuplot will give

you an error.

Also, it doesn't help to use backslashes to enter a plot command

over several lines, because the limit is on the overall command

line length, once the backslashed lines are all pasted together.

Because of this, Octave tries to use as little of the command-line

length as possible by using the shortest possible abbreviations for

all the plot commands and options. Unfortunately, the length of

the temporary file names is probably what is taking up the most

space on the command line.

You can buy a little bit of command line space by setting the

environment variable `TMPDIR' to be "." before starting Octave, or

you can increase the maximum command line length in gnuplot by

changing the following limits in the file plot.h in the gnuplot

distribution and recompiling gnuplot.

#define MAX_LINE_LEN 32768 /* originally 1024 */

#define MAX_TOKENS 8192 /* originally 400 */

Of course, this doesn't really fix the problem, but it does make it

much less likely that you will run into trouble unless you are

putting a very large number of lines on a given plot.

Perhaps this is actually fixed in gnuplot 3.6.

jwe