# Updated with 'Grouping' - Boxplots for Work Intervals

**URL:** <https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382>\
**Category:** Uncategorized\
**Created:** [30 December 2023 00:48 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382 "2023-12-30T00:48:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![MedTechCD](https://forum.intervals.icu/user_avatar/forum.intervals.icu/medtechcd/32/40383_2.png) [@MedTechCD](https://forum.intervals.icu/u/MedTechCD)\
**Post date:** [30 December 2023 00:48 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/1 "2023-12-30T00:48:07Z")

</div>

I wanted a uniform way of visualizing the data for Work Intervals and created a series of boxplots. I have ‘stolen’ some ideas from other charts made by contributing members and brought it all together. There are a total of 10 charts. For both running/cycling:

- Heartrate in bpm
- Power in w
- dfa-a1
- RR/a1
- Respiration in brpm

For cycling:

- Cadence in rpm

For running:

- Run cadence in spm
- Stride length in cm
- Pace - Velocity in m/sec
- GA velocity in m/sec

There’s a line in the script for ‘mean’ value (average), but it’s commented because I consider that to ‘crowded’. Turn it on if you want.

They are all publicly shared.  
Example for running:

 ![image](https://forum.intervals.icu/uploads/default/original/3X/9/f/9fec28e738d8b03806c6a5eb8758e009c95b74f1.png)  
 ![image](https://forum.intervals.icu/uploads/default/original/3X/7/7/77399fbee181a3d05bb4f82e3bc15fa516f12e8a.png)

And for cycling

 ![image](https://forum.intervals.icu/uploads/default/original/3X/b/d/bdcda17ff850652f95533a8c105de524ed887c24.png)

Edit: added one line of code to avoid errors if the stream is absent. Plots for unavailable streams will no longer display.  
PS: if no intervals exist, all plots will be ‘empty’.

Edit: changed code to use interval\_index iso interval\_time because time causes errors when there is stopped time in an interval. Thanks to @Andreas_Haigermoser for troubleshooting! If you see strange behaviour, update your copy of the boxplots by deleting it and adding the modified ones.

---

<div class="post-metadata">

**Author:** ![OMR60](https://forum.intervals.icu/user_avatar/forum.intervals.icu/omr60/32/72692_2.png) [@OMR60](https://forum.intervals.icu/u/OMR60)\
**Post date:** [30 December 2023 09:00 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/2 "2023-12-30T09:00:59Z")

</div>

These look great… I was looking to add them from the publicly available Activity Chart list but can’t see them. Am I in the wrong place?

 ![IMG_7380](https://forum.intervals.icu/uploads/default/original/3X/5/6/564c1a811e49aa5c0d46a7275ecb15ffa44bf76c.jpeg)

Many thanks!

---

<div class="post-metadata">

**Author:** ![MedTechCD](https://forum.intervals.icu/user_avatar/forum.intervals.icu/medtechcd/32/40383_2.png) [@MedTechCD](https://forum.intervals.icu/u/MedTechCD)\
**Post date:** [30 December 2023 09:10 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/3 "2023-12-30T09:10:46Z")

</div>

You should find them from the bottom of the Activty Intervals page.  
Let me know if you can get them, will check if I made a mistake.

 ![Screenshot_20231230_100923_Brave](https://forum.intervals.icu/uploads/default/original/3X/f/9/f9349396ebc863044fcffdea49e62d8caccd5137.jpeg)

---

<div class="post-metadata">

**Author:** ![OMR60](https://forum.intervals.icu/user_avatar/forum.intervals.icu/omr60/32/72692_2.png) [@OMR60](https://forum.intervals.icu/u/OMR60)\
**Post date:** [30 December 2023 09:19 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/4 "2023-12-30T09:19:35Z")

</div>

Got them - thank you!

---

<div class="post-metadata">

**Author:** ![Cooper](https://forum.intervals.icu/user_avatar/forum.intervals.icu/cooper/32/31272_2.png) [@Cooper](https://forum.intervals.icu/u/Cooper)\
**Post date:** [30 December 2023 10:03 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/5 "2023-12-30T10:03:13Z")

</div>

Thank you 👍

---

<div class="post-metadata">

**Author:** ![MedTechCD](https://forum.intervals.icu/user_avatar/forum.intervals.icu/medtechcd/32/40383_2.png) [@MedTechCD](https://forum.intervals.icu/u/MedTechCD)\
**Post date:** [30 December 2023 14:08 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/6 "2023-12-30T14:08:44Z")

</div>

@david David, I noticed that these new charts do not show up on the list of shared charts unless you specifically search for them. (search for ‘box’ brings them up right away)  
I also don’t see them listed as shared on my profile page.

And a second thing: can I check the interval type also as ‘selected’? I used WORK in the scripts above but I just got the idea to maybe add 2 more boxplots to the right which summarize the ‘selected’ and not ‘selected’ intervals. That would make a nice view for a structured workout with 2 different types of intervals.

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [31 December 2023 08:37 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/7 "2023-12-31T08:37:27Z")

</div>

These charts are great, thanks! I have made the search return 100 results (was 30) which gets everything currently. The results are sorted by usage count which doesn’t favour new stuff. I need to figure out how to make that better.

Which intervals are selected is currently client side only state and the charts are rendered once on the server. And it would be a bit slow to re-render that chart whenever that changes.

---

<div class="post-metadata">

**Author:** ![John\_Peters\_endura.f](https://forum.intervals.icu/user_avatar/forum.intervals.icu/john_peters_endura.f/32/60975_2.png) [@John\_Peters\_endura.f](https://forum.intervals.icu/u/John_Peters_endura.f)\
**Post date:** [31 December 2023 11:04 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/8 "2023-12-31T11:04:56Z")

</div>

Thanks @MedTechCD Box plots were the very beginnings of EnDuRA. Will be make use of these in the next 12 months 👍

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [31 December 2023 12:31 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/9 "2023-12-31T12:31:45Z")

</div>

> [@MedTechCD](#):
>
> That would make a nice view for a structured workout with 2 different types of intervals.

You might be able to do that using the interval label’s as “subtypes” to group them.

---

<div class="post-metadata">

**Author:** ![MedTechCD](https://forum.intervals.icu/user_avatar/forum.intervals.icu/medtechcd/32/40383_2.png) [@MedTechCD](https://forum.intervals.icu/u/MedTechCD)\
**Post date:** [2 January 2024 20:12 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/10 "2024-01-02T20:12:08Z")

</div>

All my boxplots now have a ‘Grouping’ functionality. Grouping is done by the interval label. It’s all dynamic. If a label occurs twice or more, you will get an extra boxplot to the right that summarizes all intervals with same label. Blank labels are also handled. Summaries have a denser colour and a # in the label  
If you want the new functionality, you wil need to remove the existing chart and re-add it.  
If you don’t like it, the first line in the script has a toggle. Set the ‘grouping’ variable to false if you don’t want grouping.

 ![image](https://forum.intervals.icu/uploads/default/original/3X/a/a/aa9abe6e06a494fbbba1823e5b9b8a84470b6aa9.png)

---

<div class="post-metadata">

**Author:** ![Engywook](https://forum.intervals.icu/user_avatar/forum.intervals.icu/engywook/32/30824_2.png) [@Engywook](https://forum.intervals.icu/u/Engywook)\
**Post date:** [4 January 2024 10:50 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/11 "2024-01-04T10:50:44Z")

</div>

I cannot find them. Searching for box show 0 results 🤔

---

<div class="post-metadata">

**Author:** ![app4g](https://forum.intervals.icu/user_avatar/forum.intervals.icu/app4g/32/41800_2.png) [@app4g](https://forum.intervals.icu/u/app4g)\
**Post date:** [4 January 2024 11:00 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/12 "2024-01-04T11:00:08Z")

</div>

Go to any activity

 ![Screenshot 2024-01-04 at 6.57.39 PM](https://forum.intervals.icu/uploads/default/original/3X/3/f/3f15e8efbffb0651afb7f0c7d0a474e1e2830738.png)

go to IntervalData. Then all the way at the bottom: CHARTs

 ![Screenshot 2024-01-04 at 6.58.21 PM](https://forum.intervals.icu/uploads/default/original/3X/e/a/ea60c8994c7ff8eae8b24e6c6830f98a07a06a3a.png)

Use the Magnfying glass

 ![Screenshot 2024-01-04 at 6.59.14 PM](https://forum.intervals.icu/uploads/default/original/3X/8/c/8cd13bc190574d95babb68b5c1fa4bbbf624e13d.png)

Then type in “BOX” at the search

 ![Screenshot 2024-01-04 at 6.59.43 PM](https://forum.intervals.icu/uploads/default/original/3X/7/8/78b4de1c273f73ba6576ed3cd64a96cb037733e8.jpeg)

---

<div class="post-metadata">

**Author:** ![Engywook](https://forum.intervals.icu/user_avatar/forum.intervals.icu/engywook/32/30824_2.png) [@Engywook](https://forum.intervals.icu/u/Engywook)\
**Post date:** [4 January 2024 11:12 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/13 "2024-01-04T11:12:01Z")

</div>

thanks, i was missing the part on interval data.

---

<div class="post-metadata">

**Author:** ![Nimmerichter](https://forum.intervals.icu/user_avatar/forum.intervals.icu/nimmerichter/32/44090_2.png) [@Nimmerichter](https://forum.intervals.icu/u/Nimmerichter)\
**Post date:** [4 January 2024 15:42 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/14 "2024-01-04T15:42:49Z")

</div>

these are very useful boxplots,  
thanks @MedTechCD

---

<div class="post-metadata">

**Author:** ![Andreas\_Haigermoser](https://forum.intervals.icu/user_avatar/forum.intervals.icu/andreas_haigermoser/32/35453_2.png) [@Andreas\_Haigermoser](https://forum.intervals.icu/u/Andreas_Haigermoser)\
**Post date:** [28 March 2024 18:47 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/15 "2024-03-28T18:47:19Z")

</div>

These charts are really great. But I have a problem, which happens sometimes.  
In this example the mean values in the intervals are as follows:

 ![image](https://forum.intervals.icu/uploads/default/original/3X/d/8/d8582a094fd5958366507a9d6c7cb8ef9f376017.png)  
But the boxplot chart shows different things:  
 ![image](https://forum.intervals.icu/uploads/default/original/3X/5/4/546f343490b5b312500c435aa4977a301768ef98.png)  
My impression is, that this happens if intervals are edited. I changed to “use laps” in this case. David mentioned that the charts are rendered once on the server. Coukd this cause this effect? Is it possible for the user to initiate a new rendering ?

---

<div class="post-metadata">

**Author:** ![MedTechCD](https://forum.intervals.icu/user_avatar/forum.intervals.icu/medtechcd/32/40383_2.png) [@MedTechCD](https://forum.intervals.icu/u/MedTechCD)\
**Post date:** [28 March 2024 19:24 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/16 "2024-03-28T19:24:35Z")

</div>

Browser refresh while on the interval data page should give you changes. F5 in Windows.

---

<div class="post-metadata">

**Author:** ![Andreas\_Haigermoser](https://forum.intervals.icu/user_avatar/forum.intervals.icu/andreas_haigermoser/32/35453_2.png) [@Andreas\_Haigermoser](https://forum.intervals.icu/u/Andreas_Haigermoser)\
**Post date:** [28 March 2024 21:11 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/17 "2024-03-28T21:11:29Z")

</div>

F5 does not change the figure.

---

<div class="post-metadata">

**Author:** ![MedTechCD](https://forum.intervals.icu/user_avatar/forum.intervals.icu/medtechcd/32/40383_2.png) [@MedTechCD](https://forum.intervals.icu/u/MedTechCD)\
**Post date:** [29 March 2024 11:46 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/18 "2024-03-29T11:46:10Z")

</div>

Please explain what te problem is because I can’t see what’s wrong.  
There are 18 intervals, and the table gives you the ‘Average’ power.  
The plot gives you the ‘Mean’, 25 percentile, 75 percentile, max and min power for each interval and the same for the grouped intervals.  
Are you confused about the difference between and Avg and Mean perhaps?  
Average is the mathematical average of all points.  
Mean is the value of the midpoint, meaning that there are as many datapoints below as there are above that point. The box is where 50% of all datapoints lie and the extremes are the max and min.

---

<div class="post-metadata">

**Author:** ![Andreas\_Haigermoser](https://forum.intervals.icu/user_avatar/forum.intervals.icu/andreas_haigermoser/32/35453_2.png) [@Andreas\_Haigermoser](https://forum.intervals.icu/u/Andreas_Haigermoser)\
**Post date:** [29 March 2024 14:14 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/19 "2024-03-29T14:14:53Z")

</div>

Take e.g. interval 14: The average is 306 W in the first plot, the median is 59 W and the max is 82 W.  
The values in the boxplot do not correspond to the time history of the power. In the next plot you see the last 6 intervals, no. 14 is here the second one. The max value is 412 W, min is 232 W as shown in the figure.

 ![image](https://forum.intervals.icu/uploads/default/original/3X/9/5/9519bacd8fca38a8d4c65f2cb47e5f594a3322cd.png)  
Apparently the boxplot uses wrong data. Remarkable is that this happens only in some cases. There are others where the plot looks perfect.  
David mentioned on Dec '23 that the selection of intervals is client side only state and the charts are rendered only once on the server. Can this be the reason for the wrong figure?

---

<div class="post-metadata">

**Author:** ![MedTechCD](https://forum.intervals.icu/user_avatar/forum.intervals.icu/medtechcd/32/40383_2.png) [@MedTechCD](https://forum.intervals.icu/u/MedTechCD)\
**Post date:** [30 March 2024 14:50 UTC](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382/20 "2024-03-30T14:50:23Z")

</div>

Can you show the intervals data page table please?  
It looks like the boxplot script is confused by what is a ‘Work’ interval or not. I went over te script already but it’s not clear to me why the Work intervals would not be detected correctly. Maybe it has something to do with the workout that is coupled to the activity. I see in your screenshots that the workout is not aligned with the activity. Did you already try to align them? Options menu at te bottom, Workout slider.

> [@Andreas\_Haigermoser](#):
>
> David mentioned on Dec '23 that the selection of intervals is client side only state and the charts are rendered only once on the server. Can this be the reason for the wrong figure?

I have never seen any problem on my data, simply refreshing the page immediately takes the newly set intervals into account.

[Next page](https://forum.intervals.icu/t/updated-with-grouping-boxplots-for-work-intervals/56382.md?page=2)
