Shaded area in the xy graph

Hi,

I am using GAUSS 16. I draw a xy graph. where y is the value of some estimates changing over x. Now, I would like to add the confidence bands around the line as a shaded area n. I couldn't figure out how to do this in GAUSS.  Basicall, xy(x,lowerbound~estimate~upperbound); would plot almost what I would like to have it without the shading.

thanks!

1 Answer



1



accepted

The version of GAUSS to be released in November of 2019 has a new function called plotXYFill exactly for this purpose.

In older versions, you can draw a stacked area plot with the bottom panel white to accomplish this. Here is a simple example:

// Simulate some numbers to plot
x = seqa(1, 1, 10);
y = sin(x ./ 10);

// Create vectors which will draw
// stacked area plot around 'y' line
err = 0.3;
y_low = y - 0.3;
y_high = reshape(0.6, 10, 1);

// Declare 'myPlot' to be a plotControl struct
// and fill with default settings
struct plotControl myPlot;
myPlot = plotGetDefaults("area");

plotSetGrid(&myPlot, "off");

// Make bottom stacked area white so we don't see it
plotSetFill(&myPlot, 1, 1, "white" $| "light gray");

// Draw stacked area plot for confidence bands
plotArea(myPlot, x, y_low ~ y_high);

// Add center line
plotAddXY(x, y);

which will produce a graph similar to this:

aptech

1,773

Your Answer

1 Answer

1
accepted

The version of GAUSS to be released in November of 2019 has a new function called plotXYFill exactly for this purpose.

In older versions, you can draw a stacked area plot with the bottom panel white to accomplish this. Here is a simple example:

// Simulate some numbers to plot
x = seqa(1, 1, 10);
y = sin(x ./ 10);

// Create vectors which will draw
// stacked area plot around 'y' line
err = 0.3;
y_low = y - 0.3;
y_high = reshape(0.6, 10, 1);

// Declare 'myPlot' to be a plotControl struct
// and fill with default settings
struct plotControl myPlot;
myPlot = plotGetDefaults("area");

plotSetGrid(&myPlot, "off");

// Make bottom stacked area white so we don't see it
plotSetFill(&myPlot, 1, 1, "white" $| "light gray");

// Draw stacked area plot for confidence bands
plotArea(myPlot, x, y_low ~ y_high);

// Add center line
plotAddXY(x, y);

which will produce a graph similar to this:


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.