title: How to plot a function showing discrete steps rather than continuous changes between samples in python?
body: <p>I want to plot prime counting function as a <em>step function</em> using <em>Python</em>. I have done this using <em>mathematica</em>, picture below - </p>
  
  <p><img src="https://i.stack.imgur.com/8RWQi.png" alt="I want step wise graph like this one."></p>
  
  <p><strong>My python code</strong></p>
  
  <pre><code>import numpy as np 
  import matplotlib.pyplot as plt 
  import sympy                        # for evaluating number of primes &lt;= n 
  
  def f(n):
      arr = []
      for i in range(1,n+1):
          arr.append(sympy.primepi(i))
          #print('For',i, 'value', arr[i-1])
      return arr
  
  ar = f(100)
  
  t1 = np.arange(1,101,1,dtype = int)
  plt.plot(t1, ar ,'bo')           # instead of 'bo' what I need to use to make it like 1st picture?
  plt.axis([0,110,0,25]) 
  plt.show()
  </code></pre>
  
  <p>which produces </p>
  
  <p><img src="https://i.stack.imgur.com/9SYwI.png" alt="this image."></p>
  
  <p>Can anyone tell me how to make this graph <em>stepwise</em> as it is in the first image?  and please share if there is any other good way to do this task which will be efficient.</p>
  
  <p><strong>References</strong>:</p>
  
  <ol>
  <li>For more on prime counting function see <a href="http://mathworld.wolfram.com/PrimeCountingFunction.html" rel="nofollow noreferrer">here</a>.</li>
  </ol>