from qiskit import *


from qiskit.tools.visualization import plot_bloch_multivector, plot_histogram

qc = QuantumCircuit(1, 1)
qc.x(0)
qc.draw(output='mpl')

simulator = Aer.get_backend('statevector_simulator')
result = execute(qc, backend=simulator).result()
statevector = result.get_statevector()
print(statevector)

plot_bloch_multivector(statevector)

qc.measure([0],[0])

simulator = Aer.get_backend('qasm_simulator')
result = execute(qc, backend=simulator, shots=1024).result()
counts = result.get_counts()
print(counts)
plot_histogram(counts)

qc = QuantumCircuit(1, 1)
qc.x(0)
simulator = Aer.get_backend('unitary_simulator')
result = execute(qc, backend=simulator).result()
unitary = result.get_unitary()
print(unitary)

