HighwayJohn
HighwayJohn

Reputation: 921

Matplotlib delete plot stribes

I have the following issue displayed in the image below:problem

For an improved clarity I want do delete the stripes on the x axis or put them below the x axis. (Also it would be nice If you know a solution to the problem of overlapping numbers)

Upvotes: 0

Views: 74

Answers (1)

TaxpayersMoney
TaxpayersMoney

Reputation: 689

Assuming you have defined your plot and axes as below:

import matplotlib.pyplot as plt
fig, ax = plt.subplots()

If you want to remove the x axis tick marks you can do:

ax.tick_params(axis='x', top='off', bottom='off')

If you want to change the direction of the tick marks you can do:

ax.tick_params(axis='x', direction='out')

If you want to change the x axis labels then use:

set_xticklabels()

You have to pass a list of labels to use, although I'm not sure why your labels aren't evenly spaced. The documentation at the link below should help:

matplotlib.axes documentation

Upvotes: 1

Related Questions