Hiding Tick Marks

Screen Link:

My Code:

import pandas as pd
import matplotlib.pyplot as plt

wdegrees = pd.read_csv('percent-bachelors-degrees-women-usa.csv', encoding='UTF-8')

darkblue = (0/255,107/255, 164/255)
orange = (255/255, 128/255, 14/255)

stems = ['Engineering', 'Computer Science', 'Psychology', 'Biology', 'Physical Sciences', 'Math and Statistics']

fig = plt.figure(figsize=(18,6))

for sp in range(0,6):                                               # Noting subplots(sp)
    ax = fig.add_subplot(1,6,sp+1)
    ax.plot(wdegrees['Year'], wdegrees[stems[sp]], label='Women', c=darkblue, linewidth=3)
    ax.plot(wdegrees['Year'], 100-wdegrees[stems[sp]], label='Men', c=orange, linewidth=3)
    ax.set_xlim(1968,2011)
    ax.set_ylim(0,100)
    ax.set_title(stems[sp])
    for key,spines in ax.spines.items():
        spines.set_visible(False)
    ax.tick_params(bottom='off', top='off', left='off', right='off')
    if sp == 0:
        ax.text(2005,87,'Men')
        ax.text(2002,8, 'Women')
    elif sp == 5:
        ax.text(2005, 62, 'Men')
        ax.text(2001, 35, 'Women')
        
plt.show()
Replace this line with your code

What I expected to happen:
I used ax.tick_params(bottom=‘off’, top=‘off’, right=‘off’, left=‘off’)
I expected my tick marks to hide, but they are still there.

What actually happened:

Replace this line with the output/error

I am wondering if I am missing something within my codes?

Hi @chautran0729,

Try using False instead of 'off':

ax.tick_params(bottom=False, top=False, left=False, right=False)
1 Like

Thank you so much that worked. Was this in our mission lesson that I might not have caught?

No, in the mission it was exactly 'off'. But I discovered this thing myself while doing one of the guided projects on visualizations :blush: