Change the Yaxis to dashed line

21 次查看(过去 30 天)
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
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 个评论
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 个)

类别

Help CenterFile Exchange 中查找有关 Graphics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by