Hello, I am trying to plot 1 figure with 2 Yaxis. I want one of the Yaxis is dashed. How can I do this?
Thanks!

 채택된 답변

Image Analyst
Image Analyst 2018년 7월 6일

3 개 추천

Try this:
% Plot something.
h = plot(sind(1:1000));
ax = gca % Get handle to current axes object.
xl = xlim(); % Find out x location of the y axis.
% Cover up existing axis with a white line.
line([xl(1), xl(1)], ylim, 'color', 'w', 'LineWidth', 2);
% Draw a dashed line on top of the white line.
line([xl(1), xl(1)], ylim, 'color', 'k', 'LineStyle', '--');

댓글 수: 3

Vinh Nguyen
Vinh Nguyen 2018년 7월 9일
편집: Vinh Nguyen 2018년 7월 9일
Thanks! It is a good trick. But there is still a thin gray line next to the yaxis left though.
Image Analyst
Image Analyst 2018년 7월 9일
Try adjusting the width of the white line.
Vinh Nguyen
Vinh Nguyen 2018년 7월 9일
Got it by adjusting the width of the yaxis. Thanks for your help.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

질문:

2018년 7월 6일

댓글:

2018년 7월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by