plot grid in background

9 次查看(过去 30 天)
I use the gridxy (<http://www.mathworks.com/matlabcentral/fileexchange/9973-gridxy-v2-2-feb-2008>) function (because the original grid can not be modified properly), which works very well.
But in this example the grid is painted in the foreground in the exported png:
figure(1); clf;
x = [0:0.1:10];
y = sin(xaxis*pi/2).*xaxis;
xtemp = [x(1) ; x(:) ; x(end)] ;
ytemp = [0 ; y(:) ; 0 ] ;
% plot
hplot = fill(xtemp,ytemp, 'b');
set(hplot, 'FaceColor' , [0.5, 0.5, 0.75])
set(hplot, 'EdgeColor' , [0, 0, 0.25])
hgrid = gridxy(get(gca,'XTick'),get(gca,'YTick'),'Color',[0.6 0.6 0.6],'Linestyle','--', 'LineWidth', 0.6);
print(gcf, '-r400', ['test' '.png'], '-dpng');
If I could attach the resulting png you would see the problem directly...

采纳的回答

Matthias Pospiech

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by