Change the Yaxis to dashed line

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!

 Respuesta aceptada

Image Analyst
Image Analyst el 6 de Jul. de 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', '--');

3 comentarios

Vinh Nguyen
Vinh Nguyen el 9 de Jul. de 2018
Editada: Vinh Nguyen el 9 de Jul. de 2018
Thanks! It is a good trick. But there is still a thin gray line next to the yaxis left though.
Image Analyst
Image Analyst el 9 de Jul. de 2018
Try adjusting the width of the white line.
Vinh Nguyen
Vinh Nguyen el 9 de Jul. de 2018
Got it by adjusting the width of the yaxis. Thanks for your help.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Object Properties en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 6 de Jul. de 2018

Comentada:

el 9 de Jul. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by