2
$\begingroup$

I am plotting this contour map Mathematica (Version 13.0.1):

ContourPlot[Log[x] + Log[y], {x, 0, 8}, {y, 0, 6}, AxesLabel -> Automatic, ContourShading -> False, Contours -> {1, 2, 2 Log[3], 3}, ContourStyle -> {{Thick, Blue}}, ContourLabels -> (Text[Style[#3, 14, Blue], {#1, #2}] &), Frame -> False, Axes -> True, GridLines -> None, Ticks -> {{3}, {3}},TicksStyle -> Directive[14]]

The result is pasted below. Clearly, Mathematica mixes up the labels of the last two contour lines. The problem vanishes if I use the numerical value of 2*Log[3], so I am guessing the Log function creates problems here. What could it be? How could I work around it?

Thanks!

enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ Welcome to Mathematica StackExchange! Can you please edit the question and include which version of Mathematica you are using? I cannot reproduce your issue in version 14.3 ... So it might be that there was a bug that was already fixed in some previous version. $\endgroup$ Commented Oct 3 at 9:48
  • $\begingroup$ I can reproduce the bug on version 13.0.1. $\endgroup$ Commented Oct 3 at 10:33
  • $\begingroup$ Thanks for the feedback! I have added the version number 13.0.1. If it works in a newer one, I'll find a workaround... $\endgroup$ Commented Oct 3 at 12:08
  • $\begingroup$ Also version 14.2 is Ok $\endgroup$ Commented Oct 3 at 17:49

1 Answer 1

3
$\begingroup$

Workaround:

contours = {1, 2, 2 Log[3], 3};
rule = Thread[N@contours -> contours];

ContourPlot[Log[x] + Log[y], {x, 0, 8}, {y, 0, 6}, 
 AxesLabel -> Automatic, ContourShading -> False, 
 Contours -> N@contours, ContourStyle -> {{Thick, Blue}}, 
 ContourLabels -> (Text[Style[#3 /. rule, 14, Blue], {#1, #2}] &), 
 Frame -> False, Axes -> True, GridLines -> None, Ticks -> {{3}, {3}},
  TicksStyle -> Directive[14]]

enter image description here

$\endgroup$
0

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.