Scatter Plot

2x Numeric

In [285]:

ggplot(mydf, aes(x='value1',y='value2')) + geom_point()

Out[285]:

<ggplot: (189811414455)>

2x Numeric + 1x Categorical

ggplot( DataFrame, aes(x='colName1',y='colName2')) 
    + geom_point( aes(
        color='categorical-alike-colName',
        size='numberColName'
    ))

In [286]:

ggplot(mydf, aes(x='value1',y='value2')) + geom_point(aes(color='grp'))

Out[286]:

<ggplot: (189811399870)>

In [287]:

ggplot(mydf, aes(x='value1',y='value2',color='grp')) + geom_point()

Out[287]:

<ggplot: (-9223371847043154972)>

In [288]:

ggplot(mydf, aes(x='value1',y='value2')) + \
    geom_point(aes(
        color='grp'
    ))

Out[288]:

<ggplot: (189812147576)>

2x Numeric + 1x Numeric + 1x Categorical

In [289]:

ggplot(mydf, aes(x='value1',y='value2')) + \
    geom_point(aes( 
        color='grp', size='value3'
    ))

Out[289]:

<ggplot: (189811508130)>

Overlay Smooth Line

In [290]:

ggplot(mydf, aes(x='value1', y='value2')) + \
    geom_point() + \
    geom_smooth()          # default method='loess'
C:\ProgramData\Anaconda3\lib\site-packages\plotnine\stats\smoothers.py:150: UserWarning: Confidence intervals are not yet implementedfor lowess smoothings.
  warnings.warn("Confidence intervals are not yet implemented"

Out[290]:

<ggplot: (189811517139)>

In [291]:

ggplot(mydf, aes(x='value1', y='value2',fill='grp')) + \
    geom_point() + \
    geom_smooth(
        se=True,
        color='red',
        method='lm', 
        level=0.75)

Out[291]:

<ggplot: (-9223371847042438221)>

results matching ""

    No results matching ""