linewidth with gnuplot

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

linewidth with gnuplot

Andy Adler-4
Hi all,

I'm having some trouble interfacing octave to gnuplot.

In gnuplot, if I want to make thicker lines I can do

  gnuplot> plot "/tmp/oct-29730aaa" with lines linewidth 1

or by defining a linestyle with thicker lines

  gnuplot> set linestyle 1 linewidth 5                    
  gnuplot> plot "/tmp/oct-29730aaa" with lines linestyle 1

however, octave doesn't accept either of these approaches

  octave:22> gplot data with lines linewidth 1
  error: `linewidth' undefined near line 22 column 23
  error: evaluating expression near line 22, column 23
  error: evaluating plot style command
  octave:22> gset linestyle 1 linewidth 5
  octave:23> gplot data with lines linestyle 1
  error: `linestyle' undefined near line 23 column 23
  error: evaluating expression near line 23, column 23
  error: evaluating plot style command

unfortunately, gnuplot doesn't let you use "set linewidth" the
way you can "set pointsize" otherwise I could do that first.

So, my problem is how to get octave to accept the gnuplot
syntax. I'm prepared to do some source hacking if someone
can show me where to hack.

[on a side note, if you abbreviate linestyles by ls in the
 gplot command octave tries to ls the directory

  octave:29> gplot data with lines ls 1
  ls: 1: No such file or directory
  error: evaluating plot style command
 
and if you put it in quotes you get another bizarre error

  octave:29> gplot('data with lines linestyle 1')
           line 0: undefined variable: t
  ]

Thanks for your help
_____________________________________________________________________
Andy Adler,    | Pulmonary Physiology Unit         | Lab 303-398-1626
[hidden email] | National Jewish Center,Denver,USA | Fax 303-398-1607

Unfortunately, the facts pay no attention to what we can imagine.
                             -Geza Szamosi, "The Twin Dimensions"


Reply | Threaded
Open this post in threaded view
|

linewidth with gnuplot

John W. Eaton-6
On  4-Nov-1997, Andy Adler <[hidden email]> wrote:

| I'm having some trouble interfacing octave to gnuplot.
|
| In gnuplot, if I want to make thicker lines I can do
|
|   gnuplot> plot "/tmp/oct-29730aaa" with lines linewidth 1
|
| or by defining a linestyle with thicker lines
|
|   gnuplot> set linestyle 1 linewidth 5                    
|   gnuplot> plot "/tmp/oct-29730aaa" with lines linestyle 1
|
| however, octave doesn't accept either of these approaches
|
|   octave:22> gplot data with lines linewidth 1
|   error: `linewidth' undefined near line 22 column 23
|   error: evaluating expression near line 22, column 23
|   error: evaluating plot style command
|   octave:22> gset linestyle 1 linewidth 5
|   octave:23> gplot data with lines linestyle 1
|   error: `linestyle' undefined near line 23 column 23
|   error: evaluating expression near line 23, column 23
|   error: evaluating plot style command

The trouble is that Octave has to parse the entire gplot command line,
so that leads to situations like this where the gnuplot syntax changes
but Octave hasn't `caught up' yet.  I'm not sure that it is worth the
effort to try to follow every feature change in gnuplot.  Probably it
is better to offer a full-featured set of functions that can be
implemented in terms of various plotting packages.  Unfortunately,
this hasn't happened yet.

| unfortunately, gnuplot doesn't let you use "set linewidth" the
| way you can "set pointsize" otherwise I could do that first.
|
| So, my problem is how to get octave to accept the gnuplot
| syntax. I'm prepared to do some source hacking if someone
| can show me where to hack.

You have to modify the lexer and parser to understand the syntax
(lex.l, parse.y), plus you may have to add some extra information to
the class than handles the interface to gnuplot (pt-plot.h, pt-plot.cc).

| [on a side note, if you abbreviate linestyles by ls in the
|  gplot command octave tries to ls the directory
|
|   octave:29> gplot data with lines ls 1
|   ls: 1: No such file or directory
|   error: evaluating plot style command
|  
| and if you put it in quotes you get another bizarre error
|
|   octave:29> gplot('data with lines linestyle 1')
|            line 0: undefined variable: t
|   ]

Hmm.  Well, I'm beginning to think that allowing any `special'
functions that operate without argument lists in parens is a mistake
(but don't panic, the ones we already have are not likely to go away
any time soon).

jwe


Reply | Threaded
Open this post in threaded view
|

Re: linewidth with gnuplot

Andy Adler-4
On Mon, 10 Nov 1997, John W. Eaton wrote:
> | I'm having some trouble interfacing octave to gnuplot.
>
> The trouble is that Octave has to parse the entire gplot command line,
> so that leads to situations like this where the gnuplot syntax changes
> but Octave hasn't `caught up' yet.  I'm not sure that it is worth the
> effort to try to follow every feature change in gnuplot.  Probably it
> is better to offer a full-featured set of functions that can be
> implemented in terms of various plotting packages.  Unfortunately,
> this hasn't happened yet.

I'd like to try my hand at producing a patch to allow linewidths
in plot. I'm wondering which approach would be best.

There no way to follow the matlab example since MATLAB does
linewiths using their set(handle,'property') feature.

Perhaps the easiest way is to get octave to understand
line styles. That way you can access new gnuplot features with

gset linestyle bla bla bla

and then plot it with gplot data with linestyle foo

or even some variant of plot(x,y,'textstring')

I'll try to produce a patch to do this, unless someone can
think of a better way to go about it.

_____________________________________________________________________
Andy Adler,    | Pulmonary Physiology Unit         | Lab 303-398-1626
[hidden email] | National Jewish Center,Denver,USA | Fax 303-398-1607

Of making many books there is no end, and much study wearies the body.
                                                   - Ecclesiastes