Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plot_histogram should show better when very spread results #13066

Open
1ucian0 opened this issue Sep 2, 2024 · 4 comments · May be fixed by #13294
Open

plot_histogram should show better when very spread results #13066

1ucian0 opened this issue Sep 2, 2024 · 4 comments · May be fixed by #13294
Labels
type: enhancement It's working, but needs polishing

Comments

@1ucian0
Copy link
Member

1ucian0 commented Sep 2, 2024

What should we add?

With bigger systems, results are sometimes very sparse (meaning, a lot of results with very low count). Take the following result (it comes from an execution in qiskit-aer with noise, but irrelevant for this point):

result = {'011011100000001': 1, '111110011010010': 1, '111010010111000': 1, '100100101110001': 1, '000101111110010': 1, '101010000001010': 1, '110001000011111': 1, '111010111011000': 1, '111100011011111': 1, '111001000010001': 1, '101101111000000': 1, '000000111101010': 1, '110001110010011': 1, '010111101001111': 1, '100011010010111': 1, '101110110010101': 1, '000111000000000': 1, '000110000100010': 1, '111001011011110': 1, '110010100101001': 1, '100001110110011': 1, '000110100001000': 1, '101011100001100': 1, '111101011111110': 1, '000001011010110': 1, '101100010111100': 1, '101001110011000': 1, '100011100111100': 1, '001011101011000': 1, '101011111110101': 1, '010011010110100': 1, '011111000011100': 1, '011011010001001': 1, '101110010011100': 1, '111110101111011': 1, '000100000000001': 1, '001110100010010': 1, '111110000000000': 1, '111001011111111': 1, '100110001101111': 1, '010010110001110': 1, '011101000111011': 1, '101000110101100': 1, '010101101110110': 1, '110101001010011': 1, '111001010000001': 1, '010110000001100': 1, '011011100001100': 1, '000110001010100': 1, '100000100000100': 1, '101111000110101': 1, '110000000100100': 1, '000010001100000': 1, '000100001111010': 1, '011010111110110': 1, '100011010011000': 1, '010101101000101': 1, '110111110100001': 1, '011010000000101': 1, '101101010101011': 1, '110111001010010': 1, '010110010001100': 1, '101010100101111': 1, '010100101100010': 1, '000010010011011': 1, '011000001001100': 1, '101011101100000': 1, '100100110110001': 1, '000101000011101': 1, '011101101010101': 1, '011010001000110': 1, '011010000011111': 1, '111100111010111': 1, '110010101111000': 1, '001010111011101': 1, '010110110110011': 1, '111111111010011': 1, '110001111101010': 1, '111011010001101': 1, '101010011110110': 1, '010111110011110': 1, '100100010011100': 1, '111010100111011': 1, '101000000000010': 1, '001101110001000': 1, '000000001100001': 1, '011110111010111': 1, '101011011111011': 1, '011000100101001': 1, '000101111110110': 1, '011011101001000': 1, '000000000000010': 1, '110010001001110': 1, '011001011010110': 1, '011001110010111': 1, '010100001101101': 1, '111011001100110': 1, '010110011111001': 1, '111000111001001': 1, '100100000000010': 1, '010000100011111': 1, '110111001110001': 1, '011011000001111': 1, '000110110110011': 1, '010111101111101': 1, '000000000010000': 1, '101110000101100': 1, '101100100010100': 1, '011111000010110': 1, '110111011000010': 1, '011010000100010': 1, '110101100000111': 1, '110010110110011': 1, '000110010110100': 1, '110101101100000': 1, '111110001000110': 1, '001010010011000': 1, '101010010110111': 1, '100110000011010': 1, '001010011001010': 2, '111111111110000': 1, '110001101011011': 1, '101000111100011': 1, '000100110111001': 1, '110100001100101': 1, '111010110110110': 1, '000101001011001': 1, '111001000110101': 1, '000000111100100': 1, '011101110001111': 1, '101010011010011': 1, '001111010111100': 1, '000000000000011': 1, '000010000001010': 1, '011101111101100': 1, '101110000111001': 1, '111101010010000': 1, '101000000010100': 1, '010110001011101': 1, '110010010000000': 1, '010100110001001': 1, '010110010001110': 1, '110011001110010': 1, '000011111110111': 1, '100010110100100': 1, '111110000000100': 1, '011110111110010': 1, '000101001001001': 1, '111001100010100': 1, '010101011110010': 1, '101010101110001': 1, '100001100001000': 1, '111100110000111': 1, '101100110111001': 1, '010100001011001': 1, '100111011011011': 1, '101000101011100': 1, '110000110110001': 1, '100010110011111': 1, '101101010111000': 1, '111010111000111': 1, '111001101000010': 1, '010010000100100': 1, '111100011101110': 1, '011100101111110': 1, '010000100101011': 1, '001001001101010': 1, '000001010000111': 1, '011101100011010': 1, '011101000000001': 1, '100010011100101': 1, '100101101001110': 1, '101111001100000': 1, '011111000011010': 1, '011101110011101': 1, '101000100001111': 1, '001100110110101': 1, '000010001111011': 1, '011001001100000': 1, '111011010101110': 1, '101011110111101': 1, '010011101011001': 1, '001111100011000': 1, '001100110100100': 1, '010111000111111': 1, '110010100110101': 1, '011000111100110': 1, '111011010100100': 1, '101001111011000': 1, '110101100100100': 1, '000111100010110': 1, '011001101101110': 1, '111010100101000': 1, '000111011110001': 1, '001010110101110': 1, '010111000111010': 1, '100001101111011': 1, '101010011110011': 1, '100011101110001': 1, '000111001111101': 1, '101111010100101': 1, '100101001111111': 1, '101011011001000': 1, '000111011011000': 1, '000001001100101': 1, '001000000100101': 1, '000000000001000': 1, '101000110001101': 1, '011000111011100': 1, '101011101011010': 1, '100101100011000': 1, '111110101110100': 1, '010111000101000': 1, '011100011001101': 1, '101111100011011': 1, '001101111000000': 1, '010110111111100': 1, '000000111101110': 1, '100110101111001': 1, '011101101101000': 1, '000000010100000': 1, '111001000001000': 1, '000000000100000': 1, '110011011100001': 1, '000100000001000': 1, '001100000000001': 1, '001111001111001': 1, '010011011000010': 1, '011111110001100': 1, '111011110000000': 1, '011010111001011': 1, '000001000000010': 1, '010000101110000': 1, '010000100010001': 1, '101100110010000': 1, '010111000010100': 1, '101111011000101': 1, '100000110010100': 1, '110000111011010': 1, '011100101010101': 1, '101101010011011': 1, '110111110000110': 1, '001010011011100': 1, '010011000010101': 1, '101110010111110': 1, '111000001110001': 1, '010011000011000': 1, '011011010011011': 1, '110111010011110': 1, '000011001111001': 1, '110101000001111': 1, '000110000000000': 1, '001000010011110': 1, '011101011100100': 1, '011111000000000': 1, '010001000000100': 1, '100010111011100': 1, '010000111000011': 1, '100110010001100': 2, '111000000100000': 1, '110010100100100': 1, '110101010000011': 1, '011000111010111': 1, '110000111000110': 1, '000000000100011': 1, '011011100100000': 1, '010011100101000': 1, '010100101010110': 1, '010010010010110': 1, '100100110001000': 2, '010011100010011': 1, '000101010011001': 1, '001101001111111': 1, '110001001000000': 1, '100000001101000': 1, '001111111100101': 1, '101011100010010': 1, '100110111111100': 1, '111100010011111': 1, '101110001010111': 1, '101100010001010': 1, '000100010101000': 1, '011100010110110': 1, '001100010101101': 1, '100001110110100': 1, '101110010100000': 1, '101110110010001': 1, '010101001101111': 1, '111111110110110': 1, '010101001110001': 1, '010100000100111': 1, '010101010111101': 1, '011001110101010': 1, '110101110101011': 1, '000000101111110': 1, '000011100110000': 1, '010010001111001': 1, '010111100100110': 1, '111111011010010': 1, '011111011010100': 1, '110011001111101': 1, '110101100100000': 1, '001101111010001': 1, '011100101011011': 1, '011011010111010': 1, '011010110011011': 1, '100011010111100': 1, '110010000111110': 1, '000110110000110': 1, '000000000101111': 1, '011010000101110': 1, '101111101001101': 1, '011000001111100': 1, '101111111000011': 1, '110110111000000': 1, '100110101001000': 1, '001011100100100': 1, '100011100010100': 1, '001101111000110': 1, '011100110001011': 1, '111100010100101': 1, '010000001101100': 1, '000110101111011': 1, '010110001110100': 1, '100010010101000': 1, '000000111001000': 1, '101100101100000': 1, '010010001101010': 1, '011000001000101': 1, '011111001111010': 1, '001100100010100': 1, '111011000110001': 1, '010110110011010': 1, '110010110110100': 1, '110011000101000': 1, '110010001101110': 1, '110011101111011': 1, '110111110001010': 1, '101111100110000': 1, '100010000011110': 1, '001000000001100': 1, '101101111011001': 1, '101110011011010': 1, '001000100011110': 1, '111011111110010': 1, '001010110100000': 1, '110110000010111': 1, '100000110111111': 1, '010101000000001': 1, '100111010011000': 1, '011111010000111': 1, '100110101101011': 1, '100100000001010': 1, '010100010101100': 1, '110000101111010': 1, '110101100010110': 1, '101110001111010': 1, '110010110101100': 1, '111011100011011': 1, '111100101001111': 1, '100000010000111': 1, '011111101110010': 1, '110101000000011': 1, '000111111101101': 1, '111101010110010': 1, '100011111010000': 1, '010100100010010': 1, '010111010010010': 1, '001100111101011': 1, '111110010000000': 1, '100100000101111': 1, '011001101110000': 1, '110010100011110': 1, '111010101000000': 1, '100110100111110': 1, '100110000011011': 1, '001010111111110': 1, '000101011000111': 1, '011110011101100': 1, '000100001011000': 1, '001101101001010': 1, '001000001110110': 1, '111001110000111': 1, '001001001110111': 1, '110010100001111': 1, '010110100000111': 1, '011100100100100': 1, '101101000001001': 1, '101101000010001': 1, '101010110001000': 1, '000101111000000': 1, '011111100111101': 1, '000110111011010': 1, '001111100100010': 1, '100010011001000': 1, '010010101001111': 1, '111001001110000': 1, '010000111011100': 1, '101000001100001': 1, '111101001101100': 1, '100100000000011': 1, '001010010001000': 1, '111011111111011': 1, '010000110101111': 1, '001110101001001': 1, '001110010000001': 1, '010110000110011': 1, '101000111101100': 1, '000111011100001': 1, '000001110101101': 1, '100110011110011': 1, '100001011011000': 1, '000001111010010': 1, '001111011001101': 1, '001011010000010': 1, '110111000100101': 1, '111111001111011': 1, '111101110010101': 1, '111111110101110': 1, '100110111001011': 1, '001101101101000': 1, '000100001111101': 1, '000110110010110': 1, '110001111000000': 1, '100110000101110': 1, '101000110111011': 1, '110110001000110': 1, '100111011111001': 1, '100110001001100': 1, '000110101110111': 1, '100110111100000': 1, '111100001110001': 1, '001001000100010': 1, '011110111110011': 1, '111011000111011': 1, '001111011101001': 1, '000011100110011': 1, '011011011101110': 1, '111111110010001': 1, '011101110000000': 1, '010011000000100': 1, '101011000001100': 1, '100001101110001': 1, '110001010000000': 1, '111010011110111': 1, '011111100001011': 1, '010001001100001': 1, '111001010111011': 1, '111000010101010': 1, '111101001100100': 1, '010000110101010': 1, '111111000000000': 1, '101011010111001': 1, '011000011101110': 1, '111000100000010': 1, '110011000100011': 1, '110010011011101': 1, '111010000101000': 1, '000101000000000': 2, '101110110000010': 1, '101101101000110': 1, '100010010011111': 1, '001111111101110': 1, '100001101011110': 1, '000100010011100': 1, '011100111101011': 1, '011001111000101': 1, '101110110011100': 1, '111110000111101': 1, '000010110001110': 1, '011111010111000': 1, '010100111111111': 1, '000010110001111': 1, '111101001011111': 1, '101111000010001': 1, '101010111110000': 1, '110100011001110': 1, '010110111101100': 1, '111110011100000': 1, '111001100100110': 1, '010000111100000': 1, '000101110010001': 1, '101111110101110': 1, '000101110111100': 1, '100100011111100': 1, '011101011001111': 1, '001111101011000': 1, '010001011001100': 1, '001101010011000': 1, '101110000000010': 1, '110101010111001': 1, '110001000111111': 1, '100001010111010': 1, '101110010000101': 1, '011111010011110': 1, '101000110111001': 1, '011111111010010': 1, '001001010111000': 1, '001011111010111': 1, '001111010100010': 1, '101001000000101': 1, '110001101110111': 1, '101110111101100': 1, '011110010001101': 1, '110110101010001': 1, '101111010000101': 1, '111111100000110': 1, '110110101101110': 1, '001001100100111': 1, '100000010100011': 1, '101011000001000': 1, '000010011000000': 1, '101001000000000': 1, '011001011001101': 1, '101001011011000': 1, '000001000010000': 1, '100110010100010': 1, '111101101001010': 1, '010011110110011': 1, '011111110011000': 1, '010101111110010': 1, '110000000111110': 1, '111011010110010': 1, '100000000001011': 1, '011001010010111': 1, '001111000101010': 1, '101011011100000': 1, '001011001111110': 1, '000000000000111': 1, '100010110000111': 1, '000111001100100': 1, '010101110001000': 1, '011001011100000': 1, '100001000110001': 1, '000011010100001': 1, '110100110000111': 1, '000101101110110': 1, '010101000111101': 1, '000100011101011': 1, '101101010101000': 1, '010011101111101': 1, '100100010101000': 1, '101100001000110': 1, '111010101100100': 1, '101010001111010': 1, '100011010001111': 1, '000010100101001': 1, '001101010001000': 1, '111001010010100': 1, '101110001101100': 1, '111101100110101': 1, '110110001001001': 1, '001111101101001': 1, '111000000000000': 1, '100111010110000': 1, '000111101111100': 1, '110101110110001': 1, '011100110001110': 1, '000011000001000': 1, '010010101011100': 1, '001001001101100': 1, '101000000001100': 1, '000110010000100': 1, '110110110010110': 1, '110011001010111': 1, '010001000001110': 1, '111110001011111': 1, '011111011101001': 1, '101011011111111': 1, '000000100111010': 1, '011111101000000': 1, '111100100011100': 1, '100011001101000': 1, '011010110001011': 1, '111100111111100': 1, '100001000010101': 1, '010001001000010': 1, '010001101011100': 1, '110110100110111': 1, '101111010000011': 1, '000010010101100': 1, '110101011100001': 1, '001110111110100': 1, '110111010101101': 1, '001111100011111': 1, '101110100111110': 2, '011011011010100': 1, '111010101101100': 1, '110000011010110': 1, '000100000100101': 1, '100111101111010': 1, '000001111011001': 1, '111010110001001': 1, '110110110001101': 1, '101011101111011': 1, '001110010000111': 1, '010001011000111': 1, '000000111000100': 1, '011110111111011': 1, '010010000100000': 1, '110010001100001': 1, '011111001100010': 1, '100100011110100': 1, '100000110000010': 1, '110011000100010': 1, '100110110100001': 1, '000011001000001': 1, '001100101000100': 1, '110010111101011': 1, '010010001000000': 1, '101010111010111': 1, '000111101000100': 1, '010100010111101': 1, '001000011110010': 1, '110011000000110': 1, '111100101010010': 1, '000111000111001': 1, '011011100001010': 1, '111011101101100': 1, '011011100001001': 1, '111100000001101': 2, '001110101100011': 1, '000011001110111': 1, '000011101110010': 1, '011011111111011': 1, '100111111111011': 1, '011011110011100': 1, '110111111011000': 1, '101000100010110': 1, '110001000000000': 1, '101111011110001': 1, '100100000011110': 1, '001000110101110': 1, '000111111110100': 1, '001100101111110': 1, '110001010001010': 1, '100011111011101': 1, '011101110000010': 1, '001110110111110': 1, '011110011000000': 2, '111110110111111': 1, '111000111111111': 1, '011010110111001': 1, '111110001101000': 1, '111000100001010': 1, '100101111001111': 1, '000101111111100': 1, '111110101000101': 1, '001000100111001': 1, '001011000110011': 1, '010101100101000': 1, '011010011010101': 1, '110101000010000': 1, '110001010000101': 1, '010000000010010': 2, '101001110010011': 2, '001010110100001': 1, '101101001010011': 1, '111101101111001': 1, '001101111001000': 1, '001101000110010': 1, '010111111110101': 1, '111111001111101': 1, '010101000001101': 1, '101111110000000': 1, '000000100011101': 1, '101010000001100': 1, '001000111010101': 1, '001110111101010': 1, '011000000010000': 1, '000010001000101': 1, '001001110011010': 2, '000000010011110': 1, '001001101101111': 1, '010000000000000': 2, '110100111010001': 1, '000011100001000': 1, '000110001111010': 1, '000010111000101': 1, '010011010111000': 1, '001011101110110': 1, '000000011111000': 1, '001101111110100': 1, '000000000000100': 3, '000011010110000': 1, '100110100111010': 1, '100100100100101': 1, '010100101100000': 1, '000111001001000': 1, '011001011010000': 1, '101001110011111': 1, '110001011101011': 1, '101111000100100': 1, '010101010000000': 2, '000101000111101': 1, '101110101111001': 1, '011110010100100': 1, '001111000101100': 1, '110010111100000': 1, '100100011001001': 1, '100110110100101': 1, '000000010000000': 2, '011110110000011': 1, '101011111111000': 1, '101001101001010': 1, '101011100000011': 1, '000000110010101': 1, '001000001101001': 1, '101110001011111': 1, '010000110001011': 1, '011110011110101': 1, '001111111001110': 1, '101101010000000': 1, '110111000000001': 1, '001011100110111': 1, '000000000010110': 1, '111000001101000': 1, '001100110000000': 1, '001010111100010': 1, '110100000111001': 1, '000100100000001': 1, '001111011000100': 1, '011010111110000': 1, '101100101011010': 1, '100100111100000': 1, '011010100011000': 1, '000100100111101': 1, '111001011010110': 1, '110101101011011': 1, '010011010100000': 1, '010101001000011': 1, '110011101001111': 1, '100010011011111': 1, '001011001110011': 1, '100000110111000': 1, '001010111000000': 1, '111010011111100': 1, '000101000010110': 1, '011001111000010': 1, '011000001100101': 1, '100110111010110': 1, '100000101101010': 1, '110000001000101': 1, '100111010111000': 1, '011110001001101': 1, '101111010110110': 1, '000100110110000': 1, '110101101111110': 1, '011011110111101': 1, '011100010100001': 1, '101111000101101': 1, '011101110010101': 1, '101110100001110': 1, '110011101101000': 1, '000000101010100': 1, '001101101011100': 1, '101100011111111': 1, '111000010010010': 1, '101100010011000': 1, '110011001101001': 1, '110011100010110': 1, '101011010010011': 1, '001000110010111': 1, '110000001111101': 1, '101010001110100': 1, '111110000001000': 1, '100101110011111': 1, '110011001100000': 1, '011100011001110': 1, '000000000000000': 16, '011001111100011': 1, '100001101000011': 1, '010100111100111': 1, '101011011101110': 1, '101100100011010': 1, '111101100100100': 1, '110100110000000': 1, '000000010011011': 1, '000100000101101': 1, '001010010111000': 1, '110101011101101': 1, '011101110100000': 1, '111101110011010': 1, '000001010101000': 1, '110110011001111': 1, '001110111111100': 1, '001111001000011': 1, '101001000011110': 1, '111110001111111': 1, '111001101001110': 1, '111111110100001': 1, '010110110111000': 1, '101111001101111': 1, '111001000011110': 1, '010100111111100': 1, '110101111100111': 1, '011100101100101': 1, '011101001000011': 1, '100101111010010': 1, '110011001101101': 1, '111111101001100': 1, '000000001001011': 1, '001111011101000': 1, '010011111111011': 1, '101010110111101': 1, '011101110001001': 1, '000100110101010': 1, '111110101110001': 1, '010001001110101': 1, '000101001111101': 1, '111110100000110': 1, '001111011100101': 1, '110110000001010': 1, '001100111101000': 1, '110111010101000': 1, '001011010110010': 1, '111000100100000': 1, '001111011010011': 1, '001001011100110': 1, '010111010111100': 1, '100101111111011': 1, '110011110000001': 2, '000101101001100': 1, '000100111011101': 1, '010000110100001': 1, '101111010001111': 1, '111000100000000': 1, '010001100010100': 1, '110111100111010': 1, '011000000010100': 1, '110010000100011': 1, '100001011001110': 1, '100110111010101': 1, '011100011001100': 1, '000010110101110': 1, '110000110011000': 1, '001111000010000': 1, '000101001100111': 1, '110010000010111': 1, '011101110101101': 1, '001001110111010': 1, '110010001111100': 1, '100010110100110': 1, '101111101100100': 1, '010010100101000': 1, '111110100100111': 1, '111000001001011': 1, '101010010001100': 1, '110010000011101': 1, '110000011011101': 1, '001010111011100': 1, '001101110010001': 1, '110000110110110': 1, '100100010110010': 1, '101110001010110': 1, '000111111000001': 1, '001011111100101': 1, '110011110001001': 2, '010001110001011': 1, '100111010010010': 1, '011101100000010': 1, '110101000111010': 1, '000100110000000': 1, '010100010011111': 1, '101011011011100': 1, '011001011011010': 1, '001000001011010': 1, '010101111100100': 1, '100001100100010': 1, '001001011111110': 1, '001111101000000': 1, '001011111111011': 1, '010100001110101': 1, '100010110100010': 1, '111000010000100': 1, '110011100010001': 1, '010010001011011': 1, '001000001001101': 1, '000010011001111': 1, '100001001000000': 1, '110110001101110': 1, '010100010000000': 1, '110011000101111': 1, '001001000000011': 1, '000101001010111': 1, '011000011110000': 1, '001000000111000': 1, '000011011111010': 1, '001000110001110': 1, '001101001101010': 1, '100010110111101': 1, '101100010000001': 1, '011111001000000': 1, '101001011000000': 1, '110001011000111': 1, '000001011101010': 1, '001101100100101': 1, '111000001011000': 1, '000111011110010': 1, '100010001000111': 1, '001100000100101': 1, '110000000000000': 1, '001111010100000': 1, '010111000001010': 1, '011011010011101': 1, '101011000111000': 1, '110011101011000': 1, '000010011011000': 1, '010110100110000': 1, '111000110010000': 1, '100110011010000': 1, '000111000110010': 1, '011010110010000': 1, '001011000101001': 1, '100010111011000': 1, '000000111101100': 1, '110011101010000': 1, '011101011101010': 1, '011011010001000': 1, '101011111111010': 1, '001101100101111': 2, '010001011001011': 1, '101111000000000': 1, '110101110110100': 1, '010000101000010': 1, '001011100110000': 1, '111110101110101': 1, '100010011000111': 1, '101110011101011': 1, '111111011100000': 1, '111111001101001': 1, '011000100010100': 1, '001110001010001': 1, '010111111010000': 1, '111001111000110': 1, '111000101110111': 1, '001100101110101': 1, '011011000000011': 1, '111001100001111': 1, '000110110100010': 1, '001101010010011': 1, '011001110111000': 1, '010101111001100': 1, '011011011010010': 1, '101111001100100': 1, '100111000001010': 1, '111011110111111': 1, '111110011100010': 1, '010111000101100': 1, '000010110001000': 1, '010111001011010': 2, '011110000001001': 1, '101111010101010': 1, '110111101000000': 1, '100101000001111': 1, '100111110100010': 1, '111101111010010': 1, '011001010000000': 1, '001011001011011': 1, '011111101000001': 1, '100010101101111': 1, '111111110000000': 1, '000111000001001': 1, '111101100001000': 1, '010101011010111': 1, '111011010010111': 1, '001001011101110': 1, '011010110001001': 2, '001001000011000': 1, '001101111001110': 1, '001101100100110': 1, '000011001001000': 1, '001001000110011': 1, '011111011111111': 1, '111110100001110': 1, '110110110011101': 1, '110001100000001': 1, '101101000111001': 1, '110011110000100': 1, '001100110110110': 1, '100100110011000': 1, '111011101011000': 1, '111100011101101': 1, '010011001001000': 1, '001110101110111': 1, '110011000000000': 1, '101010110110011': 1, '110101000111000': 1, '101010111001000': 1}

