pub fn plot_state_city<S: StateVisualizationSource + ?Sized>(
state: &S,
options: &StatePlotOptions,
) -> Result<String, VisualizationError>Expand description
Plot real and imaginary density-matrix components as an SVG state-city view.
§Arguments
state- Input core state object accepted by state visualization routines.options- Plot styling options such as title, opacity, and bit order.
§Returns
SVG markup as a UTF-8 string.
§Errors
Returns VisualizationError::InvalidInput when the state payload is invalid.
§Examples
use cqlib_core::qis::Statevector;
use cqlib_core::visualization::{StatePlotOptions, plot_state_city};
use num_complex::Complex64;
let state = Statevector::from_state(
1,
vec![Complex64::new(1.0, 0.0), Complex64::new(0.0, 0.0)],
).unwrap();
let svg = plot_state_city(&state, &StatePlotOptions::default()).unwrap();
assert!(svg.contains("Re[rho]"));