From: Stuart on
Hi,

I've got a the following to make a plot:

figure
plot(time,pres,'k');
xlabel('Time (s)');
ylabel('Pressure (Pa)');
grid on;

But how can I change the grid line colour from black to grey so that are less obtrusive?

Thanks
From: Wayne King on
"Stuart " <wybrow(a)aol.com> wrote in message <he5seg$9fr$1(a)fred.mathworks.com>...
> Hi,
>
> I've got a the following to make a plot:
>
> figure
> plot(time,pres,'k');
> xlabel('Time (s)');
> ylabel('Pressure (Pa)');
> grid on;
>
> But how can I change the grid line colour from black to grey so that are less obtrusive?
>
> Thanks

Hi Stuart, you can use set(gca,'Xcolor',..) and set(gca,'Ycolor',...)

time = 1:100; pres = randn(1,100);
plot(time,pres,'k');
xlabel('Time (s)');
ylabel('Pressure (Pa)');
grid on;
set(gca,'Xcolor',[0.5 0.5 0.5]);
set(gca,'Ycolor',[0.5 0.5 0.5]);

% Note the the X and Y ticks will be the same color as the grid lines, if you still want the tick marks black, you can do the following

Caxes = copyobj(gca,gcf);
set(Caxes, 'color', 'none', 'xcolor', 'k', 'xgrid', 'off', 'ycolor','k', 'ygrid','off');

Hope that helps,
Wayne
 | 
Pages: 1
Prev: Connecting MATLAB to Web
Next: LNA Block