# Controlling Box Plot Outlier Option Dynamically

I’d like to be able to flip dynamically between showing a box plot representation with and without outliers. Is that possible? If not, is there a neat way to simulate the effect?

Since posting, I now realise that the ‘offset’ for a box plot can be a variable, and as my graph bounds are fixed, I can simulate one form of box plot replacing another simply by swapping them in and out of bounds using the same position within the graph. I’m assuming that there is no way to control the ‘exclude outliers’ tick box dynamically? …or switch the plots on and off dynamically? I’m still learning, so keen to know all the possibilities!

I haven’t used boxplots, but I’m guessing there is some similarity. You can for example dynamically display a function, or a point by setting restrictions.
In a graph:

``````f(x)=3x+5 {n=1}
(3,5 {n=0})
``````

Your variable n could be set by the push of a button, selection of a checkbox or multiple choice.

Not sure if you could use something similar for toggling outliers, or if it would result in NaN (which is why a point can be toggled with this method).

You may need to do some finagling of lists to have a second list without outliers, sorting it (since you’ll have undefined elements), finding the last defined value, and the using the list through that element for your boxplot. I think all these are possible, but I think there are others with the knowhow.

1 Like

Thanks Daniel, that is indeed a solution to my problem…and great to know in other situations! Defining two box plots for numberList ‘A’: boxplot(A{x=0}) and boxplot(A{x=1}), I can now flip between them using ‘x’ as a flag.

I also have a query about outliers in boxplots but I’ll post that separately.