time | Calls | line |
---|
| | 1 | function pj = adjustGridLineStyles(state, pj)
|
| | 2 | % This undocumented helper function is for internal use.
|
| | 3 |
|
| | 4 | % if doing postscript and axes layer is 'top', and alpha is not 1 (opaque)
|
| | 5 | % then we want to change the GridLineStyle to ':' so it looks decent in
|
| | 6 | % output because postscript doesn't support transparency
|
| | 7 |
|
| | 8 | % Copyright 2014 The MathWorks, Inc.
|
| | 9 |
|
< 0.001 | 2 | 10 | if ~(pj.temp.isPostscript && pj.temp.outputUsesPainters)
|
< 0.001 | 2 | 11 | return; % only for truly vectorized postscript formats
|
| | 12 | end
|
| | 13 | if strcmp(state, 'save')
|
| | 14 | % save state, if needed
|
| | 15 | gridAx = findall(pj.Handles{1}, ...
|
| | 16 | {'Type', 'axes', '-or', 'Type','polaraxes'}, ...
|
| | 17 | 'Visible', 'on', 'Layer', 'top', ...
|
| | 18 | 'GridLineStyleMode', 'auto', '-not', 'GridAlpha', 1);
|
| | 19 | if ~isempty(gridAx)
|
| | 20 | pj.temp.gridData.ax = gridAx;
|
| | 21 | pj.temp.gridData.linestyle = get(gridAx, 'GridLineStyle');
|
| | 22 | pj.temp.gridData.linestyleMode = get(gridAx, 'GridLineStyleMode');
|
| | 23 | % make sure to have cell arrays to make it easier to restore later
|
| | 24 | if ~iscell(pj.temp.gridData.linestyle)
|
| | 25 | pj.temp.gridData.linestyle = {pj.temp.gridData.linestyle};
|
| | 26 | pj.temp.gridData.linestyleMode = {pj.temp.gridData.linestyleMode};
|
| | 27 | end
|
| | 28 | set(gridAx, 'GridLineStyle', ':');
|
| | 29 | pj.temp.test.adjustGridLineStyles = 'set';
|
| | 30 | end
|
| | 31 | else
|
| | 32 | % restore previously saved values
|
| | 33 | if isfield(pj.temp, 'gridData') && ~isempty(pj.temp.gridData.ax)
|
| | 34 | set(pj.temp.gridData.ax, {'GridLineStyle'}, pj.temp.gridData.linestyle);
|
| | 35 | set(pj.temp.gridData.ax, {'GridLineStyleMode'}, pj.temp.gridData.linestyleMode);
|
| | 36 | pj.temp.test.adjustGridLineStyles = 'restore';
|
| | 37 | end
|
| | 38 | end
|
| | 39 |
|
| | 40 | end
|
Other subfunctions in this file are not included in this listing.