0

I've subplots having independent ylabels but also want to assign a common label that describes the overall operation.

fig, axarr = plt.subplots(nrows=7, ncols=1, figsize=(6,6))
axarr[0].plot(data, 'r')
axarr[0].set_ylabel('s', fontsize=14, rotation=90)
axarr[0].set_yticklabels([])
ds = [cA5, cD5, cD4, cD3, cD2, cD1][::-1]
ds_names = ["a5", 'd5', 'd4', 'd3', 'd2', 'd1'][::-1]
for ii in range(len(ds)):
    axarr[ii + 1].plot(ds[ii], 'k')
    axarr[ii + 1].set_ylabel(ds_names[ii], fontsize=14, rotation=90)
    axarr[ii + 1].set_yticklabels([])
    if ii == 0:
        axarr[ii + 1].set_title("Approximation coefficients", fontsize=14, color='b')

plt.tight_layout()

plt.ylabel(r'wavelet decomposed $\zeta$, mm')
plt.xlabel('x,m')
plt.show()

Right now, I try to use plt to label the common label but that is not rendered well. Please find the attachment illustrating the problem. I was hoping someone might be able to help me out.

This is not duplicate to the question as alleged by a user. Here I'm looking for setting essentially two labels -- one common for all subplots and one for each subplot.

enter image description here

bb5kb
  • 51
  • 1
  • 8
  • 1
    Possible duplicate of [Common xlabel/ylabel for matplotlib subplots](https://stackoverflow.com/questions/16150819/common-xlabel-ylabel-for-matplotlib-subplots) – Sheldore May 13 '19 at 18:55
  • I went through that question. What I am looking for is a way to set a common label that is in addition to the independent labels that each of the subplots themselves have. Look at the attachment for better understanding. Please remove the alleged duplicate tag if that makes sense to you. – bb5kb May 14 '19 at 16:34
  • Did you try using `plt.text()` to specify the common label as suggested in some of the answers with a very small value of x-position with a rotation of 90 degrees for the text. Also, since you seem to be new to Stack Overflow, you should read [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). You should include the necessary code and dataset to reproduce the desired figure/problematic figure – Sheldore May 14 '19 at 17:28
  • @Sheldore yes indeed. it worked using fig.text(). Thanks for the help. – bb5kb May 16 '19 at 16:33

0 Answers0