Ask here about the “Multi-Qubit Systems” Codebook topic from the “Circuits with Many Qubits” module.

Hello again! I feel like I am asking this again. I would like the code implementation of the plotter function used in this part. I am working on creating my own notebooks as notes so I would like to have that function. Thanks!!!

Hi @lawun330 ,

Here you go!

```
def plotter(theta, ZI_results, IZ_results, ZZ_results, combined_results):
"""Plot the value of the output
Args:
theta (np.array[float]): Angles for the x axis.
ZI_results (np.array[float]): ZI expectation values
IZ_results (np.array[float]): IZ expectation values
ZZ_results (np.array[float]): ZZ expectation values
combined_results (np.array[float]): users guess for how ZI and IZ results combine
to produce ZZ results.
"""
df = pd.DataFrame(
data=np.array([theta, ZI_results, IZ_results, ZZ_results, combined_results]).T,
columns=["theta", "ZI", "IZ", "ZZ", "Your guess ZZ"],
)
plot = (
alt.Chart(df)
.transform_fold(["ZI", "IZ", "ZZ", "Your guess ZZ"], ["observable", "expval"])
.mark_line()
.encode(x="theta:Q", y="expval:Q", color="observable:N")
)
return plot
```