Fix Python – Is there a way to detach matplotlib plots so that the computation can continue?

After these instructions in the Python interpreter one gets a window with a plot:
from matplotlib.pyplot import *
# other code

Unfortunately, I don’t know how to continue to interactively explore the figure created by show() while the program does further calculations.
Is it possible at all? Sometimes calculations are long an….

Fix Python – Plot two histograms on single chart with matplotlib

I created a histogram plot using data from a file and no problem. Now I wanted to superpose data from another file in the same histogram, so I do something like this
n,bins,patchs = ax.hist(mydata1,100)
n,bins,patchs = ax.hist(mydata2,100)

but the problem is that for each interval, only the bar with the highest value appears, and the other is hid….

Fix Python – Matplotlib different size subplots

I need to add two subplots to a figure. One subplot needs to be about three times as wide as the second (same height). I accomplished this using GridSpec and the colspan argument but I would like to do this using figure so I can save to PDF. I can adjust the first figure using the figsize argument in the constructor, but how do I change the size o….

Fix Python – How to add title to subplots in Matplotlib

I have one figure which contains many subplots.
fig = plt.figure(num=None, figsize=(26, 12), dpi=80, facecolor=’w’, edgecolor=’k’)
fig.canvas.set_window_title(‘Window Title’)

# Returns the Axes instance
ax = fig.add_subplot(311)
ax2 = fig.add_subplot(312)
ax3 = fig.add_subplot(313)

How do I add titles to the subplots?
fig.suptitle adds a titl….

Fix Python – Why do many examples use `fig, ax = plt.subplots()` in Matplotlib/pyplot/python

I’m learning to use matplotlib by studying examples, and a lot of examples seem to include a line like the following before creating a single plot…
fig, ax = plt.subplots()

Here are some examples…

Modify tick label text

I see this function used a lot, even though the example i….

Fix Python – Hiding axis text in matplotlib plots

I’m trying to plot a figure without tickmarks or numbers on either of the axes (I use axes in the traditional sense, not the matplotlib nomenclature!). An issue I have come across is where matplotlib adjusts the x(y)ticklabels by subtracting a value N, then adds N at the end of the axis.
This may be vague, but the following simplified example high….