title: How to set axis ticks in multiples of pi (Python) (matplotlib)
body: <p>I'd like to make a plot in Python and have x range display ticks in multiples of pi. </p>
  
  <p>Is there a good way to do this, not manually? </p>
  
  <p>I'm thinking of using matplotlib, but other options are fine. </p>
  
  <p>EDIT 3: EL_DON's solution worked for me like this: </p>
  
  <pre><code>import matplotlib.ticker as tck
  import matplotlib.pyplot as plt
  import numpy as np
  
  f,ax=plt.subplots(figsize=(20,10))
  x=np.linspace(-10*np.pi, 10*np.pi,1000)
  y=np.sin(x)
  
  ax.plot(x/np.pi,y)
  
  ax.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
  ax.xaxis.set_major_locator(tck.MultipleLocator(base=1.0))
  
  plt.style.use("ggplot")
  
  
  plt.show()
  </code></pre>
  
  <p>giving:</p>
  
  <p><a href="https://i.stack.imgur.com/bl2D3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bl2D3.png" alt="nice sine graph"></a></p>
  
  <p>EDIT 2 (solved in EDIT 3!): EL_DON's answer doesn't seem to work right for me: </p>
  
  <pre><code>import matplotlib.ticker as tck
  import matplotlib.pyplot as plt
  import numpy as np
  
  f,ax=plt.subplots(figsize=(20,10))
  x=np.linspace(-10*np.pi, 10*np.pi)
  y=np.sin(x)
  
  ax.plot(x/np.pi,y)
  
  ax.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
  ax.xaxis.set_major_locator(tck.MultipleLocator(base=1.0))
  
  plt.style.use("ggplot")
  
  plt.show()
  </code></pre>
  
  <p>gives me </p>
  
  <p><a href="https://i.stack.imgur.com/OwvCq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OwvCq.png" alt="plot"></a></p>
  
  <p>which really doesn't look right</p>