help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem getting legend to work with plotyy


From: Carl Poirier
Subject: Problem getting legend to work with plotyy
Date: Tue, 2 Feb 2016 22:18:29 -0500

Hi folks,

I run Octave 4.0.0 on Linux. I need some help generating a plot with two axis and a legend indicating which curve is which. The latter however appears offset from the plot and also makes two new axis appear out of nowhere.

I crafted a small example, derived from the demonstration 1 in the plotyy documentation. Here it is:

 clf;
 x = 0:0.1:2*pi;
 y1 = sin (x);
 y2 = exp (x - 1);
 [ax, h1, h2] = plotyy (x,y1, x-1,y2, @plot, @semilogy);
 xlabel ('X');
 ylabel (ax(1), 'Axis 1');
 ylabel (ax(2), 'Axis 2');
 text (0.5, 0.5, 'Left Axis', ...
       'color', [0 0 1], 'horizontalalignment', 'center', 'parent', ax(1));
 text (4.5, 80, 'Right Axis', ...
       'color', [0 0.5 0], 'horizontalalignment', 'center', 'parent', ax(2));
 title ({'plotyy() example'; 'Left axis uses @plot, Right axis uses @semilogy'});
 legend ([h1, h2], {'one', 'two'}, 'location', 'northwest');

Would any of you know how to solve this? To me it sounds like a bug.

Regards,

Carl

reply via email to

[Prev in Thread] Current Thread [Next in Thread]