2
$\begingroup$

I have a pie chart and I would like to make the font size of the legend bigger.

I was able to make the fonts bigger for the chart labels but BaseStyle->{FontSize -> 15} did not work for the legend.

How could I do it?

My pie chart's code:

PieChart[{number1, number2, number3, number4}, 
  PlotLabel -> "Fraudster Login Frequency", 
  ChartLegends -> {"only once", "2-9 times", "10-199 times", ">200 times"}, 
  ChartLabels -> {"6%", "17%", "63%", "14%"}, ChartStyle -> "Pastel", 
  BaseStyle -> {FontSize -> 15}]
$\endgroup$
3
$\begingroup$
number1 = .06;
number2 = .17;
number3 = .63;
number4 = .14;
PieChart[{number1, number2, number3, number4}, 
 PlotLabel -> "Fraudster Login Frequency", 
 ChartLegends -> {Text[Style["only once", 15]], 
   Text[Style["2--9 times", 15]], Text[Style["10--199 times", 15]], 
   Text[Style["> 200 times", 15]]}, 
 ChartLabels -> {"6%", "17%", "63%", "14%"}, ChartStyle -> "Pastel"]

and if you want to make multiple such pie charts, this will allow you to change merely the numbers:

numbers = {.06, .17, .63, .14};
PieChart[numbers,
 PlotLabel -> "Fraudster Login Frequency", 
 ChartLegends -> (Style[#, 15] & /@ {"only once", "2-9 times", 
     "10-199 times", ">200 times"}),
 ChartLabels -> (StringJoin[ToString[#], "%"] & /@ 
    IntegerPart[100 numbers]),
 ChartStyle -> "Pastel"]
$\endgroup$
  • 1
    $\begingroup$ Or more simply, ChartLegends -> (Style[#, 15] & /@ {"only once", "2-9 times", "10-199 times", ">200 times"}) $\endgroup$ – Bob Hanlon Jul 18 '15 at 16:48
  • $\begingroup$ Perfect! thanks!! $\endgroup$ – Cancan Jul 18 '15 at 16:51

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.