1
$\begingroup$
u[x_, y_] = x^.5 y^.5;
r[x_, y_] = .2 x + .4 y;
contour1 = 
  ContourPlot[{u[x, y]}, {x, 0, 1}, {y, 0, 1}, PlotRange -> {0, 1}, 
   Axes -> False, Contours -> 15, PlotPoints -> 50, 
   PlotRangePadding -> 0, 
   ContourShading -> {{Opacity[.3], 
      RGBColor[0.8, 0.9, 1]}, {Opacity[.8], 
      RGBColor[0.87, 0.94, 1]}}, ContourStyle -> Directive[Red], 
   AxesOrigin -> {0, 0}, Axes -> True];
contour2 = 
  ContourPlot[{r[x, y]}, {x, 0, 1}, {y, 0, 1}, PlotRange -> {0, 1}, 
   Axes -> False, Contours -> 15, PlotPoints -> 50, 
   PlotRangePadding -> 0, 
   ContourShading -> {{Opacity[.3], 
      RGBColor[0.8, 0.9, 1]}, {Opacity[.8], 
      RGBColor[0.87, 0.94, 1]}}, ContourStyle -> Directive[Red], 
   AxesOrigin -> {0, 0}, Axes -> True];

Gives

enter image description here

With Contour and ContourStyle one can decide of the number and style of contours. Now, I want to decide where they are set and change decide a specific style for each contour. Is there a way to do that ?

$\endgroup$
2
  • $\begingroup$ Sure, it's described in the docs for Contours and ContourStyle $\endgroup$ Commented Jan 12, 2017 at 8:15
  • $\begingroup$ Ok I miss the point but what is not said is how to associate a specific contour with a style. $\endgroup$ Commented Jan 12, 2017 at 8:48

1 Answer 1

2
$\begingroup$

Using OP's second example, one can specify the setting for Contours to override the styles set by ContourStyle:

ContourPlot[.2 x + .4 y, {x, 0, 1}, {y, 0, 1}, PlotRange -> {0, 1}, 
 Axes -> False, ContourStyle -> Red, 
 Contours -> {{.3, Thick}, {.4, Dashed}, {.2, 
    Directive[Orange, Thickness[.02]]}, ## & @@ Range[0., 2., .05]}, 
 PlotPoints -> 50, PlotRangePadding -> 0, 
 ContourShading -> {{Opacity[.3], 
    RGBColor[0.8, 0.9, 1]}, {Opacity[.8], RGBColor[0.87, 0.94, 1]}}, 
 AxesOrigin -> {0, 0}, Axes -> True]

Mathematica graphics

$\endgroup$

Your Answer

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

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