octave-plot

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

octave-plot

Yetmen Wang-2

How can I do if I want to draw more than 30 lines in a plot? (maybe 100 or more
lines.) In octave I can draw as many as 29 lines.

The version I am using is octave-1.1.1. and gnuplot linux version 3.5.

yetmen

P.S. please return to [hidden email].

Reply | Threaded
Open this post in threaded view
|

Re: octave-plot

niles-5

:How can I do if I want to draw more than 30 lines in a plot? (maybe 100 or more
:lines.) In octave I can draw as many as 29 lines.

The problem is in the communcation between Octave and Gnuplot.
Gnuplot only allows strings of a limited length.  By recompiling your
Gnuplot you should be able to set this limit higher.  This is an old
bug.  Here is some old mail about how to fix it.

Yetmen: Thanks for the neat plot.  Was this a function or real data?

        Good Luck,
        Rick Niles.

---------------------------------------------------------------
Return-Path: [hidden email]
Received: from schoch.che.utexas.edu by axp745.gsfc.nasa.gov; (5.65/1.1.8.2/10Jun94-0213PM)
        id AA06168; Wed, 9 Nov 1994 21:24:27 -0500
Received: from localhost (jwe@localhost) by schoch.che.utexas.edu (8.6.8.1/8.6) with SMTP id UAA02744; Wed, 9 Nov 1994 20:24:25 -0600
Message-Id: <[hidden email]>
To: Frederick A Niles (Rick) <[hidden email]>
Cc: [hidden email]
Subject: Re: save doesn't seem to always work....
In-Reply-To: Your message of Wed, 09 Nov 94 19:55:35 EST
Date: Wed, 09 Nov 94 20:24:24 CST
From: John Eaton <[hidden email]>

Frederick (Rick) A Niles <[hidden email]> wrote:

:   * gplot doesn't work if the string send to the gnuplot is too long.
:     It prints the remaining commands to the screen with an error.  Perhaps
:     an error message or split the command in to multiple plot commands
:     within gnuplot.

This is a problem with gnuplot.  It has a fixed-length buffer for
commands, and 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 TMPDIR to be
".", or you can increase the maximum command line length in gnuplot
using the a patch like this (for gnpulot 3.5) and recompiling gnuplot:

*** plot.h.orig Wed Nov  9 20:08:23 1994
--- plot.h Wed Nov  9 20:10:34 1994
***************
*** 91,98 ****
  #define MIN_CRV_POINTS 100 /* minimum size of points[] in curve_points */
  #define MIN_SRF_POINTS 1000 /* minimum size of points[] in surface_points */
 
! #define MAX_LINE_LEN 1024 /* maximum number of chars allowed on line */
! #define MAX_TOKENS 400
  #define MAX_ID_LEN 50 /* max length of an identifier */
 
 
--- 91,98 ----
  #define MIN_CRV_POINTS 100 /* minimum size of points[] in curve_points */
  #define MIN_SRF_POINTS 1000 /* minimum size of points[] in surface_points */
 
! #define MAX_LINE_LEN 32768 /* maximum number of chars allowed on line */
! #define MAX_TOKENS 8192
  #define MAX_ID_LEN 50 /* max length of an identifier */
 

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.

I'll add a note about this to the manual.

Thanks,

jwe