modifying colours of plotyy axis within a subplot
이전 댓글 표시
OK so I have subplot with two plotyy, I can plot subplot(2,1,1) fine, but for the subplot(2,1,2) I am plotting two different types of data, and to make this clear I would like to change the colors of the ylabels and the yticks and ytick labels, but I'm having a few problems. What I have so far is:
subplot(2,1,2)
[haxes,hline1,hline2]=plotyy(DayTime,LOTMEAN,DayTime, LORAINFALL,'line','bar');
axes(haxes(1))
ylabel('Temperature (/circC)','Color','r');%which is fine
set(hline1('Color','r')); %but then I get an error when I try to set the line colour - anyone know why?
??? Index exceeds matrix dimensions.
Second problem, is I can't get the YColor to change
h=axis(YColor,'r'); %this is as written in help file
??? Undefined function or variable 'YColor'.
I ended up doing it in the Figure Properties in the GUI, but I can't figure out how to do this to the second axis, either in code or in Figure Properties. Is there a step by step guide for changing figure properties anywhere that might help? The help files don't explain things fully.
I would much appreciate any help to clear the confusion!!
Many thanks,
Cat
답변 (1개)
Image Analyst
2012년 4월 11일
Try putting it in single quotes:
h=axis('YColor','r');
댓글 수: 3
Catriona
2012년 4월 11일
Image Analyst
2012년 4월 11일
Oh well. This is what I saw in my help:
Properties That Control the X-, Y-, or Z-Axis
XColor, YColor, ZColor
ColorSpec
Color of axis lines. A three-element vector specifying an RGB triple, or a predefined MATLAB color string. This property determines the color of the axis lines, tick marks, tick mark labels, and the axis grid lines of the respective x-, y-, and z-axis. The default axis color is black. See ColorSpec for details on specifying colors.
Maybe try passing in a numerical color instead of a special color:
h=axis('YColor', [1 0 0]); % Red = [1 0 0]
Walter Roberson
2012년 4월 11일
Cat, which MATLAB version are you using?
카테고리
도움말 센터 및 File Exchange에서 Two y-axis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!