![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/189790/image.png)
Change the Yaxis to dashed line
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Vinh Nguyen
am 6 Jul. 2018
Kommentiert: Vinh Nguyen
am 9 Jul. 2018
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!
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 6 Jul. 2018
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', '--');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/189790/image.png)
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Axis Labels finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!