SorenLaursen / confusion_matrix_chart

Jupyter notebook with implementation of the confusion matrix chart using Altair
Creative Commons Zero v1.0 Universal
4 stars 2 forks source link

Width of bar_Y concatenating incorrectly #1

Open tomberthon opened 4 years ago

tomberthon commented 4 years ago

Hi

Really like the work here - a great way of visualising the Confusion matrix - however when I am running this for me I get an issue where the bar_Y and bar_N concatenate at the same width as the text cells next to them:

image

It seems to be that concatenating charts together with different widths in this way create each width to be the same as the first chart:

text_Yy | bar_Y | bar_N image

bar_Y | bar_N | text_Yy image

However using the example code from altair site with the hconcat functionality gives me the correct behaviour (https://altair-viz.github.io/user_guide/compound_charts.html#horizontal-concatenation

Using altair v4.1.0 for this visualisation.

Any Ideas - Thanks in Advance

Tom

SorenLaursen commented 4 years ago

Hi Tom

I'm happy you like the work.

It seems to be a problem with the vertical bars (green/blue), which are too wide. They are generated by the cf_v_bar function. I tried to add some scaling factors to be able to adjust the size of the viz, but I couldn't really make it work. So I ended up experimenting with the numbers and fixing them where it all aligned. From your screen dumps it seems as if the width factor, w_factor was changed from 2 to 10 - or rather that w_factor and h_factor are set to the same value. Might that be the case?

I had some troubles myself with the text alignment of the four large font numbers when one of them is 0. But I got help from the Altair support page to fix that, and updated the workbook correspondingly.

It seems you are close to the right result, I hope you figure it out.

Best regards Søren

Den fre. 24. apr. 2020 kl. 15.13 skrev Tom Berthon <notifications@github.com

:

Hi

Really like the work here - a great way of visualising the Confusion matrix - however when I am running this for me I get an issue where the bar_Y and bar_N concatenate at the same width as the text cells next to them:

[image: image] https://user-images.githubusercontent.com/10978449/80215559-94238a80-8634-11ea-84a2-ee7473d81f51.png

It seems to be that concatenating charts together with different widths in this way create each width to be the same as the first chart:

text_Yy | bar_Y | bar_N [image: image] https://user-images.githubusercontent.com/10978449/80215959-3d6a8080-8635-11ea-892a-917c58dd82cd.png

bar_Y | bar_N | text_Yy [image: image] https://user-images.githubusercontent.com/10978449/80216052-5bd07c00-8635-11ea-8857-b7b8967cf618.png

However using the example code from altair site with the hconcat functionality gives me the correct behaviour ( https://altair-viz.github.io/user_guide/compound_charts.html#horizontal-concatenation

Using altair v4.1.0 for this visualisation.

Any Ideas - Thanks in Advance

Tom

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SorenLaursen/confusion_matrix_chart/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3H2IMCJ4NNCMERJJIA3RDROGF7FANCNFSM4MQC3FNQ .

-- Søren Laursen