from lets_plot import *
LetsPlot.setup_html()
from lets_plot.plot.coord import coord_polar
hours = list(map(lambda v: '{:02d}:00'.format(v), range(12)))
p = ggplot() \
+ geom_point(aes(x=hours)) \
+ theme_grey()
In linear coordinate systems inset
acts as a margin, moving the panel boundaries within the plot:
gggrid([
p,
p + theme(panel_inset=15)
])
Default inset may cause tick labels overlapping in polar coordinate system.
The panel_inset
parameter acts as a margin and can be used to create space between the axis and the panel:
inset = [0, 35, 0, 35]
polar = coord_polar(xlim=[0, 12])
gggrid([
p + polar,
p + theme(panel_inset=inset) + polar,
])
transform_bkgr
¶When using the transform_bkgr
parameter, the panel is not transformed into a circle, but remains a rectangle. This behaviour is similar to ggplot2
.
In this case, panel_inset
acts as padding, pushing the content into the panel:
polar = coord_polar(xlim=[0, 12], transform_bkgr=False)
gggrid([
p + polar,
p + theme(panel_inset=inset) + polar
])
coord_fixed()
¶This is how panel_inset
works in coord_fixed()
.
inset = 40
p \
+ scale_x_continuous(position='both') \
+ scale_y_continuous(position='both') \
+ coord_fixed() \
+ ggtitle('coord_fixed() + inset=' + str(inset)) \
+ theme(panel_inset=inset)