Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor grid style #1134

Open
andrevidalsoares opened this issue Nov 22, 2023 · 0 comments
Open

minor grid style #1134

andrevidalsoares opened this issue Nov 22, 2023 · 0 comments

Comments

@andrevidalsoares
Copy link

The minor grid style default in pgfplots is solid line, not dotted as the default in MATLAB, so this change would make it

I changed lines 1007-1011 from this:
[minorGridLS, isDefault] = getAndCheckDefault(...
'axes', handle, 'MinorGridLineStyle', ':');
if ~isDefault || m2t.args.strict
minorGridOpts = opts_add(minorGridOpts, translateLineStyle(minorGridLS));
end
To this:
[minorGridLS, ~] = getAndCheckDefault(...
'axes', handle, 'MinorGridLineStyle', ':');
%If statement removed because dotted style is not default in pgfplots
minorGridOpts = opts_add(minorGridOpts, translateLineStyle(minorGridLS));

Also, to actually draw the minor grid lines we need to set minor tick num. Usually MATLAB draws three lines between major ticks. My workaround was to create minor ticks without the minor tick labels by adding this after line 1006:
matlabDefaultNumMinorTicks = 3;
minorGridOpts = opts_add(minorGridOpts, 'minor tick num', num2str(matlabDefaultNumMinorTicks));
minorGridOpts = opts_add(minorGridOpts, 'minor tick style', '{draw=none}');
Of course this will conflict whenever you actually have minor tick labels, specially with the {draw=none} option. Hopefully you guys can come up with something smarter for this problem.

Thanks,
Andre

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant