Google suggests something like this might work:
Code:p1 := Plot[ 2x , {x, -1, 1}]; p2 := Plot[2x, {x, 5, 10}]; Show[p1, p2];
Dear MHF members,
I need to plot a figure as in the following figure.
I use the code
to get the following image.Code:Plot[{t, t - 2 \[Pi]}, {t, 0, 8 \[Pi]}, PlotStyle -> {Red, Blue}, Ticks -> {Table[j \[Pi], {j, 0, 8}], Table[j \[Pi], {j, -2, 8}]}]
But I don't know how to remove the segments , , and from the -axis and remove the same parts of the functions and .
Thanks.
bkarpuz
Thanks SpringFan25.
The following works for me.
But still don't know how to remove the intervals from the -axis.
Code:Show[Table[{Plot[t, {t, 2 j \[Pi], (2 j + 1) \[Pi]}, PlotStyle -> Red], Plot[t-2 \[Pi], {t, 2 j \[Pi], (2 j + 1) \[Pi]}, PlotStyle -> Blue], Plot[0, {t, 2 j \[Pi], (2 j + 1) \[Pi]}, PlotStyle -> {Black, Thick}]}, {j, 0, 3}], Ticks -> {Table[j \[Pi], {j, 0, 7}], Table[j \[Pi], {j, -2, 7}]}, PlotRange -> All]
this might be useful, it show code doing what you want. I ahve no idea how it works though!
http://www.st-andrews.ac.uk/~pl10/c/djmpark/Assets/C3527823/BrokenAxisGraph.pdf
Well, a really cheesy way to get the desired output would be something like this:
I.e., draw white lines over the parts of the axis you don't want. If you use it to produce a vector graphic to include elsewhere, this might be a problem, though.Code:Show[Table[{Plot[t, {t, 2 j \[Pi], (2 j + 1) \[Pi]}, PlotStyle -> Red], Plot[t - 2 \[Pi], {t, 2 j \[Pi], (2 j + 1) \[Pi]}, PlotStyle -> Blue], Plot[0, {t, 2 j \[Pi], (2 j + 1) \[Pi]}, PlotStyle -> {Black}]}, {j, 0, 3}], Ticks -> {Table[j \[Pi], {j, 0, 7}], Table[j \[Pi], {j, -2, 7}]}, PlotRange -> {{0, 7 \[Pi]}, {-2 \[Pi], 7 \[Pi]}}, AspectRatio -> 7/9, Epilog -> Inset[Show[ Table[Plot[0, {x, j \[Pi], j \[Pi] + \[Pi]}, PlotRange -> {{0, 7 \[Pi]}, {-2 \[Pi], 7 \[Pi]}}, Axes -> False, PlotStyle -> {{Thickness[.006], White, EdgeForm[]}}, AspectRatio -> 7/9], {j, 1, 7, 2}]], {0, 0}, {0, 0}, {7 \[Pi], Automatic}] ]
Perhaps you could try to play around with the Inset[] function; I have a feeling that it should be possible to create a table of plots for each interval, and then add them to a plot with not axes using Inset. The positioning might be a bit tricky, and you might have to pay attention to AspectRatio.