5
$\begingroup$

I want to control the plot range of CellularAutomaton to show both left and right sides when using rule 60.

Currently I have this:

But I want to have something like this:

Code:

 Manipulate[
 Graphics[ArrayPlot[CellularAutomaton[60, {{1}, 0}, t]], 
 PlotRange -> {{-100, 100}, {0, 100}}], {t, 0, 30, 1}]
$\endgroup$
4
$\begingroup$

CellularAutomaton / Region Specifications / #3

Manipulate[
 Graphics[ArrayPlot[CellularAutomaton[60, {{1}, 0}, {t, All}]], 
  PlotRange -> {{-100, 100}, {0, 100}}], {t, 0, 30, 1}]

enter image description here

$\endgroup$
4
$\begingroup$

I'd do:

Manipulate[
    ArrayPlot[PadLeft[#, 2 (t + 1)] & /@ CellularAutomaton[60, {{1}, 0}, t], Mesh -> True],
  {t, 0, 30, 1}]

enter image description here

(because I didn't look into the docs like Kuba).

$\endgroup$
  • $\begingroup$ Wow, great solution. BTW, do you have an idea how to eliminate the wobbling in the middle? $\endgroup$ – xtt Jan 13 '17 at 11:29
  • $\begingroup$ That's just a .gif I made to show it here; the Manipulate looks ok. $\endgroup$ – corey979 Jan 13 '17 at 11:47

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.