3
$\begingroup$

Consider this simple code

ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}, 
 ContourShading -> None, ContourStyle -> ColorData[1, "ColorList"], 
 PlotPoints -> 100]

which gives

Plot

I want to make the contour lines thicker, so I made some change in the code

ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}, 
 ContourShading -> None, ContourStyle -> Directive[Thick, ColorData[1, "ColorList"]], 
 PlotPoints -> 100]

The result is undesirable, all contour lines have the same color. How to fix this problem? I use WMA 11.0.1 on Win 10 64bit.

$\endgroup$
  • $\begingroup$ Why is it "undesirable"? What is wrong with it? What would you like instead? $\endgroup$ – MarcoB Feb 9 '17 at 15:38
  • 4
    $\begingroup$ Strange, try: BaseStyle -> AbsoluteThickness@2 $\endgroup$ – Kuba Feb 9 '17 at 15:38
3
$\begingroup$

ContourStyle takes either a single style specification that will be applied to all contours, or a list of style specifications which will be applied to contours one by one.

ColorData[1, "ColorList"] is a list.

Directive[...] is a single specification.

You need to use

ContourStyle -> (Directive[Thick, #] & /@ ColorData[1, "ColorList"])
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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