# Place cells side-by-side

Is there any way to place plots/cells side-by-side?

I know how to put plots in arrays and grids.

The motivation for putting cells side by side is that I want the equations for the plots to be above the graph, rather than have a single expression with multiple functions in it. In other words I want an effect like this: • You have been asking questions on this site for almost two years, but you still post questions lacking many of the details people would need to know in order to understand them. I think it's time for you to put more work into your questions. Unless you can give a cogent example demonstrating why you need to place cells side-by-side and how the result of doing so will achieve something than can't be done by Grid and its ilk, I can see no reason for pursuing this question. – m_goldberg Sep 24 '15 at 1:22
• Take a look at the slide show template, there is a slide with tow side-by-side cells. – Markus Roellig Sep 24 '15 at 8:03
• @m_goldberg I have to disagree. You are quite right that OP's needs may perhaps be satisfied by Grid &c., and a more detailed example of the intent would certainly be useful to help decide what might be an appropriate workaround. But whatever alternatives may exist have no particular bearing on the validity of asking whether it is possible to have side-by-side cells. I upvoted the question. – Oleksandr R. Sep 24 '15 at 8:47
• closely related: 30440 – Kuba Sep 25 '15 at 11:29
• @OleksandrR. I believe the basic issue m_goldberg describes here is not that the question is not potentially interesting but that the OP does not put effort in providing sufficient context. For instance the "place plots/cells side-by-side" is very confusing. Plots and cells are clearly two different beasts and the OP admits that he knows how to place plots side-by-side. So what's the use of asking this "plots/cells" thing? This is a rather lazy description and the OP shows a pattern of this behavior, at least in the view of m_g (and I tend to agree with him). – Sjoerd C. de Vries Dec 8 '15 at 21:22

I am not sure how cells can be placed in arbitrary arrangements except by placing embedded cells into e.g. Grid, as has already been suggested. But for the case of a simple side-by-side arrangement, one can use the undocumented CellFrameLabels option. It can work as follows:

NotebookWrite[EvaluationNotebook[],
Cell[BoxData@ToBoxes@Plot[Sin[x], {x, -π, π}, ImageSize -> Scaled],
CellFrameLabels -> {
{BoxData@ToBoxes@Plot[Tan[x], {x, -π, π}, ImageSize -> Scaled[1/3]],
BoxData@ToBoxes@Plot[ArcCot[x], {x, -π, π}, ImageSize -> Scaled[1/3]]},
{None, None}
}
]
]


It looks like this: A potentially relevant point is that the cells that are labels are not permitted to have their own CellFrameLabels. If these are specified, they are simply ignored. So, if you want more than three cells side-by-side, I don't know any better way than to use a Grid.

• Would this allow me to put [In] formulas side by side (as shown in question)? – Tyler Durden Dec 8 '15 at 22:53
• @TylerDurden probably not. You can do it (sort of) using the AuthorTools package function MakeBilateral. But this basically just produces a GridBox containing cells, which you can do yourself. It would be helpful if you can elaborate why you are opposed to making a grid. – Oleksandr R. Dec 8 '15 at 23:18
• Because you cannot put formulas (In cells) inside of Grids. Only the Output of a cell can be in a Grid. I want to show many examples of Mathematica formulas in a compact way and do not want to retypte text versions of the formulas in the grid boxes as labels. I want to have the actual formula for the plot IN the area itself. – Tyler Durden Dec 9 '15 at 14:08
• @TylerDurden I think you should brush up on your notebook programming. You would be surprised what can be in a GridBox. – Oleksandr R. Dec 9 '15 at 14:16

I think GraphicsGrid is the simplest option. As for equation above each, use PlotLabel in each.

p1 = Plot[Sin[x], {x, -Pi, Pi}, PlotLabel -> Sin[x]];
p2 = Plot[Tan[x], {x, -Pi, Pi}, PlotLabel -> Tan[x]];
Show[GraphicsGrid[{{p1, p2}}]] • "I know how to put plots in arrays and grids." - OP – Kuba Dec 12 '17 at 10:55
• I forgot to put the labels in each plot... Anyway, I just put that answer here because it took me some minutes to find how to put plots in a grid; so, if someone comes here looking for a way to do that (as I did), here is an answer. – Pedro H. N. Vieira Dec 12 '17 at 11:06

The simplest way is Row@{plot1,Spacer,plot2} The Spacer[x] allows the adjustable space between row elements according to the x-value.