Changing the legend

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

Changing the legend

Preben Randhol-12

Hi I am was wondering if somebody could explain how I change the
legend name from line 1, line 2... to something more describing?

In matlab there was a function called legend, but it does not seem to
be the same in octave.

I am sorry that I have only browsed quickly at the manual, but I have
a report that I need to get finished ASAP, so if anybody could be so
kind to give me the solution I would appreciate it a lot!

--
Preben Randhol                    | Azbuka, to je obracenej nabytek.
Tlf    73940929/(735)94076 [arb]  |                  -- Bohumil Hrabal
Email  [hidden email]            | [Transl:  Cyrilic, that's
http://www.pvv.org/~randhol/      |           furniture uspide down.]


Reply | Threaded
Open this post in threaded view
|

Re: Changing the legend

Daniel Heiserer
Preben Randhol wrote:

>
> Hi I am was wondering if somebody could explain how I change the
> legend name from line 1, line 2... to something more describing?
>
> In matlab there was a function called legend, but it does not seem to
> be the same in octave.
>
> I am sorry that I have only browsed quickly at the manual, but I have
> a report that I need to get finished ASAP, so if anybody could be so
> kind to give me the solution I would appreciate it a lot!
>
> --
> Preben Randhol                    | Azbuka, to je obracenej nabytek.
> Tlf    73940929/(735)94076 [arb]  |                  -- Bohumil Hrabal
> Email  [hidden email]            | [Transl:  Cyrilic, that's
> http://www.pvv.org/~randhol/      |           furniture uspide down.]

The legend is a matlab5.# function. Octave is almost compatible with
matlab4.# or matlab3.# as far as I know (it's compatibility is almost a
version behind).
If you have to do a report you probably write a postscript file of your
plot. Why don't you edit this postscript, probably the fastest way to
get a clean and safe solution.

Bye daniel



--
Mit freundlichen Gruessen
                                 Daniel Heiserer
-----
--------------------------------------------------------------
Daniel Heiserer, BMW AG, Knorrstrasse 147, 80788 Muenchen
Abteilung EK-20
Tel.: 089-382-21187, Fax.: 089-382-42820
mailto:[hidden email]


Reply | Threaded
Open this post in threaded view
|

RE: Changing the legend

Ted.Harding
In reply to this post by Preben Randhol-12
On 11-Aug-98 Preben Randhol wrote:
> Hi I am was wondering if somebody could explain how I change the
> legend name from line 1, line 2... to something more describing?
>
> In matlab there was a function called legend, but it does not seem to
> be the same in octave.
>
> I am sorry that I have only browsed quickly at the manual, but I have
> a report that I need to get finished ASAP, so if anybody could be so
> kind to give me the solution I would appreciate it a lot!

Since you seem to be using octave's default gnuplot graphics, you can use the
gnuplot commands to change the "legends", called "keys" in gnuplot. Start up
gnuplot, and check out "help set key". The interface between octave and gnuplot
for this sort of thing is the "gset" command.

Hope this helps,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Date: 11-Aug-98                                       Time: 13:49:55
--------------------------------------------------------------------


Reply | Threaded
Open this post in threaded view
|

Re: Changing the legend

A. Scottedward Hodel-2
In reply to this post by Preben Randhol-12
In the Octave plot function, you can say something like:

plot(time,wp,';x water pressure;',time,wf,'+ ;flowrate;');

i.e., put the legend label between semicolons after the line
style; see "help __pltopt__ for the line style options.

A S Hodel Dept Elect Eng, Auburn Univ,AL  36849-5201
On leave at NASA Marshall Space Flight Center (205) 544-1426

----------
>From: Preben Randhol <[hidden email]>
>To: [hidden email]
>Subject: Changing the legend
>Date: Tue, Aug 11, 1998, 6:55 AM
>

>
>Hi I am was wondering if somebody could explain how I change the
>legend name from line 1, line 2... to something more describing?
>
>In matlab there was a function called legend, but it does not seem to
>be the same in octave.
>
>I am sorry that I have only browsed quickly at the manual, but I have
>a report that I need to get finished ASAP, so if anybody could be so
>kind to give me the solution I would appreciate it a lot!
>
>--
>Preben Randhol                    | Azbuka, to je obracenej nabytek.
>Tlf    73940929/(735)94076 [arb]  |                  -- Bohumil Hrabal
>Email  [hidden email]            | [Transl:  Cyrilic, that's
>http://www.pvv.org/~randhol/      |           furniture uspide down.]
>



Reply | Threaded
Open this post in threaded view
|

Re: Changing the legend

John Logsdon-4
In reply to this post by Preben Randhol-12
Preben

Assuming you use the default gnuplot, try

m=1:10;plot(m,m,"-;Hello;")
n=1.5:9.5;l=10-n;hold on
plot(n,l,"@1;There;")
j=2.5:.75:7.5;j2=j.*j/5;plot(j2,j,"+-;;")

This will produce a 45 degree line, a -45 degree set of points and a third
a line with '+'s that is a curve that goes through the intersection.  The
label of the first is Hello, the second is There and there is no third
label.

There are various other options.  I don't think you can move the position
of the legend though - perhaps by getting into the gnuplot commands this
can be done.  Try help -i plot and look for FMT - the lines are defined a
few pages down but the labeling I think I saw on this mailling list some
time ago from the great and one-and-only jwe.

I used 2.0.9, which is getting a little old now.

John


Reply | Threaded
Open this post in threaded view
|

Re: Changing the legend

John W. Eaton-6
On 11-Aug-1998, John Logsdon <[hidden email]> wrote:

| Assuming you use the default gnuplot, try
|
| m=1:10;plot(m,m,"-;Hello;")
| n=1.5:9.5;l=10-n;hold on
| plot(n,l,"@1;There;")
| j=2.5:.75:7.5;j2=j.*j/5;plot(j2,j,"+-;;")
|
| This will produce a 45 degree line, a -45 degree set of points and a third
| a line with '+'s that is a curve that goes through the intersection.  The
| label of the first is Hello, the second is There and there is no third
| label.
|
| There are various other options.  I don't think you can move the position
| of the legend though - perhaps by getting into the gnuplot commands this
| can be done.

I don't think I saw anyone else mention that with recent beta releases
of gnuplot 3.6 it's possible to move the key around.  See the gnuplot
help for set key for details.  I don't know when this feature was
added to gnuplot, but it is in my copy of beta 340.

jwe