Answers for "matplotlib put tick labels above graph"

1

Changing the number of ticks on a Matplotlib plot axis

# Get the current axis
ax = plt.gca()

# Only label every 20 th value
ticks_to_use = df.index[::20]

# Set format of labels(note year not excluded as requested)
labels = [i.strftime("%-H:%M") for i in ticks_to_use]

# Now set the ticks and labels
ax.set_xticks(ticks_to_use)
ax.set_xticklabels(labels)
Posted by: Guest on January-10-2022
0

own labels for ticks matplotlib

ax.set_xticklabels(labels)
Posted by: Guest on April-08-2021

Code answers related to "matplotlib put tick labels above graph"

Python Answers by Framework

Browse Popular Code Answers by Language