I'm trying to plot a set of data using plot_histogram, but the rendered image looks like this (the larger values are outside the image): enter image description here

How can I set the y-axis to contain larger values? Or, is there any alternative way to avoid this problem? I have tried the figsize(,) option but it isn't effective.


This is a bug in the plot_histogram function. I pushed a fix for it here: https://github.com/Qiskit/qiskit-terra/pull/1661 In the meantime you can probably workaround this locally by doing something like:

fig = plot_histogram(data)
ax = fig.axes[0]
ax.set_ylim(0, 1)
fig.savefig('output.png') # Or whatever you doing to output the image

Which will adjust the y axis boundaries to be between 0 and 1.


Your Answer

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

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