plotnine.geoms.geom.
geom
(*args, **kwargs)[source]¶Base class of all Geoms
DEFAULT_AES
= {}¶Default aesthetics for the geom
REQUIRED_AES
= {}¶Required aesthetics for the geom
NON_MISSING_AES
= {}¶Required aesthetics for the geom
DEFAULT_PARAMS
= {}¶Required parameters for the geom
mapping
= None¶mappings i.e. aes(x='col1', fill='col2')
data
= None¶geom/layer specific dataframe
from_stat
(stat)[source]¶Return an instantiated geom object
geoms should not override this method.
Parameters: |
|
---|---|
Returns: |
|
Raises: |
|
aesthetics
()[source]¶Return all the aesthetics for this geom
geoms should not override this method.
setup_data
(data)[source]¶Modify the data before drawing takes place
This function is called before position adjustments are done. It is used by geoms to create the final aesthetics used for drawing. The base class method does nothing, geoms can override this method for two reasons:
stat
does not create all the aesthetics (usually
position aesthetics) required for drawing the geom
,
but those aesthetics can be computed from the available
data. For example geom_boxplot
and geom_violin
.geom
inherits from another geom
(superclass) which
does the drawing and the superclass requires certain aesthetics
to be present in the data. For example
geom_tile
and
geom_area
.Parameters: |
|
---|---|
Returns: |
|
use_defaults
(data)[source]¶Combine data with defaults and set aesthetics from parameters
geoms should not override this method.
Parameters: |
|
---|---|
Returns: |
|
draw_layer
(data, layout, coord, **params)[source]¶Draw layer across all panels
geoms should not override this method.
Parameters: |
---|
draw_panel
(data, panel_params, coord, ax, **params)[source]¶Plot all groups
For effeciency, geoms that do not need to partition different groups before plotting should override this method and avoid the groupby.
Parameters: |
|
---|
draw_group
(data, panel_params, coord, ax, **params)[source]¶Plot data belonging to a group.
Parameters: |
|
---|
draw_unit
(data, panel_params, coord, ax, **params)[source]¶Plot data belonging to a unit.
A matplotlib plot function may require that an aethestic
have a single unique value. e.g. linestyle='dashed' and
not linestyle=['dashed', 'dotted', ...].
A single call to such a function can only plot lines with
the same linestyle. However, if the plot we want has more
than one line with different linestyles, we need to group
the lines with the same linestyle and plot them as one
unit. In this case, draw_group calls this function to do
the plotting. For an example see
geom_point
.
Parameters: |
|
---|
handle_na
(data)[source]¶Remove rows with NaN values
geoms that infer extra information from missing values
should override this method. For example
geom_path
.
Parameters: |
|
---|---|
Returns: |
|
Notes
Shows a warning if the any rows are removed and the na_rm parameter is False. It only takes into account the columns of the required aesthetics.