ContEx v0.3.0 Contex.PointPlot View Source
A simple point plot, plotting points showing y values against x values.
It is possible to specify multiple y columns with the same x column. It is not yet possible to specify multiple independent series.
The x column can either be numeric or date time data. If numeric, a
Contex.ContinuousLinearScale is used to scale the values to the plot,
and if date time, a Contex.TimeScale is used.
Fill colours for each y column can be specified with colours/2.
A column in the dataset can optionally be used to control the colours. See
colours/2 and set_colour_col_name/2
Link to this section Summary
Functions
Specifies the label rotation value that will be applied to the bottom axis. Accepts integer
values for degrees of rotation or :auto. Note that manually set rotation values other than
45 or 90 will be treated as zero. The default value is :auto, which sets the rotation to
zero degrees if the number of items on the axis is greater than eight, 45 degrees otherwise.
Set the colour palette for fill colours.
Create a new point plot definition and apply defaults.
If a single y column is specified, it is possible to use another column to control the point colour.
Sets the default scales for the plot based on its column mapping.
Specify which column in the dataset is used for the x values.
Specify which column(s) in the dataset is/are used for the y values.
Link to this section Types
Link to this section Functions
Specifies the label rotation value that will be applied to the bottom axis. Accepts integer
values for degrees of rotation or :auto. Note that manually set rotation values other than
45 or 90 will be treated as zero. The default value is :auto, which sets the rotation to
zero degrees if the number of items on the axis is greater than eight, 45 degrees otherwise.
colours(plot, colour_palette)
View Sourcecolours(t(), Contex.CategoryColourScale.colour_palette()) :: t()
Set the colour palette for fill colours.
Where multiple y columns are defined for the plot, a different colour will be used for each column.
If a single y column is defined and a colour column is defined (see set_colour_col_name/2),
a different colour will be used for each unique value in the colour column.
If a single y column is defined and no colour column is defined, the first colour in the supplied colour palette will be used to plot the points.
new(dataset, options \\ [])
View Sourcenew(Contex.Dataset.t(), keyword()) :: t()
Create a new point plot definition and apply defaults.
If the data in the dataset is stored as a list of maps, the :series_mapping option is required. This value must be a map of the plot's :x_col and :y_cols to keys in the map, such as %{x_col: :column_a, y_cols: [:column_b, column_c]}. The :y_cols value must be a list. Optionally a :fill_col mapping can be provided, which is
equivalent to set_colour_col_name/2
set_colour_col_name(plot, fill_col_name)
View Sourceset_colour_col_name(t(), Contex.Dataset.column_name()) :: t()
If a single y column is specified, it is possible to use another column to control the point colour.
Note: This is ignored if there are multiple y columns.
Sets the default scales for the plot based on its column mapping.
set_x_col_name(plot, x_col_name)
View Sourceset_x_col_name(t(), Contex.Dataset.column_name()) :: t()
Specify which column in the dataset is used for the x values.
This column must contain numeric or date time data.
set_y_col_names(plot, y_col_names)
View Sourceset_y_col_names(t(), [Contex.Dataset.column_name()]) :: t()
Specify which column(s) in the dataset is/are used for the y values.
These columns must contain numeric data.
Where more than one y column is specified the colours are used to identify data from each column.