I was trying to delete "y" axis in a figure, and I did. But when I plot the figure, I find that in the y axis there was a little line (' - '), so I don't know how to delete it.
I want to remove (-)'grid line' in the y axis, but i want to keep the ytick label. Is there a trick to do that?
I used this code:
plt.figure(figsize=(10,15))
plt.rcParams['axes.spines.right'] = False
plt.rcParams['axes.spines.top'] = False
plt.rcParams['axes.spines.left'] = False
plt.subplot(3,1,1)
axes=campos_entre_100.iloc[:,0][::-1].plot(kind="barh",stacked=True)
ylab = plt.ylabel("ESPOL",size=19.5,color='black',rotation=0, labelpad = 140)
ylab.set_position ((-120, 0.45))
plt.tick_params(axis='y', which='major', pad=22,labelsize=20)
plt.tick_params(axis='x', which='major', pad=10,labelsize=20)
plt.gca().xaxis.grid(True,linewidth=0.41)
valor3= campos_entre_100.iloc[:,0].values
pos= np.arange(0,len(valor3))[::-1]
for id, v_1 in enumerate(valor3):
if v_1 >=0:
plt.text(v_1+5 , pos[id] , str(v_1).replace('.',',') , ha="center", va="center", color="black", fontsize=16)
elif v_1 <0:
plt.text(v_1-7 , pos[id] , str(v_1).replace('.',',') , ha="center", va="center", color="black", fontsize=16)
plt.subplot(3,1,2)
campos_entre_100.iloc[:,1][::-1].plot(kind="barh",stacked=True)
ylab = plt.ylabel("Guayaquil",size=19.5,color='black',rotation=0, labelpad = 140)
ylab.set_position ((-100, 0.45))
plt.tick_params(axis='y', which='major', pad=22,labelsize=20)
plt.tick_params(axis='x', which='major', pad=10,labelsize=20)
plt.gca().xaxis.grid(True,linewidth=0.41)
valor3= campos_entre_100.iloc[:,1].values
pos= np.arange(0,len(valor3))[::-1]
for id, v_1 in enumerate(valor3):
if v_1 >=0:
plt.text(v_1+5 , pos[id] , str(v_1).replace('.',',') , ha="center", va="center", color="black", fontsize=16)
elif v_1 <0:
plt.text(v_1-5.4 , pos[id] , str(v_1).replace('.',',') , ha="center", va="center", color="black", fontsize=16)
plt.subplot(3,1,3)
at=campos_entre_100.iloc[:,2][::-1].plot(kind="barh",stacked=True)
ylab = plt.ylabel("Litoral",size=19.5,color='black',rotation=0, labelpad = 140)
ylab.set_position ((-100, 0.45))
plt.tick_params(axis='y', which='major', pad=22,labelsize=20)
plt.tick_params(axis='x', which='major', pad=10,labelsize=20)
plt.gca().xaxis.grid(True,linewidth=0.41)
valor3= campos_entre_100.iloc[:,2].values
pos= np.arange(0,len(valor3))[::-1]
for id, v_1 in enumerate(valor3):
if v_1 >=0:
plt.text(v_1+2 , pos[id] ,str( v_1).replace('.',',') , ha="center", va="center", color="black", fontsize=16)
elif v_1 <0:
plt.text(v_1-2.5 , pos[id] ,str( v_1).replace('.',',') , ha="center", va="center", color="black", fontsize=16)
plt.show()
And the result was this: