8000 legend title · plotly/plotly.r-docs@e6d0cb1 · GitHub
[go: up one dir, main page]

Skip to content

Commit e6d0cb1

Browse files
author
mahdis-z
committed
legend title
1 parent 51f28e4 commit e6d0cb1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

r/2015-07-30-legend.Rmd

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,30 @@ fig <- fig %>% add_trace(y = ~Tree4, name = 'Tree 4')
162162
fig <- fig %>% add_trace(y = ~Tree5, name = 'Tree 5')
163163
fig <- fig %>% layout(legend = l)
164164
165+
fig
166+
```
167+
### Legend Title
168+
169+
```{r}
170+
library(plotly)
171+
172+
fig <- plot_ly(
173+
type='scatter',
174+
mode='line',
175+
x=c(1, 2, 3, 4, 5),
176+
y=c(1, 2, 3, 4, 5),
177+
name="Increasing"
178+
)
179+
180+
fig <- fig %>% add_trace(
181+
type='scatter',
182+
mode='line',
183+
x=c(1, 2, 3, 4, 5),
184+
y=c(5, 4, 3, 2, 1),
185+
name="Decreasing"
186+
)
187+
188+
fig <- fig %>% layout(legend=list(title=list(text='<b> Trend </b>')))
165189
fig
166190
```
167191

0 commit comments

Comments
 (0)
0