Thursday, 15 September 2011

rotation - Rotate MATLAB legend -



rotation - Rotate MATLAB legend -

is there way rotate matlab legend within plot? image below should clarify requirement.

you'll need play around positioning, , need more work if have more 1 line plotted, next example.

plot(1:10); % create dummy line ha = legend('plot'); %create legend set(ha,'units','pixels'); % set axes unit pixels pos = get(ha,'position'); % axes position set(ha,'position',[pos(1) pos(2)-pos(3) pos(4) pos(3)]); % set new position hc = get(ha,'children'); % legend contents set(hc(3),'position',[0.5 0.6 0],'rotation',90); % relocate , rotate text set(hc(2),'xdata',[0.5 0.5],'ydata',[0.1 0.5]); % rotate line set(hc(1),'xdata',0.5,'ydata',0.3); % rotate marker

matlab rotation

No comments:

Post a Comment