Adding a reference line to a Boxplot

Hi,

I would like to add a reference line to a boxplot, but I cannot do it. This is not much difficult, but I cannot do it in GAUSS as I do not work with GAUSS regularly.

A simple example code:

// some data for box plot
x = rndn(100,1);
// Box plot
plotBox(0, x);

And I want to add a horizontal reference line of y=0.5.  Thank you in advance for providing help!

1 Answer



0



accepted

You can use plotAddXY to add a line to any type of plot. The location of the first box will be 1. If you add any other boxes, the next boxes will be at locations 2, 3, etc.

So we will start the line at 0, which will be to the left of your box and continue it to 2 which will be past your box.

// some data for box plot
x = rndn(100,1);

// Box plot
plotBox(0, x);

// Line coordinates
x_l = 0 | 2;
y_l = 0.5 | 0.5;

// Add horizontal line
plotAddXY(x_l, y_l);

If you need to control the width of the X-axis to make this like you want you can use plotSetXRange.

aptech

1,773

Your Answer

1 Answer

0
accepted

You can use plotAddXY to add a line to any type of plot. The location of the first box will be 1. If you add any other boxes, the next boxes will be at locations 2, 3, etc.

So we will start the line at 0, which will be to the left of your box and continue it to 2 which will be past your box.

// some data for box plot
x = rndn(100,1);

// Box plot
plotBox(0, x);

// Line coordinates
x_l = 0 | 2;
y_l = 0.5 | 0.5;

// Add horizontal line
plotAddXY(x_l, y_l);

If you need to control the width of the X-axis to make this like you want you can use plotSetXRange.


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.