Is there any way that I can label/mark points (axes intercepts, maximum/minimum values etc.) on Mathematica? (as in without using the drawing tools)

Such as in the case of: Plot[{x^3 – 6*x^2 + 9*x + 10}, {x, 0, 4}]

Thanks

=================

1

You can use Epilog to add whatever you want, but you have to calculate those point’s positions. Related: Labeling points of intersection between plots

– Kuba

Oct 15 ’15 at 10:00

Hi @Kuba Thanks for your response – I’m new to mathematica, and although this might sound a bit amateurish/childish – Can you please show me what the coding may look like in a basic graph? Such as in the aforementioned example or something of the like.

– Sven

Oct 15 ’15 at 10:12

1

Type in Epilog to Mathematica notebook, press F1 🙂

– Kuba

Oct 15 ’15 at 10:14

Alright, I think I get it now – Thank you so much!!

– Sven

Oct 15 ’15 at 10:20

@Sven, the point is the the documentation of Epilog does contain the examples you are after, so the pointer provided by Kuba is actually enough to answer your question.

– rhermans

Oct 15 ’15 at 13:37

=================

1 Answer

1

=================

Here is an example of some of the things you could do using Epilog, which essentially allows you to combine any 2D graphics primitives on top of an existing plot.

I will define your function as fun[x]:

Clear[fun, realzero]

fun[x_] := x^3 – 6*x^2 + 9*x + 10

I can use Solve to find the function’s zeroes, i.e. its intersections with the horizontal axis:

realzero = {x, 0} /. First@Solve[fun[x] == 0., x, Reals]

(* Out: {-0.721892, 0} *)

I then have Mathematica calculate the expression’s first derivative and set up an equation to find its zeroes, i.e. the function’s extrema.

Solve[D[fun[x], x] == 0, x]

(* Out: {{x -> 1}, {x -> 3}} *)

I can then combine what I found in a plot:

Plot[fun[x], {x, -1, 4},

Epilog -> {PointSize[0.03],

Red, Tooltip[#, #[[1]]] &@Point[{1, fun[1]}],

Blue, Tooltip[#, #[[1]]] &@Point[{3, fun[3]}],

Darker@Green, Tooltip[#, #[[1]]] &@Point[realzero],

Orange, Tooltip[#, #[[1]]] &@Point[{0, fun[0]}]

},

AxesStyle -> Directive[Gray, Dashed], AxesOrigin -> {0, 0},

PlotRange -> {Automatic, {-4, All}},

PlotRangePadding -> {None, {0, Scaled[0.1]}},

Frame -> True,

FrameLabel -> (Style[#, Bold, FontSize -> 14] & /@ {“x”, “y”})

]

If you execute the code in Mathematica and hover over those points with the mouse, you will also notice that a tooltip pops up with the coordinates for those points.

I would suggest that you use this code as a starting point to explore the commands and options showcased: play around with it, modify it, dig into the documentation… Mathematica can be a lot of fun!

Thank you very much!! This is a great starting point – Can’t wait to discover more!! 😀

– Sven

Oct 15 ’15 at 10:28