# Plotting Endpoints on a Piecewise Graph in Maple

I am trying to plot a piecewise function in Maple and have the endpoints of each piece be an open circle or closed circle accordingly. To define the function, I did:

f := proc (x) options operator, arrow; piecewise(x <= -1, -2-x, -1 < x and x <= 1, 4-4*x^2, 1 < x, x^2-4*x+3);

The to get a picture I did:

plot(f(x), x = -4 .. 4, discont = true)

I'd like to have the point $(-1,0)$, coming from the parabola, to have an open dot. I can't figure out how to make that work. I am brand new to Maple.

-

For this particular case use:

with(plottools):with(plots):
display(circle([-1, 0], 0.05, color = red), plot(f(x), x = -4 .. 4, discont = true));

-

One potential issue with using plottools:-circle is that the shape can appear as an ellipse if, say, the displayed x- and y-views are not equal and the scaling is not constrained. (Eg. change the x-range to x=-1.4 .. -0.9 to see this effect.)

Also, such a circle can get rendered a little roughly.

An alternative is to use plottools:-point and set the symbol to circle or solidcircle, which should render as circles regardless of the view or scaling.

You can even program it to compute the limits and value, etc.

restart:
with(plottools):with(plots):

f := x -> piecewise(x <= -1, -2-x,
-1 < x and x <= 1, 4-4*x^2,
1 < x, x^2-4*x+3):

setoptions(color="DarkRed", symbolsize=16, symbol=circle);

display(point([-1, limit(f(x),x=-1,right)]),
point([-1, limit(f(x),x=-1,left)]),
point([-1, f(-1)],  symbol=solidcircle),
plot(f(x), x = -4 .. 4, discont = true));


In the above code a few plot options are set as new defaults, which can get overridden with optional arguments to the plotting commands. (Eg. symbol=solidcircle, when passed as an option, overrides the new default of symbol=circle.)

-