Hi,
I'm creating a plot with two lines on the y-axis and one on the secondary y-axis. I'm trying to change colors, but can't seem to get anywhere.
figure('Color',[1 1 1]);
plot(x1, y1, 'b', x2, y2,'r')
hold on;
[ax,p1, p2] = plotyy(x1,y1,x1,dx,'plot','plot');
xlabel(ax(1),'Range (m)')
ylabel(ax(1),'Depth (m)')
ylabel(ax(2),'\delta c (m/s)')
p2.LineStyle = '--';
I want the line on the secondary axis to be black .I also want to change the color of both y-axes to black.
Thank you. (Sorry, I'm still in the process of learning MatLab)
Also, If I change plotyy to
[ax,p1,p2] = plotyy(x,[y1, y2],x,dx,'plot','plot');
legend([p1;p2],'y1','y2','y3');
to handle everything in one plot, I get a figure with two axes and a legend, but none of the three graphs.
Edit:
Ok, I noticed my x1/y1 and x2/y2 vectors have different lengths. However, when I adjust that, I still don't get anything.
Can I, instead of having one x-argument und two y-arguments for the left-side y-axis have one y-argument and two x-arguments? Already tried writing it something like
[ax,p1,p2] = plotyy([x1,x2], y2,x1,dx,'plot','plot');
and
[ax,p1,p2] = plotyy([x1,y1,x2, y2],x1,dx,'plot','plot');
but neither works. I keep getting an error that "vectors must be same length" - which they are.