4
$\begingroup$

I am really new to MATHEMATICA and I am struggling to make a nice graph as follows:

enter image description here

I am stuck a bit as I cannot put labels on the intersection points....I do not want to use the drawing pallete as Microsoft Word has this option... Maybe an option would be to use Epilog for better graphics but I do not really know how to do that... labels with just the coords of the intersection points would be fine. Thanks for any advise.

$\endgroup$
2
  • 1
    $\begingroup$ One pretty easy way is to use ListPlot with Callout or Labeled to generate the points with labels, e.g. ListPlot[{Callout[{1, 2}, a], Callout[{3, 4}, b]}] $\endgroup$
    – Lukas Lang
    Commented Oct 26, 2019 at 18:55
  • $\begingroup$ @LukasLang, Thanks but shall I put this "ListPlot" expression inside the "ContourPlot" or do something else? $\endgroup$
    – dmtri
    Commented Oct 26, 2019 at 19:21

1 Answer 1

6
$\begingroup$
f1[x_, y_] := 2 x^2 - 3 y - 7
f2[x_, y_] := 3 x + 4 y + 1

cp = ContourPlot[{f1[x, y] == 0, f2[x, y] == 0}, {x, -10, 10}, {y, -5, 50},
     PlotRange -> {{-5, 5}, {-5, 6}, All}];

intersections = Graphics`Mesh`FindIntersections[cp];

You can add labels using Epilog + Text:

Show[cp, 
  Epilog -> {Text[Pane @ #, # + {1.7, .2}] & /@ intersections,
   PointSize[Large],  Red, Point /@ intersections}]

enter image description here

Alternatively, use intersections with ListPlot:

Show[cp, 
  ListPlot[intersections, 
    LabelingFunction -> (Callout[#, Right]&),
    PlotStyle -> Directive[PointSize[Large], Red]]]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks, a lot for your answer. I could not imagine that mathematica wants so much effort for just a label... $\endgroup$
    – dmtri
    Commented Oct 26, 2019 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.