stuck on graph format! please help
조회 수: 2 (최근 30일)
이전 댓글 표시
so this is what I have..
but i need to make my graph look like this
as far as my coding,
grid on;
axis('equal')
posdegreeline = refline(tand(angle),0);
negdegreeline = refline(-tand(angle),0);
posdegreeline.Color = 'r';
negdegreeline.Color = 'r';
o1 = gca;
o1.XAxisLocation = 'origin';
o1.YAxisLocation = 'origin';
hold off;
my angle is 45 degrees but red lines suppose to end below the origin. I can't figure out why also is there a way to adjust scale even though i used axis('equal')??
댓글 수: 0
답변 (1개)
Walter Roberson
2018년 2월 4일
In order to do this using refline(), you will need to create a second axes in which the YLim upper value is the same as the YLim upper value in the original axes, but the YLim lower value is set to 0; and in the second axes, the XLim will need to be [-4 4]. Now use refline() in that second axes and record the handles. Now take the resulting line objects and set their Parent property to be the first axes (and then delete the second axes.)
Personally, I think it would be much easier just to do a line() or plot()
YL = ylim();
Ymax = YL(2);
plot([-Ymax 0 Ymax], [Ymax, 0, yMax], 'r-');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!