MATLAB Answers

Grid on in subplot

205 views (last 30 days)
Rica on 21 Nov 2017
Answered: KL on 22 Nov 2017
Hi, i used the subplot function and want to apply to all the subplot this grid properties:
grid on
ax = gca;
ax.GridColor = [0 .5 .5];
ax.GridLineStyle = '--';
ax.GridAlpha = 0.5;
Is there any easy way to apply this without repeating it for every subplots? Thank you


Sign in to comment.

Accepted Answer

KL on 22 Nov 2017
You may want to use linkprop,
hlink = linkprop([ax1 ax2], {'GridColor','GridLineStyle','GridAlpha'});


Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by