Plots with stairs and inclines?
조회 수: 1(최근 30일)
Assume I need to create a plot including both gentle slides and abrupt steps, such as the attached plot (note the step-like drop at vertical 2 versus the incremental slope of vertical 2-3).
To my understanding, plot() only produces the latter, while stairs() the former. How can I produce both, aside from piecing it together using several 'identical but distinct' lines on the same figure (not optimal).
Andrew Newell 2017년 4월 24일
I'm not sure how you intend to generate the points, but for the example plot you gave, plot works just fine with an appropriate input:
x = [0:2 2:5];
y = [0 1 2 1 -1 0 0];
axis([0 5 -3 3])