Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13346 > unrolled thread

making a Module or Column that will print lines interspersed with plots

Started byBruce Shore <bwshore@me.com>
First post2013-02-03 07:51 +0000
Last post2013-02-04 01:20 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  making a Module or Column that will print lines interspersed with plots Bruce Shore <bwshore@me.com> - 2013-02-03 07:51 +0000
    Re: making a Module or Column that will print lines interspersed awnl <awnl@gmx-topmail.de> - 2013-02-04 01:20 +0000

#13346 — making a Module or Column that will print lines interspersed with plots

FromBruce Shore <bwshore@me.com>
Date2013-02-03 07:51 +0000
Subjectmaking a Module or Column that will print lines interspersed with plots
Message-ID<kel4u8$38r$1@smc.vnet.net>
I run Mathematica 7. I have some legacy notebooks,   from Mathematica 5, in which there were Modules such as

macro :=Module[{j},
Print["something"];
plota;
Print["something else"];
plotb
];

where plota and plotb were plots. Now with Mathematica 7 the semicolons prevent the plots from showing up. Show[plota]; has the same problem. The semicolons, which are needed in a Module, prevent the plotting.  I have tried using a Column or a Graphics column,

macro:=Column[{
Print["something"],
plota,
Print["something else"],
plotb
}]

and this does the printing and the plotting, but all the printing comes at the beginning and all the plots come after that. I really want the printing to come in between the plots, in the order that I show them. How can I do this?



---------------------------
Bruce Shore
bwshore@me.com
(925) 455 0627
--------------------------



[toc] | [next] | [standalone]


#13374 — Re: making a Module or Column that will print lines interspersed

Fromawnl <awnl@gmx-topmail.de>
Date2013-02-04 01:20 +0000
SubjectRe: making a Module or Column that will print lines interspersed
Message-ID<ken2d0$7g4$1@smc.vnet.net>
In reply to#13346
Am 03.02.2013 08:51, schrieb Bruce Shore:
> I run Mathematica 7. I have some legacy notebooks,   from Mathematica 5, in which there were Modules such as
>
> macro :=Module[{j},
> Print["something"];
> plota;
> Print["something else"];
> plotb
> ];
>
> where plota and plotb were plots. Now with Mathematica 7 the semicolons prevent the plots from showing up. Show[plota]; has the same problem. The semicolons, which are needed in a Module, prevent the plotting.  I have tried using a Column or a Graphics column,
>
> macro:=Column[{
> Print["something"],
> plota,
> Print["something else"],
> plotb
> }]
>
> and this does the printing and the plotting, but all the printing comes at the beginning and all the plots come after that. I really want the printing to come in between the plots, in the order that I show them. How can I do this?
>



I would suggest to use a Print for each of the  plots, e.g.:

macro :=Module[{j},
Print["something"];
Print[plota];
Print["something else"];
Print[plotb];
];

this will not only be much easier to change but also reflect the 
original code better: it makes the display of the plot a side effect as 
it always was before version 5.

For new code, it of course it's of course better to take advantage of 
the fact that graphics-expressions that are return values now are 
rendered nicely in the frontend...

hth,

albert

PS: you'll of course find similar questions and answers many times if 
you search the archive for messages from the time when version 6 came out...

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web