The panel_inset Parameter in theme()

In [1]:
from lets_plot import *
LetsPlot.setup_html()
In [2]:
hours = list(map(lambda v: '{:02d}:00'.format(v), range(12)))

p = ggplot() \
    + geom_point(aes(x=hours)) \
    + theme_grey() \
    + theme(axis_line=element_line(color='black'))

Polar Coordinate System

In the polar coordinate system, it's common for tick labels to overlap.

The panel_inset parameter assists in creating additional space to accommodate tick labels more effectively.

In [3]:
gggrid([
    p + coord_polar(),
    p + theme(panel_inset=[0, 35]) + coord_polar(),
    p + theme(panel_inset=[0, 35]) + coord_polar(transform_bkgr=False),
])
Out[3]:

Rectangular Coordinate System

In rectangular coordinate systems, the panel_inset parameter functions as a margin, adjusting the panel boundaries within the plot:

In [4]:
gggrid([
    p,
    p + theme(panel_inset=15)
])
Out[4]: