You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ext/QuantumToolboxMakieExt.jl
+33-7Lines changed: 33 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -337,14 +337,24 @@ Render the Bloch sphere visualization from the given [`Bloch`](@ref) object `b`.
337
337
# Arguments
338
338
339
339
- `b::Bloch`: The Bloch sphere object containing states, vectors, and settings to visualize.
340
-
- `location::Union{GridPosition,Nothing}`: The location of the plot in the layout. If `nothing`, the plot is created in a new figure. Default is `nothing`.
340
+
- `location::Union{GridPosition,LScene,Nothing}`: The location of the plot in the layout or `Makie.LScene`
341
+
341
342
342
343
# Returns
343
344
344
345
- A tuple `(fig, lscene)` where `fig` is the figure object and `lscene` is the LScene object used for plotting. These can be further manipulated or saved by the user.
346
+
347
+
# Notes
348
+
349
+
The keyword argument `location` can be in the either type:
350
+
351
+
- `Nothing` (default): Create a new figure and plot the Bloch sphere.
352
+
- `GridPosition`: Plot the Bloch sphere in the specified location of the plot in the layout.
353
+
- `LScene`: Update the existing Bloch sphere using new data and settings in `b::Bloch` without creating new `Figure` and `LScene` (efficient for drawing animation).
345
354
"""
346
355
function QuantumToolbox.render(b::Bloch; location =nothing)
347
-
fig, lscene =_setup_bloch_plot!(b, location)
356
+
fig, lscene =_setup_bloch_plot!(location)
357
+
_setup_bloch_camara!(b, lscene)
348
358
_draw_bloch_sphere!(b, lscene)
349
359
_add_labels!(b, lscene)
350
360
@@ -358,30 +368,46 @@ function QuantumToolbox.render(b::Bloch; location = nothing)
0 commit comments