title: How to remove certain xticks or yticks in a a matplotlib subplot?
body: <p>I am plotting multiple plots using subplot.</p>
  
  <p><a href="https://i.stack.imgur.com/BDskJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BDskJ.png" alt="enter image description here"></a></p>
  
  <p>I would like to remove all yticks except for those on the left, and all xticks except for those on the bottom. I am trying to create shared axes.</p>
  
  <p>I have tried some stackoverflow answers such as using <code>plt.tick_params</code> and targeting certain subplots:</p>
  
  <pre><code>    if num in [2,3,5,6,8,9] :
          plt.tick_params(labelleft='off')
      if num not in range(7) :
          plt.tick_params(labelbottom='off')
  </code></pre>
  
  <p>I have also tried adjusting <code>tick_params</code> at the very end:</p>
  
  <pre><code>plt.tick_params(axis='both', which='both', right=False, left=True, top=False, bottom=True)
  </code></pre>
  
  <p>However all yticks and xticks appear every time.</p>
  
  <p>Is there another method I can try?</p>
  
  <p>My plotting code so far:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  import pandas as pd
  import seaborn as sns
  
  
  sns.set_style("whitegrid")
  myl = sns.color_palette().as_hex()
  
  num=0
  
  # figure size
  plt.figure(figsize=(20, 30))
  
  
  for column in newtempgraph.drop(['local_date'], axis=1):
  
      num+=1
  
      # Find the right spot on the plot
      plt.subplot(7,3, num)
  
      # Plot the lineplot
      plt.plot(newtempgraph['local_date'], newtempgraph[column],  color=myl[num-1], linewidth=1.9, alpha=0.9, label=column,linestyle='--')
  
      # Same limits for everybody
      plt.xlim(newtempgraph['local_date'].min(),newtempgraph['local_date'].max())
      plt.ylim(0,1464)
  
      # Not ticks everywhere
      if num in [2,3,5,6,8,9] :
          plt.tick_params(labelleft='off')
      if num not in range(7) :
          plt.tick_params(labelbottom='off')
  
      # Add title
      plt.title(column, loc='left', fontsize=20, fontweight=0, color=myl[num-1] )
      plt.xticks(fontsize=13,rotation=45)
      plt.yticks(fontsize=15)
  
  plt.suptitle("Performance of Shops", fontsize=20, fontweight=0, color='black', style='italic', y=1.02)
  plt.tick_params(axis='both', which='both', right=False, left=True, top=False, bottom=True)
  plt.tight_layout()
  #plt.tick_params(axis='both', which='both', right=False, left=True, top=False, bottom=True)
  </code></pre>
  
  <p>And my df, for using <code>pd.DataFrame.from_dict()</code>:</p>
  
  <pre><code>{'local_date': {0: Timestamp('2020-01-06 00:00:00'),
    1: Timestamp('2020-01-13 00:00:00'),
    2: Timestamp('2020-01-20 00:00:00'),
    3: Timestamp('2020-01-27 00:00:00'),
    4: Timestamp('2020-02-03 00:00:00'),
    5: Timestamp('2020-02-10 00:00:00'),
    6: Timestamp('2020-02-17 00:00:00'),
    7: Timestamp('2020-02-24 00:00:00'),
    8: Timestamp('2020-03-02 00:00:00'),
    9: Timestamp('2020-03-09 00:00:00'),
    10: Timestamp('2020-03-16 00:00:00'),
    11: Timestamp('2020-03-23 00:00:00'),
    12: Timestamp('2020-03-30 00:00:00')},
   'shop1': {0: 100.0,
    1: 156.0,
    2: 1231.0,
    3: 360.0,
    4: 250.0,
    5: 150.0,
    6: 1287.0,
    7: 397.0,
    8: 546.0,
    9: 270.0,
    10: 50.0,
    11: 1464.0,
    12: 280.0},
   'shop2': {0: 0.0,
    1: 430.0,
    2: 270.0,
    3: 900.0,
    4: 665.0,
    5: 750.0,
    6: 780.0,
    7: 360.0,
    8: 704.0,
    9: 480.0,
    10: 470.0,
    11: 0.0,
    12: 730.0},
   'shop3': {0: 222.0,
    1: 258.0,
    2: 255.0,
    3: 367.0,
    4: 332.0,
    5: 324.0,
    6: 269.0,
    7: 336.0,
    8: 492.0,
    9: 349.0,
    10: 329.0,
    11: 354.0,
    12: 581.0},
   'shop4': {0: 607.0,
    1: 140.0,
    2: 172.0,
    3: 89.0,
    4: 63.0,
    5: 700.0,
    6: 157.0,
    7: 401.0,
    8: 112.0,
    9: 180.0,
    10: 76.0,
    11: 104.0,
    12: 346.0},
   'shop5': {0: 51.0,
    1: 375.0,
    2: 78.0,
    3: 92.0,
    4: 59.0,
    5: 193.0,
    6: 137.0,
    7: 96.0,
    8: 331.0,
    9: 195.0,
    10: 291.0,
    11: 347.0,
    12: 190.0},
   'shop6': {0: 150.0,
    1: 225.0,
    2: 345.0,
    3: 150.0,
    4: 230.0,
    5: 0.0,
    6: 500.0,
    7: 150.0,
    8: 0.0,
    9: 230.0,
    10: 50.0,
    11: 270.0,
    12: 0.0},
   'shop7': {0: 39.0,
    1: 130.0,
    2: 278.0,
    3: 0.0,
    4: 0.0,
    5: 585.0,
    6: 175.0,
    7: 0.0,
    8: 360.0,
    9: 79.0,
    10: 135.0,
    11: 0.0,
    12: 0.0},
   'shop8': {0: 74.0,
    1: 66.0,
    2: 75.0,
    3: 95.0,
    4: 158.0,
    5: 50.0,
    6: 233.0,
    7: 117.0,
    8: 146.0,
    9: 142.0,
    10: 261.0,
    11: 30.0,
    12: 85.0},
   'shop9': {0: 74.0,
    1: 146.0,
    2: 166.0,
    3: 6.0,
    4: 75.0,
    5: 22.0,
    6: 33.0,
    7: 18.0,
    8: 15.0,
    9: 110.0,
    10: 150.0,
    11: 144.0,
    12: 561.0}}
  </code></pre>