# How to plot properly the disconnected regions if using the option Joined->True?

Consider the following domain:

reg = RegionPlot[(x^2 + y^2) <= 1 || 2 <= (x^3 + y^2) <= 5, {x, -3,
3}, {y, -5, 5}];
sens = {#[], #[]} & /@
Partition[Flatten[Cases[Normal@reg, Line[x_] :> x, Infinity]], 2];


Let us assume that sens is pre-generated. I would like to plot the resulting domain:

ListPlot[sens, Joined -> True] You may notice a straight line joining the two disconnected regions. Could you please tell me how to avoid their joining for this and other cases?

• Do not use Flatten, ListPlot[Cases[Normal@reg, Line[x_] :> x, Infinity], Joined -> True] Jun 1 at 11:51
• alternatively, you can always separate your OR conditions in two plots before you break them. But @cvgmt's answer is by far better!
– alex
Jun 1 at 11:59
• @cvgmt I think your comment merits an answer despite the "triviality" of the solution.
– alex
Jun 1 at 12:01
• @cvgmt : thanks! Would it be possible to export/import the unflattened object as e.g., Table, or some special format would be needed? Jun 1 at 19:43

We can remove Flatten and export the two groups of points to xls with two sheets for further use.

Clear[reg,sens];
reg = RegionPlot[(x^2 + y^2) <= 1 || 2 <= (x^3 + y^2) <= 5, {x, -3,
3}, {y, -5, 5}];
sens = Cases[Normal@reg, Line[x_] :> x, Infinity];
Export["test.xls", sens];
SystemOpen["test.xls"]
data = Import["test.xls"];
ListPlot[data, Joined -> True, AspectRatio -> Automatic]
Graphics[{Line@data}] 