0

four-panel chart with only three active charts

Hello everyone,

In the chart above, how do I remove the fourth panel?

Here is the code. Any ideas?

panel, ax = plt.subplots(2,2)
ax[0,0].scatter(df[:,0],df[:,1],s=50)
ax[0,0].set_title('Original Scatter (middle 90%)')
ax[0,0].set_xlabel('Diversification index', fontsize=8) 
ax[0,0].set_ylabel('PPP per capita', fontsize=8)
ax[0,1].plot(K, bss/tss*100, 'b*-')
ax[0,1].plot([0,20],[90,90],'k-', color='red')
ax[0,1].set_title('Optimal number of clusters')
ax[0,1].set_xlabel('Number of clusters', fontsize=8)
ax[0,1].set_ylabel('% variance explained', fontsize=8)
ax[0,1].text(0.95,0.01, 'Elbow for KMeans clustering',
        verticalalignment='bottom', horizontalalignment='right',
        transform=ax[0,1].transAxes, color='red', fontsize=8)

clr = ['b','g','r','c','m','y','k']
 for i in range(K[kIdx-1]):
    ind = (cIdx[kIdx-1]==i)
    ax[1,0].scatter(df[ind,0],df[ind,1], s=30, c=clr[i], label='Cluster %d'%i)
ax[1,0].set_xlabel('Diversification index', fontsize=8)
ax[1,0].set_ylabel('GDP',fontsize=8)
ax[1,0].set_title('KMeans clustering with K=%d' % K[kIdx-1])
box = ax[1,0].get_position()
ax[1,0].set_position([box.x0, box.y0, box.width*0.8, box.height])
ax[1,0].legend(loc='center left',bbox_to_anchor=(1,0.5), fancybox=True, shadow=True)
noiivice
  • 400
  • 2
  • 15

1 Answers1

0

You may try ax[1, 1].set_axis_off().

  • 1
    While this code may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – Yunnosch Aug 30 '22 at 15:03
  • 1
    If you are not sure that the solution you propose for experiment does in fact help, please phrase this as an explained conditional answer, in order to avoid the impression of asking a clarification question instead of answering (for which a comment should be used instead of an answer, compare https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead ). For example like "If your problem is ... then the solution is to .... because .... ." – Yunnosch Aug 30 '22 at 15:04