11
$\begingroup$

Just upgraded to 12.3.1 from 12.1.

In 12.3.1,

ContourPlot[Sin[x] Sin[y], {x, -1, 1}, {y, -1, 1}, 
 ContourStyle -> 
  Directive[Black, Dashing[{0, Medium, Medium, Medium}], 
   CapForm["Round"], AbsoluteThickness[2.]]]

now produces

enter image description here

whereas before the edges of all the dashes (long and short) would be rounded. This is the result from 12.1:

enter image description here

Note: Simply pasting the 12.3.1 output into a 12.1 notebook makes the line caps rounded.


I tried searching the documentation, but I can't find another way of doing this. What is the new method?

$\endgroup$
3
  • 3
    $\begingroup$ I added the 12.1 output to your post, to make it easier to understand what you mean. $\endgroup$
    – Szabolcs
    Aug 31, 2021 at 10:46
  • $\begingroup$ @Szabolcs Amazing! The note you added is very interesting. Do you have an explanation for it? $\endgroup$ Aug 31, 2021 at 11:07
  • $\begingroup$ The copy-paste note? This indicates that the bug is not in CountourPlot, but in graphics rendering. CountourPlot generates the correct Graphics expression with the correct Dashing directive. But the Mathematica front end does not render it correctly. $\endgroup$
    – Szabolcs
    Aug 31, 2021 at 11:11

1 Answer 1

14
$\begingroup$

Dashing was extended in 12.3. As such, you need to specify the cap type as part of the dashing spec. i.e.,

Dashing[{0, Medium, Medium, Medium}, 0, "Round"]

The capspec in Dashing overrides anything specified via CapForm in the directives list.

$\endgroup$
2
  • 1
    $\begingroup$ So, to clarify, even the default setting (i.e., not giving an explicit optional setting) would cause the override? $\endgroup$ Aug 31, 2021 at 18:25
  • 2
    $\begingroup$ Correct. The single argument form is just shorthand for Dashing[arg, 0, "Butt"]. $\endgroup$
    – ihojnicki
    Aug 31, 2021 at 18:59

Your Answer

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

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