Plotyy and giving each line its own color

조회 수: 3 (최근 30일)
matlabuser12
matlabuser12 2014년 10월 9일
댓글: matlabuser12 2014년 10월 9일
Is this possible? I have two curves plotting on the secondary axis and two on the primary. I can get each axis to graph in separate colors but I also want to have differentiation within a plotting axis.

답변 (1개)

Iain
Iain 2014년 10월 9일
It is possible. It might not be that good of an idea if it makes it hard to identify which line goes with which axis (using subplot & linkaxes is probably a better idea).
What you need to do, is get the line object for the curve you want to do something to, and tell it to set it's properties....
[axishandles curve1handle curve2handle] = plotyy(....);
get(curve1handle) % This will give you a list of properties you can change...
set(curve1handle,'property','new setting')
  댓글 수: 2
matlabuser12
matlabuser12 2014년 10월 9일
well i am hoping to have two labels on each axis since the label color seems to correspond with the line color.
matlabuser12
matlabuser12 2014년 10월 9일
so you have designated a primary and secondary axis with curve1handle and curve2handle respectively. but this will affect all curves tied to that axis. my current code looks similar:
[graph, p1,p2] = plotyy(..)
and I can only adjust colors for ALL p1 curves or ALL p2 curves, not individual curves plotting on p1.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by