3
$\begingroup$

The first command below produces proper contour lines while the second command produces an empty plot. I would think that the two commands should produce the same output. What's going on?

ContourPlot[{x^2 + y^2 == .04, x^2 + y^2 == .09}, {x, -.5, .5}, {y, -.5, .5}]

ContourPlot[Table[x^2 + y^2 == k, {k, {.04, .09}}], {x, -.5, .5}, {y, -.5, .5}]

$\endgroup$
2
  • $\begingroup$ try ContourPlot[ Evaluate@Table[ x^2 + y^2 == k, {k, {.04, .09}}], {x, -.5, .5}, {y, -.5, .5}]? $\endgroup$
    – kglr
    Commented Sep 17, 2019 at 17:19
  • $\begingroup$ @kglr, That works. Please make it an answer. $\endgroup$
    – Wynne
    Commented Sep 17, 2019 at 21:10

1 Answer 1

4
$\begingroup$

Wrap Table in the first argument with Evaluate:

ContourPlot[Evaluate @ Table[ x^2 + y^2 == k, {k, {.04, .09}}],
  {x, -.5, .5}, {y, -.5, .5}]

enter image description here

$\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.