0
$\begingroup$

I'm trying to plot a histogram of my code but when I run

plot_histogram(results.get_counts(circuit))

it gives me a traceback error.

This is what I had before calling the histogram function:

-result = execute(circuit, backend = simulator).result()

and thereafter when I try to plot it by typing

-plot_histogram(results.get_counts(circuit))

it doesn't work.

$\endgroup$
1
  • 5
    $\begingroup$ Welcome to Quantum Computing SE! Do you have a minimal (not-)working example? It can be hard to tell where the error is without more code (unless it's a case of typing results. when your variable is called result, in which case you should be typing plot_histogram(result.get_counts(circuit))? $\endgroup$
    – Mithrandir24601
    Sep 1, 2019 at 8:22

1 Answer 1

1
$\begingroup$

Looking at the code without the example it looks like you missed an "s" on the result variable. plot_histogram(results.get_counts(circuit)) should work.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.