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$
  • $\begingroup$ Sure, it's described in the docs for Contours and ContourStyle $\endgroup$ – Simon Rochester Jan 12 '17 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$ – cyrille.piatecki Jan 12 '17 at 8:48
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, privacy policy and cookie policy

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