Parameter size_unit in geom_pie()

Use the size_unit parameter to relate the size of the "pie"\ to the length of the unit step along one of the axis.

In [1]:
import pandas as pd

from lets_plot import *
In [2]:
LetsPlot.setup_html()
In [3]:
mpg_df = pd.read_csv("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg.csv")
mpg_df.head(3)
Out[3]:
Unnamed: 0 manufacturer model displ year cyl trans drv cty hwy fl class
0 1 audi a4 1.8 1999 4 auto(l5) f 18 29 p compact
1 2 audi a4 1.8 1999 4 manual(m5) f 21 29 p compact
2 3 audi a4 2.0 2008 4 manual(m6) f 20 31 p compact
In [4]:
ggplot(mpg_df) + geom_pie(aes(fill='class', weight='displ'))
Out[4]:

1. Make Pie' Diameter Equal to the Unit Step along the X-axis

Parameters: size=1, size_unit="x".

In [5]:
ggplot(mpg_df) + \
    geom_pie(aes(fill='class', weight='displ'), size=1, size_unit="x") + \
    coord_fixed()
Out[5]:

2. Decrease the Pie' Diameter Slightly

Parameters: size=0.7, size_unit="x".

In [6]:
ggplot(mpg_df) + \
    geom_pie(aes(fill='class', weight='displ'), size=0.7, size_unit="x") + \
    coord_fixed() + \
    theme_void()
Out[6]: