Property editor grid lines

8 visualizzazioni (ultimi 30 giorni)
John
John il 16 Gen 2013
Commentato: Tiago Dias il 12 Gen 2018
Hello,
Can you make the grid line in a plot thicker in the property editor? I want to make mine more visible but cannot figure how.
Thanks

Risposta accettata

Jan
Jan il 16 Gen 2013
Modificato: Jan il 2 Ago 2014
No, this does not work from the property editor.
But you can draw lines manually also:
% Create a test diagram:
AxesH = axes;
x = linspace(0, 2*pi, 100); % Test data
plot(x, sin(x));
% The modifications start here:
GridStyle.Color = [0.2, 0.4, 0.1];
GridStyle.LineStyle = '-';
GridStyle.LineWidth = 2.5;
GridStyle.HitTest = 'off';
Child = get(AxesH, 'Children');
XTick = get(AxesH, 'XTick');
YTick = get(AxesH, 'YTick');
XLimit = get(AxesH, 'XLim');
YLimit = get(AxesH, 'YLim');
newGrid = cat(1, ...
line([XTick; XTick], YLimit, 'Parent', AxesH, GridStyle), ...
line(XLimit, [YTick; YTick], 'Parent', AxesH, GridStyle));
% New grid on top or bottom of other objects:
set(AxesH, 'Child', [newGrid; Child(:)]);
% Or: set(AxesH, 'Child', [Child(:); newGrid]);
% Disable original dashed grid:
set(AxesH, ...
'XGrid', 'off', ...
'YGrid', 'off', ...
'YTickMode', 'manual', ...
'TickLength', zeros(1, 2));
  2 Commenti
Pouya Jamali
Pouya Jamali il 15 Lug 2014
any reason Mathworks doesn't provide an option to do this easier?
Tiago Dias
Tiago Dias il 12 Gen 2018
hello, thanks for your reply, but the code doesn't work 100% for me, I have vertical lines in the grid, that aren't displayed.
Any idea why? my X is datatime, for Apr 2016 no vertical line, for Jul2016 a vertical line appears, for Oct 2016 no line, for jan 2017 i have a line and so on.
This only appears when i maximize the window of the .fig file

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Graphics Object Properties in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by