3
$\begingroup$

Possible Duplicate:
Difference in Plot when using Evaluate vs when not using Evaluate
Why do I have to put Evaluate[] here
Why is ContourPlot not displaying this curve?

Why is nothing (empty plot, without error) plotted, when using the following code?

 tab = Table[x^2 + y^2 == R, {R, 0.2, 1, 0.2}];
 ContourPlot[tab, {x, -1, 1}, {y, -1, 1}]

Thank you for your help!

$\endgroup$
0

3 Answers 3

7
$\begingroup$

You need:

ContourPlot[Evaluate@tab, {x, -1, 1}, {y, -1, 1}]

enter image description here

$\endgroup$
3
$\begingroup$

You have to use Evaluate here. The reason for this is that ContourPlot has the attribute of "HoldAll".

Attributes@ContourPlot
{HoldAll, Protected}
$\endgroup$
1
$\begingroup$

You want to plot the contours of a list of equations. The list of function is

{x^2 + y^2 == 0.2, x^2 + y^2 == 0.4, x^2 + y^2 == 0.6, x^2 + y^2 == 0.8, x^2 + y^2 == 1.}

With one equation you can use simply

 ContourPlot[x^2 + y^2 == 0.2, {x, 0, 1}, {y, 0, 1}]

With two equations you can use a list as argument of CountourPlot

ContourPlot[{x^2 + y^2 == 0.2, x^2 + y^2 == 0.4}, {x, 0, 1}, {y, 0, 1}]

To use your table, try

ContourPlot[tab // Evaluate, {x, -1, 1}, {y, -1, 1}]

enter image description here

$\endgroup$

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