středa 4. prosince 2013

Plot axes labels, legends, fonts etc

Insert text into plot using Epilog command - here y comes to the vertical axis, \omega to horizontal axis and some legend to the right upper corner of the figure:

Epilog -> {
  Text["y", Scaled[{0.05, .95}], Background -> White,
                                 BaseStyle -> {FontSize -> 11, Bold}],
  Text["\[Omega]", Scaled[{0.95, .1}], 
                                 Background -> White, 
                                 BaseStyle -> {FontSize -> 11, Bold}],
  Text["b=" <> ToString[b] <> ",u=" <> ToString[u], 
                        Scaled[.98 {1, 1}], {1, 1}, Background -> White]
 }

Alternatively, use the Text's align feature, but this does not work well at the y axis:
Epilog -> {
  Text[" \[Xi] ", Scaled[{0.025, 1}], {-1, 1.2}, 
   Background -> White],
  Text[" \[Omega] ", Scaled[{1, 0}], 1.2 {1, -1}, Background -> White,
    BaseStyle -> {FontSize -> 14}],
  Text["\[Beta]=" <> 
    ToString[b], Scaled[.98 {1, 1}], {1, 1}, Background -> White]
  }

Setting up the default style for texts in Plots:

bst = {FontSize -> 12, 
            FontFamily -> "Helvetica", 
            FontWeight -> Bold, 
            FontSlant -> Italic};
SetOptions[Plot,BaseStyle->bst];
SetOptions[ListPlot,BaseStyle->bst];
SetOptions[Text, BaseStyle -> bst];

Align axes in several plots: It is necessary to manually allocate space for axes labels via , ImagePadding -> {{left, right}, {bottom, top}}
 
{
GraphicsColumn[{Plot[Sin[x], {x, 0, 2 \[Pi]}], 
                Plot[10^-3 Sin[x], {x, 0, 2 \[Pi]}]}],
ip = {{40, 0}, {5, 5}};
GraphicsColumn[{Plot[Sin[x], {x, 0, 2 \[Pi]}, ImagePadding -> ip], 
                Plot[10^-3 Sin[x], {x, 0, 2 \[Pi]}, ImagePadding -> ip]}]
}

Žádné komentáře:

Okomentovat