So, I faced this problem, which is probably because of the bug.

Let's plot a simple 2D graph.

sample2dPlot = 
 ListPlot[RandomReal[{-1, 1}, 100], Background -> White, 
  Frame -> True, FrameLabel -> {"x", "y"}]

Let's try to use it as the Epilog to the MatrixPlot

MatrixPlot[RandomReal[{-1, 1}, {100, 100}], PlotLegends -> Automatic, 
 Epilog -> Inset[sample2dPlot]]

The frame disappeared, the frame labels disappeared.

Does anybody know how to solve this problem?

Thank you.

  • $\begingroup$ Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – user9660
    Nov 11 '16 at 7:43
  • $\begingroup$ Can confirm this as a bug, going back at least to version 8. $\endgroup$
    – Jason B.
    Nov 11 '16 at 15:03
  • 2
    $\begingroup$ This question is a duplicate of (103192). In particular, the patch given by Mr. Wizard in his answer can be applied here. $\endgroup$
    – user31159
    Nov 11 '16 at 15:13


Here's another workaround, based on the same underlying idea as the original:

MatrixPlot[RandomReal[{-1, 1}, {100, 100}], PlotLegends -> Automatic, 
  Epilog -> "foo"] /. "foo" -> Inset[sample2dPlot]

Mathematica graphics

Original answer:

I guess this is a workaround:

MatrixPlot[RandomReal[{-1, 1}, {100, 100}], PlotLegends -> Automatic, 
 Epilog -> Dynamic@Inset[sample2dPlot]]

(The underlying idea was to keep MatrixPlot from messing the options, assuming it does. In any case it works on the OP's example, if you have dynamic updating enabled. I find the dependence on Dynamic less satisfactory for this reason.)


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