Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

For some weird reason, they apparently changed the styling of contours in ContourPlot for 10.0. Here is a comparison of the results for V9 and V10 (first 9, then 10):

ContourPlot[Sin[x y], {x, 0, 3}, {y, 0, 3}, 
    ContourShading -> None,  ContourStyle -> {{Red, Thickness[0.008]}}]

Mathematica 9 output Version 9

Mathematica 10 output Version 10

Firstly, can I override the coloring? I would like to keep the solid colors that were in V9. And secondly, where do those dark spots come from? Is this a bug?

Edit: yes, this does look like a bug. The dark spots are only visible in the Mac version.

Interestingly enough, for about half a second after the output appears, what I see on the screen is similar to what Export produces (shown below). The only difference is that the lines are thinner in the exported .png (another bug?). After those 0.5 seconds, another level of transparency kicks in and I see what is shown in the top picture below.

ContourPlot[Sin[x y], {x, 0, 3}, {y, 0, 3}, 
    Contours -> {.9}, ContourShading -> None, 
    ContourStyle -> {{Red, Thickness[0.17]}}]

enter image description here <- What I see. enter image description here <- What Export produces.

share|improve this question
    
You may try setting PlotTheme to traditional? –  Yi Wang Jul 10 at 6:58
    
@YiWang you meant Classic? It's okay but it adds a strange blue frame even with `Frame->None" added. And the dark spots are still suspicious. –  level1807 Jul 10 at 7:05
    
I do not get any spots, using V10, windows 7 !Mathematica graphics –  Nasser Jul 10 at 7:23
1  
Here is a wild guess: Might these spots come from overlapping ends of line segments (caps), and they become darker due to additive effects and the transparency? See this answer: mathematica.stackexchange.com/a/5406/58 –  Thomas Jul 10 at 10:31
1  
@level1807 Presumably (but I don't know) rendering in general (and of transparent objects in particular) uses OS functionality and is therefore platform specific, which might explain why it occurs on Macs but not Windows. –  Thomas Jul 10 at 10:50

2 Answers 2

I propose two possible solutions:

  1. Turn off transparency by including Opacity[1] in the CountourStyle

  2. Use CapForm["Butt"] to prevent the line caps from overlapping. With this solution you can keep transparency on, and the result will look like:

With CapForm["Butt"] theoretically there can still be a slight misalignment, or crack between the lines, but this is unlikely to be visible in practice.


Edit: Another possible solution is adding the option Method -> {"TransparentPolygonMesh" -> True}, as described here. I don't know what this does exactly.

share|improve this answer
    
Wow, this is a pretty neat solution. Is there a way to tell if they actually use "Butt" automatically in the Windows version? Or anything else.. –  level1807 Jul 10 at 15:44
    
@level1807 You could try all possible values in the Windows version and see if it makes a difference. If it does not make a difference, then the most likely explanation is that lines that are specified together, as a single Line primitive, are also rendered together by Windows, and transparency is added only after all lines have been rendered. I would compare Graphics@{Thickness[0.2], Opacity[0.5], Line[{{{-1, 0}, {1, 0}}, {{0, -1}, {0, 1}}}]} with Graphics@{Thickness[0.2], Opacity[0.5], Line[{{-1, 0}, {1, 0}}], Line[{{0, -1}, {0, 1}}]} on both Windows and Mac. –  Szabolcs Jul 10 at 15:54
    
@level1807 See my update. –  Szabolcs Jul 10 at 16:00

I don't know if this help or not but here is what I got for you.

ContourPlot[Sin[x y], {x, 0, 3}, {y, 0, 3}, ContourShading -> None, 
 ContourStyle -> {{Red, Thickness[0.008]}}, PlotTheme -> None]

enter image description here

share|improve this answer
    
Wow, I didn't think this is None =) Apparently Opacity[1] already gave the save effect, but thanks. This question has now transformed into a discussion of rendering bugs. –  level1807 Jul 11 at 16:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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