3
$\begingroup$

I have a for loop that makes plots iteratively, in between the plots, I would like to draw a line in the notebook. Is there a command that is the equivalent of doing this:

https://reference.wolfram.com/language/workflow/InsertAHorizontalLineInANotebook.html

$\endgroup$
2
  • $\begingroup$ Any other method to divide my notebook up would be appreciated as well $\endgroup$
    – reemodels
    Sep 20, 2019 at 13:12
  • $\begingroup$ Why not use GraphicsColumn and Table instead of For (and Print, I guess?)? $\endgroup$
    – xzczd
    Sep 20, 2019 at 13:31

2 Answers 2

5
$\begingroup$

There's many ways to achieve something like this, but a start for programmatically creating a line to go across your notebook would be something like this:

CellPrint[
 Cell["", "Text", Editable -> False, Selectable -> False, 
  CellFrame -> {{0, 0}, {0, 0.5}}, ShowCellBracket -> False, 
  CellMargins -> {{0, 0}, {1, 1}}, 
  CellElementSpacings -> {"CellMinHeight" -> 1}, 
  CellFrameMargins -> 0, CellFrameColor -> RGBColor[0, 0, 1], 
  CellSize -> {Inherited, 3}]]

enter image description here

Of course the options can be edited, if you want it thicker, a different color, etc...

Hope this helps!

$\endgroup$
0
5
$\begingroup$

An alternative approach is to print the cells with graphics contents with a line at the bottom:

ClearAll[thickLineBelow]
thickLineBelow = CellPrint[ExpressionCell[#, "Output", CellFrame -> {{0, 0}, {3, 0}}, 
     CellFrameColor -> RGBColor[0, 0, 1]]] &;

You can wrap each graphics object you produce in the loop with thickLineBelow:

thickLineBelow /@ {Plot[Sin[x], {x, 0, 2 Pi}, AspectRatio -> 1/4], 
   Row[Framed /@ {Graphics[{Red, Disk[]}, ImageSize -> 100], 
      Plot[x Sin[x], {x, 0, 5 Pi}, ImageSize -> 200]}, Spacer[10]], 
   MatrixPlot[RandomReal[1, {5, 30}], ImageSize -> 300]};

enter image description here

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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