I use Plot
to generate a plot of a function and I surimpose to it points of different nature thru the Epilog option.
func = Sin[x];
ptsInfl = Solve[D[func, {x, 2}] == 0]; (* inflection points*)
ptsExtrm = Solve[D[func, {x, 1}] == 0] ;(* extremum points*)
t1 = Table[
Point[{#[[2]], func /. #}] /. C[1] -> i & /@ ptsInfl[[All, 1]], {i,
0, 1}];
t2 = Table[
Point[{#[[2]], func /. #}] /. C[1] -> i & /@
ptsExtrm[[All, 1]], {i, 0, 1}];
Plot[{func}, {x, 0, 3 Pi},
Epilog -> {Red, PointSize@Large, t1[[#]] & /@ Range@Length@t1, Green,
t2[[#]] & /@ Range@Length@t2}]
How can I construct a framed legend to the example above with two rows, one having a blue line with a green point astride it and beside it some text, and another one with a blue line with a red point astride it plus some text ? I am expecting to get something similar with the options PointLegend
and PlotMarkers
of the function ListLinePlot
.
Wojtek