I would like to show only the relevant parts on the x-axis in a matplotlib generated plot - using the pyplot
wrapper library.
Question: How can the plot be forced to cutoff at certain axis-positions, by passing tuples of interval-ranges, that define the intervals for the x-axis to be plotted. Ideally the cutoff should be signified with a vertical double-waved sign superimposed on the x-axis.
Using xlim
and axis
was of no use, as it only allows the beginning and end of the x-axis to be set but no intervals in-between:
Specifically, for the plot above, the x-axis region between
60 to 90
should not be shown, and cutoff/ discontinuous-plot marks should be added.
import matplotlib.pyplot as pyplot
x1, x2 = 0, 50
y1, y2 = 0, 100
pyplot.xlim([x1, x2])
#alternatively
pyplot.axis([x1, x2, y1, y2])
Using matplotlib is not a requirement.
Update/Summary:
- Viktor points to this source, using
subplots
-splitting and two plots to emulate a broken-line plot in matplotlib/pyplot.