subplot and hinton plotting

89 views
Skip to first unread message

Daniel Berman

unread,
Jul 11, 2015, 12:41:44 AM7/11/15
to qu...@googlegroups.com
Hi all,

I was wondering if there is a way to plot multiple hinton plots in a single figure? It seems that hinton automatically plots a figure. However, I'd like to produce a number of plots and have them appear on the same figure for comparison. Is this possible?

Thanks.

nonher...@gmail.com

unread,
Jul 16, 2015, 9:57:43 PM7/16/15
to qu...@googlegroups.com
Hinton has the kwarg "ax" that allows you to specify the axes on which to plot. That should do what you want. 

Paul


--
You received this message because you are subscribed to the Google Groups "QuTiP: Quantum Toolbox in Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qutip+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Berman

unread,
Jul 17, 2015, 1:18:36 AM7/17/15
to qu...@googlegroups.com
Unfortunately I'm getting plots generated, but nothing is appearing on the plots. There are axes, and color bars, but nothing on the plots. Additionally, there are no titles for the plots.

Here is my the portion of the code. I can't post all of it because it spans multiple files but this sums it up:

target_titles=['Target I', 'Target X(\pi/2)', 'Target Y(\pi/2)', 'Target X(\pi)']
#The actual gates
actual_titles = ['Actual I', 'Actual X(\pi/2)', 'Actual Y(\pi/2)', 'Actual X(\pi)']
#Maximum Likelihood Estimates of the gates
mle_titles = ['MLE I', 'MLE X(\pi/2)', 'MLE Y(\pi/2)', 'MLE X(\pi)']
#Linear Gate Set Tomography estiamtes of the gates
lgst_titles = ['LGST I', 'LGST X(\pi/2)', 'LGST Y(\pi/2)', 'LGST X(\pi)']
gate_titles = ['I', 'X(\pi/2)', 'Y(\pi/2)', 'X(\pi)']
diff_titles = ['Relative Error I', 'Relative Error X(\pi/2)', 'Relative Error Y(\pi/2)', 'Relative Error X(\pi)']
labels=['I','X', 'Y', 'Z']

#The operators that represent the gates.
G_target =[qeye(2), rx(np.pi/2), ry(np.pi/2), rx(np.pi)]
G_target= [to_super(x)for x in G_target ] #Turn them into super-operators

#These three lines are not actually in the code but I wrote for flow.
G_mle=G_target
G_closest=G_target
G_actual=G_target

ptm_mle
=[]
ptm_actual=[]
ptm_lgst=[]
temp=[]

fig, ax = plt.subplots(len(G_mle),3, sharex=True, sharey=True)
for i in range(len(G_mle)):
#PauliTransferMatrix is a personal function turns the superoperator into a PTM matrix
ptm_mle.append(PauliTransferMatrix(G_mle[i],num_qubits))
ptm_actual.append(PauliTransferMatrix(G_actual[i],num_qubits))
ptm_lgst.append(PauliTransferMatrix(G_closest[i],num_qubits))


hinton(ptm_actual[i],ax=ax[i][0], title=actual_titles[i],label_top=False)


hinton(ptm_mle[i],ax=ax[i][1], title=mle_titles[i],label_top=False)


hinton(ptm_lgst[i],ax=ax[i][2],xlabels=labels,ylabels=labels, title=lgst_titles[i],label_top=False)

plt.show()
Reply all
Reply to author
Forward
0 new messages