Property editor grid lines

9 ビュー (過去 30 日間)
John
John 2013 年 1 月 16 日
コメント済み: Tiago Dias 2018 年 1 月 12 日
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

採用された回答

Jan
Jan 2013 年 1 月 16 日
編集済み: Jan 2014 年 8 月 2 日
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 件のコメント
Pouya Jamali
Pouya Jamali 2014 年 7 月 15 日
any reason Mathworks doesn't provide an option to do this easier?
Tiago Dias
Tiago Dias 2018 年 1 月 12 日
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

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by