Conversation
|
FYI. My fix was to remove the placeholder axes and make a new one with def _PlotFig(...
if linefit == True:
nclos = np.max([self.ncomp, 1])
fig, axn = plt.subplots(nrows=2, ncols=nclos, figsize=(15, 8),
squeeze=False) # prepare for the emission line subplots in the second row
gs = axn[0, 0].get_gridspec()
for axi in axn[0, :]:
axi.remove()
ax = fig.add_subplot(gs[0, :]) |
|
Hi Yuming, the gridspec method is better! My method will make the axis of the upper panel empty if there is only one subpanel in the botton row. Thanks! |
|
Sorry for the delay. Glad you have solved this problem, Wenke Ren will fix this issue in the next version. Thanks! |
Thanks for your contribution. I adopted your modification in fixing figure axis problem. But since we prefer keeping the close function and the pull request can only be accept as whole, I can not adopt this pull request. If you want the figure show up in your IDE, simply set the save_fig option to False. For users running bulk tasks, the displayed figure would cause memory leak. |
This problem happens sometime after the late of last year (my collegues also had the same problem at a similar time point). I am guessing some package update issues (I am testing under the latest matplotlib 3.8.3). plt.subplots will create empty axis as a pre-set, this will overlap with the new subplot of the whole spectrum, as shown by the figure. Turn off the axis of the first row before making the new subplot will solve the problem.
Another point is at the end of the plot_fig func, I am a spyder user, the plot does not pop up in my window without plt.show(). And I found it is werid to put plt.close(fig) under if self.save_fig == True, so moved it out.