1

I have tried to 4 plots in one figure, without any space between each plots. However i tried to use fig.subplots_adjust(wspace = 0, space = 0) it doesn't work.

fig1, ax1 = plt.subplots(

(_, caps3, _) = ax1[0, 0].errorbar(all_sigma_prim, all_gaus, xerr = 
                                   all_sigmaerr, yerr = all_gauserr,
                                   marker='^', linestyle='', linewidth=2,
                                   color='g', markeredgecolor='k', 
                                   markerfacecolor='darkgreen',
                                   markeredgewidth=.3, markersize = 8,
                                   ecolor='g', capsize=5, capthick=10, 
                                   elinewidth=2, label='Gaussian fitting')

for cap3 in caps3:
    cap3.set_color('g')
    cap3.set_markeredgewidth(1.7)



ax1[0, 0].set_xlim(left = 0, right = 450)

ax1[0, 0].set_xticks(np.arange(0, 451, 100))
ax1[0, 0].set_xticks(np.arange(0, 450, 25), minor = True)
ax1[0, 0].set_yticks(np.arange(100, 551, 100))
ax1[0, 0].set_yticks(np.arange(0, 551, 25), minor = True)
ax1[0, 0].set_ylim(bottom = 0, top = 480)


ax1[0, 0].tick_params(axis = 'both', which = 'major', labelsize = 23, width = 2)
ax1[0, 0].plot([0, 550], [0, 550], color = "gray", linestyle = "--", linewidth = 2)

ax1[0, 0].set_aspect('equal')


ax1[0, 0].text(40, 405, "(a)", horizontalalignment='left', 
               verticalalignment='bottom', fontsize = 18,
               fontweight='black')

After ax1[0,0] the other 3 plots all similar plots so i won't write whole code on here. At the last i write the

fig1.subplots_adjust(wspace = 0, hspace = 0)

fig1.text(0.5, 0.01, "common X", fontsize = 28, ha = 'center')
fig1.text(0.01, 0.5, "common Y", fontsize = 28, va = 'center', rotation = 'vertical')

But wspace command doesn't work and there is still a gap between plots like this quiestion (Matplotlib adjust image subplots hspace and wspace).

They got a comment for a imshow.

It doesn't work for a pyplot plot function.

I want to know how can i solve that issue with data plots.

Thank you for your help about this problem.

Gangil Seo
  • 256
  • 1
  • 3
  • 16
  • saying "it doesn't work" is not enough for us to help you. Please provide a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). It doesn't have to be your whole code, just write the minimal amount of code that reproduces the problem and that we can copy and paste to experiment ourselves. For example, the very first line of your code is incorrect `fig1, ax1 = plt.subplots(` so we have no idea about the geometry of your axes – Diziet Asahi Aug 08 '19 at 11:22
  • The origin of the problem is of course the same as in the linked questions from the linked question. You can remove `.set_aspect('equal')` and you will get the desired spaces. You can also use `set_aspect('equal', adjustable="datalim")` in case you need an equal aspect. – ImportanceOfBeingErnest Aug 08 '19 at 13:57
  • Thanks! I remove set_aspect("equal") and problem solved!!! Thanks a lot!! – Gangil Seo Aug 08 '19 at 14:10

0 Answers0