How to do it...

We are creating our own data in our Python module by assigning lists with data to the xValues and yValues variables.

In many graphs, the beginning of the x and y coordinate system starts at (0, 0). This is usually a good idea, so let's adjust our chart coordinate code accordingly.

Let's modify the code to set limits on both the x and y dimensions:

Matplotlib_labels_two_charts_scaled_dynamic.py

    xValues  = [1,2,3,4]     yValues0 = [6,7.5,8,7.5]     yValues1 = [5.5,6.5,50,6]           # one very high value (50)     yValues2 = [6.5,7,8,7]                   axis.set_ylim(0, 8)                 # lower limit (0)     axis.set_xlim(0, 8)                 # use same limits for x

Now that we have set the same limits for x and y, our chart might look more balanced. When we run the modified code, we get the ...

Get Python GUI Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.