I am using matplotlib.pyplot to create histograms. I\'m not actually interested in the plots of these histograms, but interested in the frequencies and bins (I know I can write
No.
But you can bypass the pyplot:
import matplotlib.pyplot
fig = matplotlib.figure.Figure()
ax = matplotlib.axes.Axes(fig, (0,0,0,0))
numeric_results = ax.hist(data)
del ax, fig
It won't impact active axes and figures, so it would be ok to use it even in the middle of plotting something else.
This is because any usage of plt.draw_something()
will put the plot in current axis - which is a global variable.