Axes object in Octave 2.9.12 and other plotting questions

View: New views
3 Messages — Rating Filter:   Alert me  

Axes object in Octave 2.9.12 and other plotting questions

by mbn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have a script in Matlab (v 7) that plots a graph with two series and
that assigns "tick labels" to axis X. It is something like this (for
only one series):

%%%%%%%%%%%%%%%
figure1 = figure;

axes1 = axes('Parent',figure1,...
'xticklabel',
{'02/13';'02/14';'02/15';'02/16';'02/17';'02/18';'02/19';'02/20';'02/21';'02/22'},...
    'xtick',[0 24 48 72 96 120 144 168 192 216],...
    'position',[0.13 0.11 0.7943 0.815]);
box('on');
hold all

plot1 = plot(X1,YMatrix1);

set(plot1,'DisplayName','The name');
set(plot1,'Color',[0 0 1]);

legend1 = legend(axes1,'show');
set(legend1,'Location','NorthWest');

%%%%%%%%%%%%%%%

There are some problem with this script in Octave:

1) hold all. Runs normally in Matlab but Gives an error in Octave.
Commenting that line makes the error go away but no tick labels are
displayed either in Matlab or Octave

2) warning: set: invalid property `DisplayName' in Octave

3) error: legend: expecting argument to be a character string

My questions are:

- How can I assign tick labels to axis X that works in Octave (and
also if possible to be compatible with Matlab)

- How can I set the DisplayName of the series that I am plotting?

- How can I assign a legend to an axes object and set its position and
text?

Thanks!

Axes object in Octave 2.9.12 and other plotting questions

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This list was set up for the discussion of future graphics and GUI
tools in Octave, but is now nearly dead.  For questions about how to
use the current graphics features in Octave, please use the help list
since there are many more subscribers there who might be able to
answer your questions.

Not all of Matlab's handle graphics features are supported in Octave.
If you'd like to help improve that situation, then please join the
maintainers mailing list and contribute some code.

jwe


On 12-Jun-2007, Mark B. wrote:

|
| Hello,
|
| I have a script in Matlab (v 7) that plots a graph with two series and
| that assigns "tick labels" to axis X. It is something like this (for
| only one series):
|
| %%%%%%%%%%%%%%%
| figure1 = figure;
ppp|
| axes1 = axes('Parent',figure1,...
| 'xticklabel',
| {'02/13';'02/14';'02/15';'02/16';'02/17';'02/18';'02/19';'02/20';'02/21';'02/22'},...
|     'xtick',[0 24 48 72 96 120 144 168 192 216],...
|     'position',[0.13 0.11 0.7943 0.815]);
| box('on');
| hold all
|
| plot1 = plot(X1,YMatrix1);
|
| set(plot1,'DisplayName','The name');
| set(plot1,'Color',[0 0 1]);
|
| legend1 = legend(axes1,'show');
| set(legend1,'Location','NorthWest');
|
| %%%%%%%%%%%%%%%
|
| There are some problem with this script in Octave:
|
| 1) hold all. Runs normally in Matlab but Gives an error in Octave.
| Commenting that line makes the error go away but no tick labels are
| displayed either in Matlab or Octave
|
| 2) warning: set: invalid property `DisplayName' in Octave
|
| 3) error: legend: expecting argument to be a character string
|
| My questions are:
|
| - How can I assign tick labels to axis X that works in Octave (and
| also if possible to be compatible with Matlab)
|
| - How can I set the DisplayName of the series that I am plotting?
|
| - How can I assign a legend to an axes object and set its position and
| text?
|
| Thanks!
|
| --
| View this message in context: http://www.nabble.com/Axes-object-in-Octave-2.9.12-and-other-plotting-questions-tf3909588.html#a11085343
| Sent from the Octave - Graphics mailing list archive at Nabble.com.
|
| _______________________________________________
| Octave-graphics mailing list
| Octave-graphics@...
| https://www.cae.wisc.edu/mailman/listinfo/octave-graphics
_______________________________________________
Octave-graphics mailing list
Octave-graphics@...
https://www.cae.wisc.edu/mailman/listinfo/octave-graphics

Re: Axes object in Octave 2.9.12 and other plotting questions

by Daniel J Sebald :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark B. wrote:

> Hello,
>
> I have a script in Matlab (v 7) that plots a graph with two series and
> that assigns "tick labels" to axis X. It is something like this (for
> only one series):
>
> %%%%%%%%%%%%%%%
> figure1 = figure;
>
> axes1 = axes('Parent',figure1,...
> 'xticklabel',
> {'02/13';'02/14';'02/15';'02/16';'02/17';'02/18';'02/19';'02/20';'02/21';'02/22'},...
>     'xtick',[0 24 48 72 96 120 144 168 192 216],...
>     'position',[0.13 0.11 0.7943 0.815]);
> box('on');
> hold all
>
> plot1 = plot(X1,YMatrix1);
>
> set(plot1,'DisplayName','The name');
> set(plot1,'Color',[0 0 1]);
>
> legend1 = legend(axes1,'show');
> set(legend1,'Location','NorthWest');
>
> %%%%%%%%%%%%%%%
>
> There are some problem with this script in Octave:
>
> 1) hold all. Runs normally in Matlab but Gives an error in Octave.
> Commenting that line makes the error go away but no tick labels are
> displayed either in Matlab or Octave
>
> 2) warning: set: invalid property `DisplayName' in Octave
>
> 3) error: legend: expecting argument to be a character string
>
> My questions are:
>
> - How can I assign tick labels to axis X that works in Octave (and
> also if possible to be compatible with Matlab)
>
> - How can I set the DisplayName of the series that I am plotting?
>
> - How can I assign a legend to an axes object and set its position and
> text?

Mark,

Graphics code is in a transitional period and there are some limitations at the
moment.  Some of the syntax you used simply isn't supported.  (Type "type
legend" to see.)  This should not be difficult to update, and if you'd like to
offer to do so, please do.

If you are using gnuplot as the underlying graphics for Octave, there is support
for any key position you can wish to have (interior corners, exterior corners,
manual placement):

http://gnuplot.sourceforge.net/demo_4.3/key.html

There may need to be some alteration to __go_draw_axes__ if the following
positions don't quite cover everything.

    case -1
          pos = "right bottom";
          inout = "outside";
        case 1
          pos = "right top";
        case 2
          pos = "left top";
        case 3
          pos = "left bottom";
        case 4
          pos = "right bottom";
        otherwise

There is an inherent limitation currently in gnuplot to do only a single key.
If multiple legends is what you want, that would be a feature request to gnuplot.

Regards,

Dan
_______________________________________________
Octave-graphics mailing list
Octave-graphics@...
https://www.cae.wisc.edu/mailman/listinfo/octave-graphics