Sets the width of the boxes in box plots.


plotSetBoxWidth(&myPlot, boxWidth)
  • &myPlot (struct pointer) – A plotControl structure pointer.

  • boxWidth (Scalar) – Width of the boxes in plot set between 0 and 1. If set to 1, the boxes will touch each other. Default box width is 0.5.


// Import data
auto2 = loadd(getGAUSSHome() $+ "examples/auto2.dta");

// Declare plotControl structure
// and fill in default values for box plot
struct plotControl myPlot;
myPlot = plotGetDefaults("box");

// Set box width to 50% of available width
plotSetBoxWidth(&myPlot, 0.5);

// Draw the two boxes
plotBox(myPlot, auto2, "mpg ~ foreign");


This function sets an attribute in a plotControl structure. It does not affect an existing graph, or a new graph drawn using the default settings that are accessible from the Tools > Preferences > Graphics menu.