0

I have a dataset being plotted. One function is a line graph and the other is a bar, the points on the line graph represent each value in the dataset, see below: Graph

As you can see the bar graph is missing values after every group of 3. See code below:

fig, ax = plt.subplots()
ax.bar(dat_dat,full_anom,width=0.1)
ax.plot(dat_dat, full_anom, marker = 'o')
every_nth = 40
for n, label in enumerate(ax.xaxis.get_ticklabels()):
    if n % every_nth != 0:
        label.set_visible(False)
ax.set_title('Full West Coast SST Anomalies')
plt.savefig('Full West Coast SST Anomalies')
plt.show()
plt.close()

full_anom is just a list of values and dat_dat is just a list of the dates please help. Thanks

Tom
  • 23
  • 3
  • 2
    Maybe [this question](https://stackoverflow.com/questions/49269927/missing-bars-in-matplotlib-bar-chart) could help you? I think your bars might be too close together / too thin. – rassar Sep 24 '22 at 02:22
  • You could try `ax.bar(dat_dat,full_anom,width=0.1, linewidth=0.5)` to force an outline for each bar. Without outline, thin bars that fall between pixels will be invisible. – JohanC Sep 24 '22 at 09:55

0 Answers0