0

I'm creating a board game using python and matplotlib. this is my first time using matplotlib and I have learnt from Google.

I was wondering if there was a way to remove these little black lines along my axis (Highlighted in red boxes). Click Here

I have added the grid lines by using:

plt.grid(True)

and i have hidden the axes by using:

frame1 = plt.gca()
frame1.axes.xaxis.set_ticklabels([])
frame1.axes.yaxis.set_ticklabels([])

Any help would be wonderful. Reply to this if you need anymore information

Kind Regards.

Renato Gama
  • 16,431
  • 12
  • 58
  • 92
  • My general advice with nitpicky things in matplotlib is to deal with it, or write a better plotting library from scratch. I doubt there's a way with vanilla matplotlib. – ChootsMagoots Apr 06 '18 at 17:43
  • @ChootsMagoots Can you please not comment below just any random matplotlib question that you personally doubt it to have a solution?! As I see it, most problems do have a solution, especially such straight forward things like this. Apart Matplotlib is open source and users are invited to contribute to the code; why would you write a new library instead of improving the existing one? – ImportanceOfBeingErnest Apr 06 '18 at 18:28

1 Answers1

0

See here and here

Seems like the most generally accepted answer is using the tick_params() method

plt.tick_params(
    axis='both',       # changes apply to the x-axis
    which='both',      # both major and minor ticks are affected
    left='off',        # ticks along the left edge are off
    right='off',       # ticks along the right edge are off
    bottom='off',      # ticks along the bottom edge are off
    top='off')         # ticks along the top edge are off
Josh Wilkins
  • 193
  • 1
  • 8