Add a check box in the distribution of TableReport to switch between a percentage of numbers in the plot.#1506
Add a check box in the distribution of TableReport to switch between a percentage of numbers in the plot.#1506lionelkusch wants to merge 16 commits into
Conversation
For the histogramm, I add text for displaying the percentage of each bar, same as for values_count. I try to reuse the ideas of display value for displaying on the histogram
[doc build]
[doc build]
[doc build]
[doc build]
|
thanks a lot @lionelkusch this is neat! However I wonder if it is worth doubling to computation time used to produce a report as this is something we've been meaning to keep fast for interactive use in a notebook. and there is the added complexity to the html and javascript 🤔 What do others think? |
|
I have the same question as @jeromedockes (sorry @lionelkusch , we really appreciate your involvement) |
|
In the short time of the sprint, I want it to propose something functional. The creation of two independent figures was the simplest solution for me. |
|
What about a simpler "abs value (percentile)" kind of display, for each bar? |
|
@lionelkusch do you plan to continue working on this PR? |
|
Yes, I can take care of that if you agree on what you want displayed. |
|
I think you can go ahead with my comment above |
|
There are 2 displays one for the percentage and one with the full value. Additionally, I don't fully understand what you mean by "abs value (percentile)". |
|
You can combine both. The height of each column corresponds to the total number of elements in the bin, and the text is the number of elements in the bin, with the percentile representation between parentheses. This applies to both numerical and categorical columns. |
|
The problem when you combine the two in the same graphic is that the text will be longer than the columns. This won't look nice and it will be difficult to automatically add the text to the graphic. In my opinion, it's better to stay with 2 representations: one with percentile and one with absolute numbers and switch between them. |
|
This is an optimised version of the generation of the figures without generating twice the figures. I released that it is not possible to duplicate or copy a figure of matplolib. I changed a bit of the label using the _utils for the format of the number and adjusted the position. |
|
Thanks for continuing this work. Overall, I'm still not convinced by the double plot approach, because:
Addressing your remarks:
If the text crossing the bar edge doesn't look good, we can choose to always have the text outside of the bar, increasing the figure size slightly if necessary.
I think this can be addressed by controlling the number of digits in the format using custom rules, like full representation when the entries are smaller than 10,000 and scientific notation otherwise. We would have an upper bound on the size of the text. What do the others think? |
|
I agree with you that this increase the complexity for the manage of the text and that there is an increase in memory for the generation of the second figure. |
I agree on all points here and I would also prefer having both numbers visible at the same time.
How about adding the % to the right (the top) of the plot, aligned with each bar? With a fixed format (like 3 significant digits) the space should remain mostly constant, while the actual value is still represented in the same way as it is now. If the % sign takes too much space, it could be added above the column of numbers as an annotation. |
|
By your remarks, I see that the switching views is not interesting. |
It makes sense, and thanks for working on both versions. We might revisit this version in the future, but I think that for the time being the static version would already be quite useful. |
|
in the end the alternative PR was merged so we can clsoe this |
This PR is based on the PR #1496.
This PR solves the desire requirement behaviour of the issue #1454 .
The principle of this feature is to use JavaScript to send a message which changes the style of the html division of the figure between 'none' and 'block' (default value). This means that there are 2 figures created for each column: one with a percentage label and one with normal numbers.
WARNING: The percentage is fixed in the size of the display number, which is not the case for the number. This can create some not rendering well for large numbers.