Showing a point on a plot as a circle rather than a disk

I recommend plotting the function like this:

f[x_] = Which[x <= 1, x^3 + 3 x^2 - 2, x > 1, 4]

Show[Plot[f[x], {x, -4, 4}], 
 ListPlot[{{1, Limit[f[x], x -> 1, Direction -> "FromAbove"]}}, 
  PlotMarkers -> "OpenMarkers"], 
 PlotRange -> {{-4, 4}, {-4, 6}},
 AspectRatio -> 1, AxesLabel -> {x, y}]

The open marker signifies the left end point is not plotted on the second interval. The Limit function is used to calculate the point.

enter image description here


Here's how to do it using the Disk graphics primitive. It is similar to Nasser's deleted answer, but with the difference that I use ColorData[97] to make the color of the marker match the curve, and I use Offset to fix the aspect ratio issue. (No matter what aspect ratio you're using, the disk will stay circular.)

f[x_] := Which[x <= 1, x^3 + 3 x^2 - 2, x > 1, 4]

Plot[
 f[x], {x, -4, 4},
 PlotRange -> {{-4, 4}, {-4, 6}},
 AspectRatio -> 1/GoldenRatio,
 AxesLabel -> {x, y},
 Epilog -> {
   EdgeForm[{Thick, ColorData[97, 1]}], FaceForm[White],
   Disk[{1, f[1]}, Offset[{4, 4}]]
   }
 ]

Mathematica graphics

Tags:

Plotting