I'm trying to plot the counts for the same tensor state (00, say) over many runs, but I'm not sure how to access the data from the "counts" variable in a numerical format that is usable (with matplotlib, for example) after a given run. For context, the reason I am trying to do this is that each run corresponds to a Trotter timestep for unitary time evolution, and I'm trying to plot the evolution of the 00 state over time to compare with the numerical result.

Any help is appreciated!

  • $\begingroup$ can you provide example code? $\endgroup$
    – poig
    Jun 23 at 2:00
  • $\begingroup$ results.get_counts() returns a dictionary where each key represents a resulting state (eg. 00, 01..) and the values are the total counts for that state. Do you mean that you're trying to extract the result per run (eg. run0 => 00, run1 => 00 run2 => 11)? $\endgroup$ Jun 23 at 7:33
  • $\begingroup$ @Iftachyakar Embarrassingly, I'm a Python novice and had no knowledge of the dictionary datatype. Thank you very much for your comment. $\endgroup$
    – Robert
    Jun 23 at 13:44
  • $\begingroup$ @Robert I recommend you to use dir() and qiskit documentation, to see what attribute is available, and play with them. There is other more scenario of retrieve counts data, when you talk about trotter timestep. $\endgroup$
    – poig
    Jun 23 at 15:23
  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Jun 23 at 18:23


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.