2
$\begingroup$

The default font-size of Legend text generated using ShowLegend[] is too small. How does one increase this? The code I am working with is:

Needs["PlotLegends`"]
LstTest = Flatten[Table[{i, j, (i + j)/200}, {i, 1, 100}, {j, 1, 100}], 1];
plTest = ListContourPlot[LstTest, Contours -> 9, ColorFunction -> "Rainbow"];
LMax = Max[LstTest[[All, 3]]]; LMin = Min[LstTest[[All, 3]]];

ShowLegend[plTest, 
           {ColorData["Rainbow"][1 - #1] &, 
            10, 
            ToString[Round[LMax, 0.01]], 
            ToString[Round[LMin, 0.01]], 
            LegendPosition -> {0.6, 0}
           }
          ]

The 0.01 and 1.0 appear too small, and I would like to increase the font-size of these. Thanks for any help!

$\endgroup$
  • $\begingroup$ @Nasser try Needs["PlotLegends"], that should at least give you the legend. $\endgroup$ – Jonie Aug 2 '13 at 6:36
  • $\begingroup$ @Nasser I totally agree with that. I just hope the OP will keep that in mind for next time. $\endgroup$ – Jonie Aug 2 '13 at 6:44
  • $\begingroup$ Sorry! I thought the data can be generated quite easily. I have made it complete now. Also, I am using Mathematica 8.0. $\endgroup$ – Shrihari Aug 2 '13 at 7:03
6
$\begingroup$
Needs["PlotLegends`"];

Manipulate[

 ShowLegend[
  plTest,
  {ColorData["Rainbow"][1 - #1] &,
   10,
   ToString[Round[LMax, 0.01]],
   ToString[Round[LMin, 0.01]],
   LegendPosition -> {0.6, 0},
   BaseStyle -> {FontSize -> n}
   }
  ],

 {{n, 12, "how big?"}, 4, 16, 1,Appearance -> "Labeled"},
 ContinuousAction -> False,
 Initialization :>
  (
   LstTest = Table[RandomReal[{0, 1}], {10}, {10}, {10}];
   plTest = ListContourPlot[LstTest, Contours -> 9,ColorFunction -> "Rainbow"];
   LMax = 1.0; LMin = 0.79;
   )
 ]

Mathematica graphics

$\endgroup$
  • 1
    $\begingroup$ Great! Thanks @Nasser. That works! From next time, I will post complete code. Sorry about this. $\endgroup$ – Shrihari Aug 2 '13 at 7:17

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.