label_expr2text: [!] Convert 'plotmath' expresions in labels to text

Description Usage Arguments Value Author(s) See Also Examples

View source: R/label_expr2text.R

Description

[!] Convert 'plotmath' expresions in labels to text

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
label_expr2text(obj, FUN = expr2latex_, ...)

## S3 method for class 'ggplot'
label_expr2text(obj, FUN = expr2latex_, ...)

## S3 method for class 'hyperSpec'
label_expr2text(obj, FUN = expr2latex_, ...)

## S3 method for class 'plotly_hash'
label_expr2text(obj, FUN = expr2latex_, ...)

## S3 method for class 'plotly'
label_expr2text(obj, FUN = expr2latex_, ...)

Arguments

obj

Object of approptiate class.

FUN

Function that translates expressions in labels to text or other kind of expressions to be applied, e.g., simsalapar::expr2latex, simsalapar::escapeLatex, expr2latex_.

...

For generic use.

Value

Updated object with expresions in its labels converted to strings.

Author(s)

Vilmantas Gegzna

See Also

expr2latex_

Other spPlot utilities: expr2latex_()

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

Other spPlot functions for spectroscopy and hyperSpec: facet_wl(), ggLims(), gg_palette(), ggplot.hyperSpec()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
library(spPlot)
library(hyperSpec)
library(plotly)

# ===== for hyperSpec object ===============================================

labels(chondro)
labels(label_expr2text(chondro))

## Not run: \donttest{
# without `label_expr2text` labels with expressions are distorted or not plotted at all:

chondro[1:10,,] %>% qplotspc %>% ggplotly
}
## End(Not run)
# If function `label_expr2text` is applied:
chondro[1:10,,] %>% label_expr2text  %>% qplotspc %>% ggplotly


# ===== for ggplot2 object =================================================

chondro[1:10,,] %>% qplotspc %>% label_expr2text %>% ggplotly


# ===== for plotly object ==================================================

chondro[1:10,,]  %>% qplotspc %>%  ggplotly %>% label_expr2text
## Not run: \donttest{
## Does not work with newer version of `plotly`:
chondro[1:10,,]  %>% qplotspc %>%  ggplotly %>% plotly_build %>% label_expr2text
}
## End(Not run)
# ==========================================================================

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