Qiskit plot_histogram and count not working [closed]

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.

• 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))? Sep 1, 2019 at 8:22

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.