When visualizing, this is the result:

from qiskit.visualization import plot_histogram
plot_histogram(result)

image

This can be addressed via number_to_keep, maybe just with a default around 30?

plot_histogram(result, number_to_keep=30)

image

@1ucian0 1ucian0 added the type: enhancement It's working, but needs polishing label Sep 2, 2024
@Shivansh20128
Copy link
Contributor

Hi @1ucian0
This is something I would like to work on. But I have one question first. The enhancement you are talking about here involves putting a certain number of results with the lowest counts in the rest bar. This can be done manually by specifying number_to_keep as you have shown in the example above. Do you want the plot_histogram function to detect this automatically (when results are very sparse) and proceed with showing a few results and putting the rest in the rest bar (without having to specify the number_to_keep parameter)?

If you want that, I think it can be done by adding some conditions and statements to the plot_histogram function. I want to work on this if you think it will work.
Thank You

@Shivansh20128
Copy link
Contributor

I think we could add a parameter for sparsity in the function, in which the user could mention sparse = true to denote that the data is
sparse.

plot_histogram(data, sparse=true)

This would tell the plot_histogram function that data is sparse, and can then internally analyze what the value of number_to_keep should be.

OR

We could create a sparse function inside the plot_histogram function. The sparse function could trace the data and detect sparsity by analyzing how many values belong below some threshold and accordingly setting the value of number_to_keep parameter.

@Shivansh20128
Copy link
Contributor

@1ucian0 Can you please give some feedback on this and assign this to me? If there is some IBM policy that only in-house developers are allowed to contribute code to Qiskit, you can let me know. Because it has happened to me before, that I wanted to resolve an issue (which was a feature request), and I commented on it, but no one assigned to it me for many days and then it was suddenly assigned to an in-house developer, only hours after he had asked.
Thank You

@1ucian0
Copy link
Member Author

1ucian0 commented Oct 7, 2024

Hi Shivansh,

I wouldn't add a boolean flag that makes an internal analysis. I would use that parameter to parametrized that analysis. For example, ignore_under=3 for example that would not put count that have less than 3 counts. That's a possible idea. Not sure if the best one :) but my general feedback is not avoid bool flags.

There is no policy about in-house assignments. However, you have better chances with good-first-issues: https://qisk.it/good-first-issues

@Shivansh20128 Shivansh20128 linked a pull request Oct 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement It's working, but needs polishing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants