In [1]:
from lets_plot import *
import pandas as pd
LetsPlot.setup_html()
In [2]:
df = {
   'x' : [1, 1, 2, 2, 1.5],
   'y' : [1, 2, 1, 2, 1.5],
   'text': ["bottom-left", "top-left", "bottom-right", "top-right", "center"]
}

w, h = 400, 250

p = ggplot(df, aes('x', 'y')) + geom_point(size=3) + ggsize(w,h) + theme_classic() 
In [3]:
p + geom_text(aes(label = 'text'), size=8, hjust = 'inward', angle=0)
Out[3]:
In [4]:
angles = [0,45,90,135,180,225,270,315]

def justificationWithAngles(hjust=None, vjust=None):
    bunch = GGBunch()
    for i in range(len(angles)):
        angle = angles[i]
    
        row = int(i / 2)
        column = i % 2
    
        pp = p + geom_text(aes(label = 'text'), size=8, hjust = hjust, vjust = vjust, angle=angle) +\
             ggtitle("Angle: " + str(angle))
    
        bunch.add_plot(pp, column * w, row  * h, w, h)
                                                                                              
    return bunch.show()  
    
In [5]:
justificationWithAngles(hjust='inward')
In [6]:
justificationWithAngles(hjust='outward')
In [7]:
justificationWithAngles(vjust='inward')
In [8]:
justificationWithAngles(vjust='outward')