The S7 object oriented programming system requires class definitions. Here, we provide definitions of classes that are home to ggplot2.
S7 classes
A general advice the S7 package gives is to name class definition objects
the same as the class name, which then becomes the constructor for the class.
The classes listed below deviate from that advice for historical reasons,
because some constructors like ggplot() are also S3 generics with methods.
The have the class_-prefix to indicate their role.
class_ggplotis an S7 class used for objects generated byggplot().class_ggplot_builtis an S7 class used for objects generated byggplot_build().class_mappingis an S7 class used for objects generated byaes().class_themeis an S7 class used for objects generated bytheme().class_labelsis an S7 class used for objects generated bylabs().
class_ggis an abstract S7 class to used invoke similar behaviour among ggplot objects.
Theme elements
The theme elements follow the advice of the S7 package that the class names are also the class definitions and constructors.
elementis an abstract S7 class used to invoke similar behaviour among theme element objects.element_blankis an S7 class for not drawing theme elements.element_rectis an S7 class for drawing rectangles.element_lineis an S7 class for drawing lines.element_textis an S7 class for rendering text.element_polygonis an S7 class for drawing polygons.element_pointis an S7 class for drawing points.element_geomis an S7 class holding geom defaults.marginis an S7 class for declaring margins.
ggproto classes
The ggproto classes are S3 classes of the type environment that form the backbone of most systems in ggplot2 and are in particular crucial to the extension system.
class_ggprotois an S3 class used for the objects generated byggproto()which are of the type environment.
class_scaleis a subclass ofclass_ggprotoand is more described in the Scale documentation.
class_guidesis a subclass ofclass_ggprotoand is considered an internal class.
class_guideis a subclass ofclass_ggprotoand is more described in the Guide documentation.
class_coordis a subclass ofclass_ggprotoand is more described in the Coord documentation.
class_facetis a subclass ofclass_ggprotoand is more described in the Facet documentation.
class_layeris a subclass ofclass_ggprotoand is used for the objects generated bylayer(). The class itself is considered internal and is described in more detail in the Layer documentation.
class_layoutis a subclass ofclass_ggprotoand is considered an internal class. It is described in more detail in the Layout documentation.
class_scales_listis a subclass ofclass_ggprotoand is considered an internal class.
S3 classes
Some simple classes remain S3, primarily because they aren't meant to be recycled into new classes.
class_S3_ggis a temporary S3 class until R 4.3.0 is the minimum supported version. It is exported and listed here for completeness, but its use is heavily discouraged. It is superseded byclass_gg.
class_relis an S3 class used in element properties.
class_zero_grobis an S3 class used to indicate empty drawings.
class_waiveris an S3 sentinel value class used in various places.
class_deriveis an S3 sentinel value class used primarily insec_axis().
