2
$\begingroup$

I want to place multiple MatrixPlot results side by side. Here's the example code:

data1 = ( {
   {1, 2},
   {3, 4}
  } ); 
data2 = ( {
       {5, 6},
       {7, 8}
      } );
fig1 = MatrixPlot[data1, PlotLegends -> Placed[Automatic, {0, 0.5}]];
fig2 = MatrixPlot[data2, PlotLegends -> Placed[Automatic, {1, 0.5}]];
GraphicsRow[{fig1, fig2}]

I get the following result:

enter image description here

But what I want is the following:

enter image description here

What should I do to get the second figure, that I have currently generated using another tool?

$\endgroup$

1 Answer 1

7
$\begingroup$
data1 = ({{1, 2}, {3, 4}}); data2 = ({{5, 6}, {7, 8}});
fig1 = MatrixPlot[data1, PlotLegends -> Placed[Automatic, {0, 0.5}], 
   FrameTicks -> {{Automatic, None}, {Automatic, None}}
   , ImageSize -> 400
   ];
fig2 = MatrixPlot[data2, PlotLegends -> Placed[Automatic, {1, 0.5}]
   , FrameTicks -> {{None, Automatic}, {Automatic, None}}
   , ImageSize -> 400
   ];
GraphicsRow[{fig1, fig2}, Spacings -> {5, 0}]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Can there be no gap at all in the middle? Okay, It seems I can set Spacing to -10 to get no gap. $\endgroup$
    – narip
    Apr 1, 2023 at 7:15

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.