4
$\begingroup$

I'm trying to create a set of plots that share similar axes (axes in the general sense, I'm actually using Frame). I'd like to have the text describing the axes plotted to the left of the first plot and centered below the row of plots (see code below). I have tried using the option

FrameStyle->Directive[Transparent, FontColor->Black]

but this doesn't work as I'd expect. Can anyone suggest a solution for this?

Thanks,

Mike

data = RandomReal[{0, 1}, {10, 10}];
Show[
 GraphicsRow[
  Table[
   MatrixPlot[data, AspectRatio -> Full,
    PlotLabel -> i,
    FrameTicks -> Automatic,
    ColorFunction -> (GrayLevel[1 - #] &),
    ColorFunctionScaling -> False
    ], {i, 3}]
  ],
 Frame -> {True, True, False, False},
 FrameStyle -> Automatic,
 FrameLabel -> {  "Position", "Amino Acid"},
 ImageSize -> 12*72]
$\endgroup$
6
$\begingroup$

Use Labeled, which can be used to label almost anything, instead of Show.

data = RandomReal[{0, 1}, {10, 10}];
Labeled[GraphicsRow[
       Table[MatrixPlot[data, AspectRatio -> Full, PlotLabel -> i,
         FrameTicks -> Automatic, ColorFunction -> (GrayLevel[1 - #] &),
         ColorFunctionScaling -> False], {i, 3}],ImageSize -> 12*72], 
   {Style["Position", Bold], Style["Amino Acid", Bold]}, {Bottom, Left},
    RotateLabel -> True]]

The resulting plot is identical to that produced by the code in the question, apart from the labeling, which now is as desired. Other Styles can be applied to the labels.

enter image description here

$\endgroup$
1
  • $\begingroup$ Perfect. Thanks. I haven't kept up with all of the changes in Mathematica so I was unaware of Labeled[]. $\endgroup$ – mikemtnbikes Jul 8 '15 at 13: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.