How to simultaneously change the color and thickness in ContourStyle?
You could use BaseStyle
to set the Thick
lines:
ContourPlot[x y, {x, -1, 1}, {y, -1, 1}, ContourShading -> False,
ContourStyle -> ColorData[10] /@ Range[10],
BaseStyle -> Thick]
Alternatively you could Thread
Directive
over the colour list:
ContourStyle -> Thread @ Directive[Thick, ColorData[10] /@ Range[10]]
which will give the same result.
A working way to use Directive
:
ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi},
ContourShading -> False,
ContourStyle -> Array[Directive[Thick, ColorData[10]@#] &, 10]
]
Changing thickness along with color:
ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi},
ContourShading -> False,
ContourStyle -> Array[{AbsoluteThickness[#], ColorData[10]@#} &, 10]
]
The same result may be had using { }
or Directive[ ]
(for both variations).
Directive
should be needed only when providing multiple style rules that are to apply to all lines, like this:
ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi},
ContourShading -> False,
ContourStyle -> Directive[AbsoluteThickness[5], Blue]
]
Whereas with { }
you would get cyclic styling:
ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi},
ContourShading -> False,
ContourStyle -> {AbsoluteThickness[5], Blue}
]