This function lightens or darkens plotted objects.
grayout(h) grayout(h,beta) newColor = grayout(...)
grayout(h) lightens objects given by the handle(s) h.
grayout(h,beta) lightens or darkens objects by a factor of beta. If beta = 1, the object becomes white. If beta = -1, the object becomes black. Default beta is 0.5.
newColor = grayout(...) returns rgb values of the new color(s).
Several often-used models exist to describe some observational data, but you've come up with your own brand new model that you want everyone to know is the best thing in science since sliced people in that Body Worlds exhibit. In a presentation you may want to start out by showing the observational data and the old models like this:
% Some data: x = 1:10; yData = x-5+x.^1.05; y1 = x; y2 = x-2; y3 = x-3; y4 = x-4; % Plot the data: figure hData = plot(x,yData,'mo','markersize',10,'markerfacecolor','g'); hold on; h1 = plot(x,y1,'r','linewidth',2); h2 = plot(x,y2,'b','linewidth',2); h34= plot(x,[y3;y4],'k','linewidth',2); box off axis([1 10 -5 20]) legend('data','conventional model','some other guy''s old model','defunct model 1',... 'defunct model 2','location','northwest') legend boxoff
And here's the part in your presentation where you say, "the old models are not good enough--don't you wish that someone could come up with a better way of describing the data?" Then the crowd waits for the unveil...
When you plot your own model you want it to stand out. Below, we plot your new model, then gray-out those old models because they're a thing of the past. We will also darken the observational data simply to show how to do it, and then bring the observational data to the front so it's not buried by the antequated models.
myNewModel = x - 5.5 + x.^1.1; plot(x,myNewModel,'r','linewidth',2); % Update the legend to include your new amazing model: legend('data','conventional model','some other guy''s old model','defunct model 1',... 'defunct model 2','my new amazing model','location','northwest') legend boxoff grayout(h1) % washes out "conventional model" grayout([h2;h34],.8) % washess out other models grayout(hData,-.5) % darkens data uistack(hData,'top') % brings data to front
The grayout function was written by Chad A. Greene of the Institute for Geophysics at the University of Texas at Austin. July 2014.