I am using octave to create a plot with two curves on it with a legend labeling each curve. The following code plots each curve and adds a label to the legend.
My problem is, this code works perfectly on my netbook but not on my desktop. The legend should have two entries; "Analytical Output" with a blue line next to it, and "Simulated Output" with a red line next to it. When I run it on my desktop, the legend only has only entry in it: "Simulated Output" with a blue line next to it. It seems like it is only processing the second legend command and linking it to the first plot command.Code:plot(time_Ey,Ey_analytic,'b'); # add analytical vector to plot legend("Analytical Output"); # add label to legend hold on; # hold on plot(time_Ey,Ey(:,loc_D+1),'r');# add simulated vector to plot legend("Simulation Output"); # add label to legend hold off; # hold off
Netbook Info: Ubuntu 10.04 Netbook
Octave: version 3.2.3
gnuplot: Version 4.2 patchlevel 6
Desktop Info: Ubuntu 10.10 Desktop
Octave: version 3.2.4
gnuplot: version 4.4 patchlevel 0
I have tried many different methods to get my desktop to produce a proper legend but I am out of ideas.
I tried adding clf in the beginning, to clear the plot.
I tried moving the hold command around.
I tried using one legend command with the following code. It produced a legend with both entries, but put a blue line next to both.
I am stumped, any help or suggestions would be greatly appreciated. Thanks in advance.Code:legend("Analytical Output","Simulated Output");



Adv Reply

Bookmarks