I cannot get a histogram from Qiskit to show using PyCharm, even though I am getting the numbers correctly. Code is the following:
import numpy as np
from qiskit import QuantumCircuit, transpile
from qiskit.providers.aer import QasmSimulator
from qiskit.visualization import plot_histogram
from matplotlib import pyplot as plt
simulator = QasmSimulator()
circuit = QuantumCircuit(2, 2)
circuit.h(0)
# Add a CX (CNOT) gate on control qubit 0 and target qubit 1
circuit.cx(0, 1)
# Map the quantum measurement to the classical bits
circuit.measure([0,1], [0,1])
compiled_circuit = transpile(circuit, simulator)
job = simulator.run(compiled_circuit, shots=1000)
result = job.result()
counts = result.get_counts(compiled_circuit)
print("\nTotal count for 00 and 11 are:",counts)
plot_histogram(counts)
I should be getting an image like:
