I wrote some code to get a piecewise plot which is displayed correctly. Now I'd like to join the various parts of the plot, using some kind of interpolation, to get a continuous chart even though it's actually a piecewise one.

Let me to give you an example. Assuming $f_1(2) = 3$ and $f_2(2) = 1$, how can I join the points $(2,3)$ and $(2,1)$ in the plot?

  • $\begingroup$ Should we assume that f1(3) and f2(1) are undefined? $\endgroup$ – Sparr Mar 22 '13 at 21:01
  • $\begingroup$ How do I make a piecewise function not continue at 0 after I've set my limits? I'm trying to make a shape but when I set my bounds ie 0<=x<=4 for the equation 2x the line will continue at y=0 $\endgroup$ – abbie Sep 19 '18 at 13:52
  • $\begingroup$ @abbie if you have a new question please post a separate question rather than answering old ones. Please remember to include the code you are using. $\endgroup$ – Kuba Sep 19 '18 at 14:56

Your questions is not that clear to me, but I guess you want to join the two piece wise parts with a vertical line. That would be Exclusions.

Plot[Piecewise[{{3, x < 2}, {1, x > 2}}], {x, -2, 5}, Exclusions -> None]

leads to

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.