The S4 class innsight_plotly
visualizes the results of the methods
provided from the package innsight
using plotly.
In addition, it allows easier analysis of the results and modification of
the visualization by basic generic functions. The individual slots are for
internal use only and should not be modified.
This S4 class is a simple extension of a plotly object that enables a more detailed analysis of the results and a way to visualize the results of models with multiple input layers (e.g., images and tabular data).
The overall plot is created in the following order:
The corresponding shapes and annotations of the slots annotations
and shapes
are added to each plot in plots
. This also adds the strips
at the top for the output node (or input layer) and, if necessary, on the
right side for the data point.
Subsequently, all individual plots are combined into one plot with the help of the function plotly::subplot.
Lastly, the global elements from the layout
slot are added and if there
are multiple input layers (multiplot = TRUE
), another output strip is
added for the columns.
An example structure of the plot with multiple input layers is shown below:
| Output 1: Node 1 | Output 1: Node 3 |
| Input 1 | Input 2 | Input 1 | Input 2 |
|---------------------------------------------------------|-------------
| | | | |
| plots[1,1] | plots[1,2] | plots[1,3] | plots[1,4] | data point 1
| | | | |
|---------------------------------------------------------|-------------
| | | | |
| plots[2,1] | plots[2,2] | plots[2,3] | plots[2,4] | data point 2
| | | | |
Additionally, some generic functions are implemented to visualize individual aspects of the overall plot or to examine them in more detail. All available generic functions are listed below:
plots
The individual plotly objects arranged as a matrix (see details for more information).
shapes
A list of two lists with the names shapes_strips
and
shapes_other
. The list shapes_strips
contains the shapes for the
strips and may not be manipulated. The other list shapes_other
contains
a matrix of the same size as plots
and each entry contains the shapes
of the corresponding plot.
annotations
A list of two lists with the names annotations_strips
and annotations_other
. The list annotations_strips
contains the
annotations for the strips and may not be manipulated. The other list
annotations_other
contains a matrix of the same size as plots
and
each entry contains the annotations of the corresponding plot.
multiplot
A logical value indicating whether there are multiple input layers and therefore correspondingly individual ggplot2 objects instead of one single object.
layout
This list contains all global layout options, e.g. update buttons, sliders, margins etc. (see plotly::layout for more details).
col_dims
A list to assign a label to the columns for the output strips.