3
$\begingroup$

I'm trying to use GraphicsGrids to combine some plots (generated with ListPlot). The problem I'm having, is that the plots are not shown completely. In particular, the somewhat wide AxesLabel (for the vertical axis) is cropped. This happens even when these plots appear in the 2$^\textrm{nd}$ column, with a large Spacings. So I'm wondering how to avoid this problem.

Here's a simple example of the problem:

plot1 = ListPlot[Table[j, {j, 1, 30}], AxesLabel -> {j, 
log \[LeftAngleBracket]Subsuperscript[\[Psi], j, l] | 
   Subsuperscript[\[Psi], j, l]\[RightAngleBracket]}];
plot2 = ListPlot[Table[-j, {j, 1, 30}], AxesLabel -> {j, 
log \[LeftAngleBracket]Subsuperscript[\[Psi], j, l] | 
   Subsuperscript[\[Psi], j, l]\[RightAngleBracket]}];
GraphicsGrid[{{plot1, plot2}}]

Here's the output I get:

enter image description here

Apologies if this is a duplicate, I did do a search, but didn't find the answer.

$\endgroup$
21
  • 2
    $\begingroup$ Welcome to the Mathematica Stack Exchange. Please include a minimal working example that replicates your problem. You can copy code directly from your input cell and format it using the { } icon in the Edit window. $\endgroup$
    – Syed
    Commented Mar 24, 2022 at 20:46
  • 1
    $\begingroup$ I am on v12.2.0 Win7-x64 and the l of log is cropped on both plots. A possible solution is GraphicsGrid[{{plot1, plot2}}, Spacings -> 2] $\endgroup$
    – Syed
    Commented Mar 24, 2022 at 21:20
  • 2
    $\begingroup$ An image would make it easier for others to understand the issue, so yes. [As an aside, I'll suggest using Row[{log , "\[ThickSpace]", \[LeftAngleBracket]Subsuperscript[\[Psi], j, l] | Subsuperscript[\[Psi], j, l]\[RightAngleBracket]}] for the label. It probably won't fix the cropping, but your label has the form Times[log,...] and you're relying on Times to sort the factors in the order you want. It happens here, but it might not happen with a different label.] $\endgroup$
    – Michael E2
    Commented Mar 24, 2022 at 21:23
  • 1
    $\begingroup$ Save your work first and try something and please let me know if it crashes Mma front end. In the original code try: GraphicsGrid[{{Pane@plot1, Pane@plot2}}]. Resize the plot a couple of times. $\endgroup$
    – Syed
    Commented Mar 24, 2022 at 21:26
  • 1
    $\begingroup$ @Syed GraphicsGrid[{{Pane@plot1, Pane@plot2}}] does the trick for me. I don't know how to highlight code in comments, sorry. $\endgroup$ Commented Mar 24, 2022 at 21:35

2 Answers 2

3
$\begingroup$

There are some excellent suggestions in the comments. I am presenting mine and hoping for at least two more answers :-) .

$Version

12


We have

plot1 = ListPlot[Table[j, {j, 1, 30}], 
   AxesLabel -> {j, 
     "log" \[LeftAngleBracket]Subsuperscript[ψ, j, l] | 
        Subsuperscript[ψ, j, l]\[RightAngleBracket]}, 
   RotateLabel -> True];
plot2 = ListPlot[Table[-j, {j, 1, 30}], 
   AxesLabel -> {j, 
     "log" \[LeftAngleBracket]Subsuperscript[ψ, j, l] | 
        Subsuperscript[ψ, j, l]\[RightAngleBracket]}];
GraphicsGrid[{{plot1, plot2}}, ImageSize -> 1000]

imagesize


We proceed as follows:

p1 = Labeled[
   ListPlot[Table[j, {j, 1, 30}], 
    ImageSize -> 
     Full], {"log" \[LeftAngleBracket]Subsuperscript[ψ, j, l] | 
       Subsuperscript[ψ, j, l]\[RightAngleBracket], "j"}, {Left, 
    Bottom}, RotateLabel -> True];
p2 = Labeled[
   ListPlot[Table[-j, {j, 1, 30}], 
    ImageSize -> 
     Full], {"log" \[LeftAngleBracket]Subsuperscript[ψ, j, l] | 
       Subsuperscript[ψ, j, l]\[RightAngleBracket], "j"}, {Left, 
    Bottom}, RotateLabel -> True];
GraphicsGrid[{{p1, p2}}, ImageSize -> Full]

labeled

$\endgroup$
0
$\begingroup$

The problem can be solved by specifying ImageSize in both plots:

pa =
  ListPlot[Table[j, {j, 1, 30}],
   ImageSize -> 300,
   AxesLabel -> al];

pb =
  ListPlot[Table[-j, {j, 1, 30}],
   ImageSize -> 300,
   AxesLabel -> al];

GraphicsGrid[{{pa, pb}},
 Frame -> All,
 FrameStyle -> LightGray]

enter image description here

$\endgroup$

Your Answer

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

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