Is there any way to have grid on as default?
52 views (last 30 days)
Show older comments
Netanel Freinkel
on 30 Apr 2020
Answered: Guilherme Scofano
about 14 hours ago
Hi!
Is there any way to make matlab plot all my figures (bode, step, simple plots etc.) with grids? I find it much better.
Thanks!
0 Comments
Accepted Answer
Mehmed Saad
on 30 Apr 2020
set(groot,'defaultAxesXGrid','on')
set(groot,'defaultAxesYGrid','on')
figure,plot(1:10)
11 Comments
Nicholas Tarasenko
on 3 Feb 2022
Edited: Nicholas Tarasenko
on 3 Feb 2022
I wanted to provide a second method that follows closely to @Mehmed Saad. I have a file called "startup.m" in my MATLAB paths. In the startup file I set the default for all of my plots for every session. I did this so that I don't have to remember to include the default plot syntax in every script.
My startup script has the following defaults:
set(0,'defaultaxesfontname','Helvetica')
set(0,'defaulttextfontname','Helvetica')
set(0,'defaultaxesfontsize',15)
set(0,'defaultaxesfontweight','Bold')
set(0,'defaulttextfontsize',15)
set(0,'defaulttextfontweight','Bold')
set(0,'DefaultLineLineWidth',1.2)
set(0,'DefaultFigureColor', 'white');
set(0,'defaultAxesXGrid','on')
set(0,'defaultAxesYGrid','on')
More Answers (1)
Guilherme Scofano
6 minutes ago
TL;DR:
ctrlpref
Then "Style" tab > Show grids by default.
The Control Toolbox plot functions (bode, bodeplot, pzmap, step, stepplot, lsim, etc.) have a different set of configurations, so changing properties in groot, generally does not work.
If you want to change default settings (grids on/off, title font size, etc.) for these functions, you have to go to the "Control System and System Identification Toolbox Preferences" dialog window.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!