Helper functions to draw various graphs and generate plots using Matplotlib.

Plots are configured via the plot_params dictionary. These parameters are associated with Matplolib’s rc settings and are modified within the plotting functions using the rc_context context manager. This approach avoids having to modify the global Matplotlib rc_params.

To modify the plot parameters use, for example,

from flamingpy.utils.viz import plot_params as fp_plot_params
fp_plot_params["font.size"] = 20


PiFormatter([tex, d])

Formatter for axis-ticks containing multiples of sqrt(pi)/2.


add_recovery_drawing(ax, **kwargs)

Plot the recovery.

draw_EGraph(egraph[, backend])

Draw an EGraph using either matplotlib or plotly as backend.

draw_EGraph_matplotlib(egraph[, ...])

Draw the graph state represented by the EGraph.

draw_EGraph_plotly(egraph[, color_nodes, ...])

Draw the graph state represented by the EGraph with plotly.

draw_curved_edges(graph, layout, ax[, rad])

Draw curved edges using matplotlib directly instead of networkx.

draw_dec_graph(graph[, label_edges, ...])

Draw a stabilizer or matching graph with a color legend.

draw_decoding(code, ec[, dec_objects, ...])

Draw the stabilizer and matching graphs, and the plot the syndrome.

plot_GKP_bins(outcomes, bit_values, alpha[, ...])

Plot binned real numbers mod alpha.

plot_Z_err_cond(hom_val, error, alpha, ...)

Plot conditional phase probabilities for GKP states.

plot_fractional_part(xs, fs, alpha[, show])

Plot the fractional part of real numbers mod alpha.

plot_integer_part(xs, ns, alpha[, show])

Plot the integer part of real numbers mod alpha.

plot_mat_heat_map(mat[, show, title])

Plot the heat map of a matrix.

syndrome_plot(code, ec[, index_dict, ...])

Draw the syndrome plot for a code.

to_pi_string(x[, tex, d])

Convert x, a multiple of sqrt(pi)/2, to a pretty string.