2

When creating a 2-D plot in Matplotlib, what method hides the tick marks/lines but not the labels? I want the opposite of this question. I do not see an appropriate method in the Matplotlib API.

As a hack, I have considered "hiding" the tick marks by setting the color to match the background (e.g., white). Is there a better way?

1 Answer 1

6

The appropriate method to manipulate the ticks is .tick_params().

Here you want to turn the ticks off, but not the labels, hence

ax.tick_params(axis="x", bottom=False)

for a single axis, or

ax.tick_params(left=False, bottom=False)

for both axes.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.