Skip to main content

plot_bloch_vector

Function plot_bloch_vector 

Source
pub fn plot_bloch_vector(
    vector: [f64; 3],
    options: &StatePlotOptions,
) -> Result<String, VisualizationError>
Expand description

Plot a single Bloch vector as SVG.

§Arguments

  • vector - Bloch coordinates (x, y, z) with components typically in [-1, 1].
  • options - Plot styling options such as title and figure size.

§Returns

SVG markup as a UTF-8 string.

§Examples

use cqlib_core::visualization::{StatePlotOptions, plot_bloch_vector};

let svg = plot_bloch_vector([0.0, 0.0, 1.0], &StatePlotOptions::default()).unwrap();
assert!(svg.contains("<svg"));