1 | initial version |
The two functions in the question only take values between 5 and 155,
so plot
chooses a corresponding y range.
There is a space between the x axis and the y axis to indicate that the y range does not start at zero. In the example from the question, it turns out that the space between the x axis and the y axis is larger than the missing part of the y axis...
I assume this is what you find puzzling, and "not to break the y-axis" means the y range should include 0 in this case.
This can be achieved here by specifying ymin=0
, either in the plot:
sage: plot([12 * x + 23, 15 * x + 5], (x, 0, 10), aspect_ratio=.05, ymin=0)
or in the show:
sage: p = plot([12 * x + 23, 15 * x + 5], (x, 0, 10), aspect_ratio=.05)
sage: p.show(ymin=0)
If the graph was below 0, one would instead use ymax=0
.
To not depend on whether the plot is above or below 0, add a transparent point at the origin to the plot.
sage: p = plot([12 * x + 23, 15 * x + 5], (x, 0, 10), aspect_ratio=.05)
sage: origin = point2d([(0, 0)], alpha=0)
sage: (origin + p).show()