1
$\begingroup$

How could I place a text box on the top of a bar chart where the top line would have a larger font size than the second line?

My Data:

totals4={{1093, "AUSTRALIA"}, {235, "BELGIUM"}, {474, "BERMUDA"}, {187, "BRAZIL"}, {103, "BAHAMAS"}};

This code will plot the PlotLabel-> as a long string. I would like to move " - excludes USA, as of: June 2012" to the second line with a smaller font and not bold. Ideally this text would be within a box, however I would just be happy to get the second line to display correctly.

BarChart[#, ChartStyle -> "DarkRainbow", PlotLabel -> 
Style["Entities with LEI Number - excludes USA, as of: June 2012", 
Bold, FontSize -> 12],  
ChartLabels -> (Placed[
Rotate[Style[#, Black], Pi/3] & /@ #2, {{.7, 0}, {1, 1}}])] & @@
Transpose[totals4]

enter image description here

I have tried this code but it is not displaying correctly:

BarChart[#, ChartStyle -> "DarkRainbow",
             PlotLabel -> Style[TraditionalForm[Grid[{
    {TextCell[    
         Row[{"Entities with LEI Number (excludes USA)",
        HoldForm[Subscript[a, b]], " As of June 2012"}], 
      TextJustification -> 1], SpanFromLeft},
    }, Frame -> All]
  ], FontFamily ._ "Times"],  
ChartLabels -> (Placed[
  Rotate[Style[#, Black], Pi/3] & /@ #2, {{.7, 0}, {1, 1}}])] & @@
 Transpose[totals4]

Any help would be appreciated.

$\endgroup$
4
$\begingroup$

You could try this:

BarChart[#, 
ChartStyle -> "DarkRainbow", 
PlotLabel -> Framed[Text[
Grid[{
{Style["Entities with LEI Number", Blue, FontSize -> 18]}, 
{Style["excludes USA, as of: June 2012", Red, FontSize -> 12]}}]]],
ChartLabels -> (Placed[Rotate[Style[#, Black], Pi/3] & /@ #2, {{.7, 0}, {1, 1}}])] & @@
Transpose[totals4]

Result:

enter image description here

$\endgroup$
3
$\begingroup$
PlotLabel -> Framed[Column[{
    Style["Entities with LEI Number", Bold, FontSize -> 12], 
    Style["excludes USA, as of: June 2012", FontSize -> 10]}]],

gives

enter image description here

This uses the Column function to allow two as many Style commands as you might wish, and Framed makes the frame around the two elements of the columns. You can provide any kind of styling you wish in each of the elements of the column.

$\endgroup$
  • $\begingroup$ Thanks, Is there a way to change the font and un-bold the second line? $\endgroup$ – sente Jun 11 '13 at 12:28

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.