Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For plotting open or closed intervals you could do something like:</p> <pre><code>intPlot[ss_, {s_, e_}, ee_] := Graphics[{Red, Thickness[.01], Text[Style[ss, Large, Red, Bold], {s, 0}], Text[Style[ee, Large, Red, Bold], {e, 0}], Line[{{s, 0}, {e, 0}}]}, Axes -&gt; {True, False}, AxesStyle -&gt; Directive[Thin, Blue, 12], PlotRange -&gt; {{ s - .2 Abs@(s - e), e + .2 Abs@(s - e)}, {0, 0}}, AspectRatio -&gt; .1] intPlot["[", {3, 4}, ")"] </code></pre> <p><img src="https://i.stack.imgur.com/JB3FE.png" alt="enter image description here"></p> <p><strong>Edit</strong> </p> <p>Following is the nice extension done by @Simon, probably spoiled by me again trying to solve the overlapping intervals issue. </p> <pre><code>intPlot[ss_, {s_, e_}, ee_] := intPlot[{{ss, {s, e}, ee}}] intPlot[ints : {{_String, {_?NumericQ, _?NumericQ}, _String} ..}] := Module[{i = -1, c = ColorData[3, "ColorList"]}, With[ {min = Min[ints[[All, 2, 1]]], max = Max[ints[[All, 2, 2]]]}, Graphics[Table[ With[{ss = int[[1]], s = int[[2, 1]], e = int[[2, 2]], ee = int[[3]]}, {c[[++i + 1]], Thickness[.01], Text[Style[ss, Large, c[[i + 1]], Bold], {s, i}], Text[Style[ee, Large, c[[i + 1]], Bold], {e, i}], Line[{{s, i}, {e, i}}]}], {int, ints}], Axes -&gt; {True, False}, AxesStyle -&gt; Directive[Thin, Blue, 12], PlotRange -&gt; {{min - .2 Abs@(min - max), max + .2 Abs@(min - max)}, {0, ++i}}, AspectRatio -&gt; .2]]] (*Examples*) intPlot["[", {3, 4}, ")"] intPlot[{{"(", {1, 2}, ")"}, {"[", {1.5, 4}, ")"}, {"[", {2.5, 7}, ")"}, {"[", {1.5, 4}, ")"}}] </code></pre> <p><img src="https://i.stack.imgur.com/pvE1u.png" alt="enter image description here"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload