Closed cgranade closed 2 years ago
I'm wondering, maybe for the colour-blind-safe mode, the traditional black-or-white colour is a better choice? The colour blind cmap goes from dark to bright. If one has a large number of entries, it is inevitable that some of them will be close to the threshold and become hard to distinguish from the background, regardless of the threshold.
An alternative could be using a white edge for each blob, distinguish it from the background, e.g.:
traditional black-or-white colour is a better choice
Is this tradition somewhere? Given there is some confusion/alternation of conventions, maybe this is not the best approach.
I would agree with @cgranade that using black or white to indicate positive or negative and then the size of the square to indicate the magnitude is the most unambiguous way to indicate. It is also the way matplotlib does it: https://matplotlib.org/stable/gallery/specialty_plots/hinton_demo.html , which is how I have done it in the past.
Following up, even if an option for drawing matrix elements with a border is added, the thresholded version of Hinton diagrams is much more common, especially in the ML community where it first originated. For example:
Given those examples, I definitely agree that a border option could be really helpful, but it'd still be nice to be able to generate more traditional Hinton diagrams as well.
It's sounds like a few more options for the Hinton plot would be a good idea:
None
for no border)I'm not sure I will get to this soon myself, but I can review a PR if someone else writes one.
I'll give it a try, but it may take some time.
I'd also like to add a choice where the colour represents the phase of the complex number, rather than the abs value, which is already illustrated by the blob size. I have a customized Hinton diagram that looks like this (which is not a density matrix but a Hamiltonian, still very useful)
Another problem I have using it is that the colour bar is not returned and the font size is written fixed in the code... But that is beyond the topic of this issue.
This looks like it was closed by #1674.
Is your feature request related to a problem? Please describe. Traditionally in Hinton diagrams, any positive number is represented by a fully white square, while any negative number is represented by a fully black square. In the current implementation of
qutip.visualization.hinton
, however, each square is shaded such that numbers close to zero are represented by colors close to gray. While it is nice to be able to use shaded colormaps of this form, traditional Hinton diagrams (that is, thresholded at zero) can be easier to read when some elements that are close to zero can still have significant impact.Describe the solution you'd like A
config
option or keyword argument that would allow using a threshold at zero.Additional context Current Hinton diagram implementation (with colorblind safe mode turned off):
Current Hinton diagram implementation (with colorblind safe mode turned on):
Examples with thresholded colors (https://arxiv.org/pdf/1509.03770.pdf):