I have the following code. I am trying to plot a line plot.
However, it is plotting too many x-values on the x-axis.
I would like to plot fewer x-axis values (plot one value every few values) so that the x-axis scale is readable.
I would be so grateful for a helping hand!
plt.figure(figsize=(70,70))
ax = sns.lineplot(data=correcteddf,x=listedvariables[i],y="distance",errorbar ='se',err_style='bars',linewidth=4)
ax.set_xlabel('nap_duration_mins',labelpad = 40,fontsize=70,weight='bold')
ax.set_ylabel("Wayfinding Distance (z-score)",labelpad = 40,fontsize=70,weight='bold')
correcteddf[['nap_duration_mins']] = correcteddf[['nap_duration_mins']].astype(float)
ylabels = ['{:,.2f}'.format(x) for x in ax.get_yticks()]
xlabels = ['{:,.2f}'.format(x) for x in ax.get_xticks()]
ax.set_yticklabels(ylabels,weight='bold',fontsize=60)
ax.set_xticklabels(xlabels,weight='bold',fontsize=60,rotation = 30)
plt.xticks(rotation = 30,weight='bold',fontsize=60)
title = ('nap_duration_mins' + ' ' + 'plot')
ax.set_title(title,fontsize=70,pad=40,weight='bold')
dir_name = "/Users/macbook/Desktop/"
plt.rcParams["savefig.directory"] = os.chdir(os.path.dirname(dir_name))
plt.savefig('nap_duration_mins+' '+'scatterplot')
plt.show()
