About the whiskers of boxplot

Hi, I am reading the lesson about whiskers of boxplot: https://www.codecademy.com/courses/learn-statistics-with-python/lessons/boxplots-lesson/exercises/whiskers

It said

One more small detail to note — the whiskers usually don’t extend all the way to 1.5 times the IQR. Instead, they extend to the point closest to 1.5 times the IQR in the direction of the median. This means that instead of extending to -3.5 and 16.5 , the whiskers would actually extend to the first point greater than -3.5 and the first point less than 16.5 .

But in the graph, the point he took are -2 and 15 which either is not the first point greater than -3.5 or first point less than 16.5. Is is something wrong with the graph?

I think what they’re trying to say here is these would be the first points within those limits. So if 16.5 was the upper bound but there wasn’t a data point at this value you’d move back towards the centre (median) of the data to find the first point within these limits. So 15 would be a valid (upper) whisker if say you had data at 16.8 and 15.0 as 15.0 is the closest within the limits.

In the negatives moving towards the centre would be moving towards a positive value. So -2 could well be the first data point within the given limits.

I don’t think the example on the left relates to the dataset used in the lesson if that’s what’s bothering you.

Yes, the picutre is related and what you said is still confusing.

I’m sorry my description didn’t help but dataset given in the script you can run goes from roughly a min at roughly -6.2 to a max at roughly 6.7 with an IQR close to 3. I still don’t think the image in the instructions (on the left) is related to the dataset you’re given but try printing out the values you get from np.quantile and perhaps min and max and you can check for yourself.

I am saying , in the picture, that boxplot have left whiskers extend to -2 instead of -3 which is expected by me. Because -3 is the first point greater than -3.5

Are you given the data for that boxplot? I can’t see where the nearest data point is coming from.

Did you click the link and look at the lesson the link is giving?

Haha, I’m tempted to say otherwise but yes though I cannot see the actual dataset for the boxplot on the left given anywhere.

there is no so-called actual dataset. All we have is a example and it shows that boxplot have left whiskers extend to -2 instead of -3 which is expected by me. Because -3 is the first point greater than -3.5

By point I believe they’re referring to an actual data point which unfortunately you’re not shown. It wouldn’t have anything to do with the scaling of the x-axis.

You’ll just have to assume that the first real datapoint (an actual value in the data) greater than -3.5 is actually somewhere around -2.0.