Add Fock distribution bar chart visualization#238
Open
Aniket-umass wants to merge 3 commits into
Open
Conversation
Krastanov
reviewed
Jun 23, 2026
Comment on lines
+159
to
+161
| color = :green, | ||
| alpha = 0.6, | ||
| width = 0.8, |
Member
There was a problem hiding this comment.
I would stick to Makie defaults here, especially color
Contributor
Author
|
Hello Stefan, |
Member
|
You can proceed with adding support for julia 1.10 to WeakDepHelpers |
Contributor
Author
|
I have added the support for WeakDepHelpers. Once that PR is merged, the failed tests will pass. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fock distribution bar chart visualization
Adds a
fockdistributionplotrecipe to the Makie extension, visualizing theFock-state (number-state) occupation probabilities P(n) of a quantum state as a
bar chart. This mirrors QuTiP's
plot_fock_distributionand complements theexisting Bloch sphere (spin) and Wigner (phase-space) plotters, extending
visualization coverage to the Fock basis.
What it does
Ket, plotsP(n) = |⟨n|ψ⟩|².P(n) = ⟨n|ρ|n⟩.(toggle with
unit_y_range=false), x = "Fock number", y = "Occupation probability".API
fockdistributionplot(state; kwargs...)/fockdistributionplot!(ax, state; kwargs...)fockdistributionplot_axis([ax,] state; kwargs...) -> (Figure, Axis, Plot)color,alpha,width; axis kwarg:unit_y_range.When no Makie backend is loaded, calling these gives a normal
MethodErrorwith a hint to load one (via
Base.Experimental.register_error_hint).Tests
test/test_fock_plotting.jl(tag:plotting) covers return types, rendering ofcoherent / number / thermal states, custom attributes, the
unit_y_rangetoggle, and
Observablereactivity.Notes
Project.tomlchanges — reuses the Makie weakdep/extension already in place.Example:-
