title: How do you plot a line with two slopes using python
body: <p>I am using the below codes to plot a line with two slopes as shown in the picture.The slope should should decline after certain limit [limit=5]. I am using vectorisation method to set the slope values.Is there any other method to set the slope values.Could anyone help me in this?</p>
  
  <pre><code>                import matplotlib.pyplot as plt
                  import numpy as np
  
                  #Setting the condition
                  L=5 #Limit
                  m=1 #Slope
                  c=0 #Intercept
  
                  x=np.linspace(0,10,1000)
                  #Calculate the y value
                  y=m*x+c
  
                  #plot the line
                  plt.plot(x,y)
  
                  #Set the slope values using vectorisation
                  m[(x&lt;L)] = 1.0
                  m[(x&gt;L)] = 0.75
  
                  # plot the line again
                  plt.plot(x,y)
  
                  #Display with grids
                  plt.grid()
                  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/3dtgA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3dtgA.png" alt="enter image description here"></a></p>