eafpy.plot module#

eafpy.plot.add_extremes(x, y, maximise)[source]#
eafpy.plot.apply_legend_preset(fig, preset='centre_top_right')[source]#

Apply a preset to the legend, changing it’s position, text or colour

For more advanced legend behaviour

Parameters:
  • fig (plotly GO figure) – Figure to apply preset to

  • preset (string or list) –

    If preset is a string, this will change the position of the legend. It must be one of the following: “outside_top_right”, “outside_top_left”, “top_right”, “bottom_right”, “top_left”, “bottom_left”,”centre_top_right”, “centre_top_left”,”centre_bottom_right”, “centre_bottom_left”.

    Set it to a list [preset_position_name, title_text, background_colour, border_colour] to change position, title text, background colour and border colour

eafpy.plot.create_2d_eaf_plot(dataset, colorway, fill_border_colours, figure=None, type='fill', names=None, line_dashes=None, line_width=None)[source]#
eafpy.plot.diff_eaf_plot(x, y, n_intervals)[source]#
eafpy.plot.plot_datasets(datasets, type='points', filter_dominated=True, **layout_kwargs)[source]#

The plot_datasets(dataset, type=”points”) function plots Pareto front datasets It can produce an interactive point graph, stair step graph or 3d surface graph. It accept 2 or 3 objectives

Parameters:
  • dataset (numpy array) – The dataset argument must be Numpy array produced by the read_datasets() function - an array with 3-4 columns including the objective data and set numbers.

  • type (str default : :class:`”points”:class:`) –

    The type argument can be “points”, “lines”, “points,lines” for two objective datasets, Or “points”, “surface” or “cube” for three objective datasets

    ”points” produces a scatter-like point graph (2 or 3 objective)

    ”lines” produces a stepped line graph (2 objective only)

    ”points,lines” produces a stepped line graph with points (2 objective only)

    ”fill” produces a stepped line graph with filled areas between lines - see plot_eaf() (2 objective only)

    ”surface” produces a smoothed 3d surface (3 objective only)

    ”surface, points” produces a smoothed 3d surface with datapoints plotted (3 objective only)

    ”cube” produces a discrete cube surface (3 objective only)

    The function parses the type argument, so accepts abbrieviations such as p or “p,l”

  • filter_dominated (boolean) – Boolean value for whether to automatically filter dominated points each set. default is True

  • layout_kwargs (keyword arguments) – Update features of the graph such as title axis titles, colours etc. These additional parameters are passed to plotly update_layout, See here for all the layout features that can be accessed: Layout Plotly reference

Returns:

The function returns a Plotly GO figure object: Plotly Figure reference

This means that the user can customise any part of the graph after it is created

Return type:

Plotly GO figure

eafpy.plot.plot_eaf(dataset, type='fill', percentiles=[], colorway=[], fill_border_colours=[], trace_names=[], line_dashes='solid', line_width=[], legend_preset='centre_top_right', template='simple_white', **layout_kwargs)[source]#

eaf_plot() conviently plots attainment surfaces in 2d

Parameters:
  • dataset (numpy.ndarray) – The dataset argument must be Numpy array of EAF values (2 objectives and percentile marker), or it can be a dictionary of such values. The dictionary must have this format: {‘alg_name_1’ : dataset1, ‘alg_name_2’ : dataset2}.

  • percentiles (list or 2d list) – A list of percentiles to plot. These must exist in the dataset argument. If multiple datasets are provided, this can also be a list of lists - selecting percentile groups for each algorithm (dictionary interface)

  • type (string or list of strings) – The type argument can be “fill”, “points”, “lines” to define the plot type (See plot_datasets() for more details). If multiple datasets are used (dictionary interface) then this can be a list of types (equal to the number of different datasets provided).

  • colorway (list) – Colorway is a single colour, or list of colours, for the percentile groups. The colours can be CSS colours such as ‘black’, 8-digit hexedecimal RGBA integers or strings of RGBA values such as rgba(1,1,0,0.5). Default is “black”. You can use the colour.discrete_colour_gradient() to create a gradient between two colours In case of multiple datasets (“dictionary interface”), you can use a single list to set the value for each set of lines, or a 2d list to set a value for each line within a surface

  • fill_border_colours (list or 2d list) – The same as colorway but defining the boundaries between percentile groups. The default value is to follow colorway. You can set it to rgb(0,0,0,0) to make the boundaries invisible

  • names (trace) – Overide the default trace names by providing a list of strings

  • line_dashes (string or list of strings) – Select whether lines are dashed. Choices are: ‘solid’, ‘dot’, ‘dash’, ‘longdash’, ‘dashdot’, ‘longdashdot’. A single string sets the type for all lines. A list sets them indidually. In case of multiple datasets (“dictionary interface”), you can use a single list to set the value for each set of lines, or a 2d list to set a value for each line within a surface

  • line_width (integer, list of integer, 2d list of integers) – Select the line width (default = 2) of the traces. Similar interface to line_dashes, colorway etc -> Enter a single value to set all traces. For single datset, a list sets size for all setz For a dictionary of datsets: a list sets the same value for all traces assosciated with that dataset. A list of list individually sets width for every trace in every dataset

  • legend_preset (string or list) – See “preset” argument for apply_legend_preset()

  • template (String or Plotly template) –

    Choose layout template for the plot - see Plotly template tutorial

    Default is “simple_white”

  • layout_kwargs (keyword arguments) –

    Update features of the graph such as title axis titles, colours etc. These additional parameters are passed to plotly update_layout, See here for all the layout features that can be accessed: Layout Plotly reference

Returns:

The function returns a Plotly GO figure object Figure Plotly reference

This means that the user can customise any part of the graph after it is created

Return type:

Plotly GO figure