I’m plotting absolute value functions in matplotlib and the graph just goes around the vertex

The issue for your goal is your range that you create with linspace. The default number of samples is 50 for this method and they are evenly reparted so depending on your width, 2 might not be in this range. Use the num argument (third position) to increase this value and it will look better but your value might still not be in the range.

(The problem is you’re working on a list of numbers, you can’t work on a infinite set).

Leave a Comment