plotly_modify_hover: [!] Modify hover in a 'plotly' object

Description Usage Arguments Value Author(s) See Also Examples

View source: R/plotly_modify_hover.R

Description

Function corrects text in a hover of a plotly object.

Usage

1
2
3
4
5
6
7
plotly_modify_hover(
  obj,
  new_text = list(),
  hovermode = NULL,
  hoverinfo = NULL,
  hoverformat = NULL
)

Arguments

obj

a plotly object (created with function plot_ly, ggplotly, subplot or similar).

new_text

Either NULL, if the text should not be updated, or named list (or object convertible to named list) with with replaced and replacement text in such form:
list("OLD_text" = "REPLACEMENT_text", "OLD_text2" = "REPLACEMENT_text2",).
If not NULL, and not explicitly modified the default values are:
new_text <- list( ".wavelength" = "Wavelength", "spc" = "Y axis value", ".rownames" = "Row", ".aggregate" = "Group").

hovermode

(enumerated: "closest" | FALSE)
Source:https://plot.ly/r/reference/#layout-scene-hovermode.
If NULL (default) value of this option will not be changed.

hoverinfo

[NOT IMPLEMENTED YET. Option has no effect.] (flaglist string) Any combination of "x", "y", "z", "text", "name" joined with a "+" OR "all" or "none".
Examples: "x", "y", "x+y", "x+y+z", "all". Determines which trace information appear on hover.
Source: https://plot.ly/r/reference/#box-hoverinfo.
If NULL (default) value of this option will not be changed.

hoverformat

(string) [NOT IMPLEMENTED YET. Option has no effect.] Sets the hover text formatting rule for data values on this axis, using the python/d3 number formatting language. See https://github.com/mbostock/d3/wiki/Formatting#numbers or https://docs.python.org/release/3.1.3/library/string.html#formatspec for more info.
Source: https://plot.ly/r/reference/#layout-yaxis-hoverformat.
If NULL (default) value of this option will not be changed.

Value

An updated plotly object (class plotly).

Author(s)

Vilmantas Gegzna

See Also

Online reference https://plot.ly/r/reference/#scatterternary-hoverinfo;
Functions layout(), plot_ly(),

Other spPlot functions for plotly: label_expr2text(), plotly_annotation_rm(), plotly_modify_legend(), plotly_tidy()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(spPlot)
library(spHelper)
library(hyperSpec)
library(plotly)

# Create `plotly` object:
obj <- qplot_spStat(chondro,"clusters",mean)  %>%
       label_expr2text() %>%
       ggplotly()


# Then compare hover in this plot:
plotly_modify_hover(obj)

# With the hover in the original plot:
print(obj)

GegznaV/spPlot documentation built on April 29, 2020, 11:06 p.m.