1
$\begingroup$

I have several plots and for each one I need to insert a title. I'm using Epilog and the problem is that the final text position will change accordingly to the string size:

BarChart[{1, 2, 3}, 
  Epilog -> {Text[Style["Teste 1", Bold, 14], Scaled[{.1, .9}]]}]

enter image description here

BarChart[{1, 2, 3}, 
  Epilog -> {Text[Style["Another test", Bold, 14], Scaled[{.1, .9}]]}]

enter image description here

I believe that this happens because Epilog uses the center of string to position it. How can I make it use the position of the first letter?

$\endgroup$
1
  • $\begingroup$ Ok, thanks @Kuba $\endgroup$
    – Miguel
    Commented Mar 7, 2017 at 16:43

1 Answer 1

4
$\begingroup$

I end up finding the answer. We just need to add the correct offset:

BarChart[{1, 2, 3},  
  Epilog -> {Text[Style["Teste 1", Bold, 14], Scaled[{.05, .9}], {-1, 0}]}]

BarChart[{1, 2, 3},  
  Epilog -> {Text[Style["Another test", Bold, 14], Scaled[{.05, .9}], {-1, 0}]}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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