The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Topic: Do Plot
Replies: 3   Last Post: Dec 17, 2012 2:54 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Andrzej Kozlowski

Posts: 226
Registered: 1/29/05
Re: Do Plot
Posted: Dec 17, 2012 2:54 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

It will work in versions before 6 but not later. Do only "does" but
produces no output. In versions of Mathematica before 6, the actual
picture produced by Plot was a "side-effect", but since version 6 the
picture is actually output and since Do returns no output you get no

There are two solutions.

1. The bad solution. Make it work just as before version 6. Print works
by "side-effect" so just insert print into your code like this:

Do[Print[Plot[x^2 + c, {x, -2, 2}]], {c, -1, 1, 0.2}]

The reason why this is bad is because since your pictures are not output
you can't do anything with them.

2. The second approach is to forget Do and use something that produces
output, like Table. Thus

graphs = Table[Plot[x^2 + c, {x, -2, 2}], {c, -1, 1, 0.2}];

will make a list containing your pictures as Mathematica objects. You
can now use them in all sorts of ways,e.g


GraphicsGrid[{graphs[[1 ;; 5]]}]

GraphicsGrid[Transpose[{graphs[[1 ;; 5]]}]]

and so on.

Andrzej Kozlowski

On 16 Dec 2012, at 11:05, wrote:

> Should this command work in Mathematica 9?
> Do[Plot[x^2 + c, {x, -2, 2}], {c, -1, 1, 0.2}]
> Not working on my Macbook Pro, Snow Leopard 10.6.8.
> David.

Date Subject Author
Read Re: Do Plot
Murray Eisenberg
Read Re: Do Plot
Bob Hanlon
Read Re: Do Plot
Andrzej Kozlowski

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.