line break and subscript in axis title using plotly in R
<p>I just started to use <code>plotly</code> for some interactive scatter plots in R and having a hard time on axis labels. Normally I designed my plots with <code>ggplot2</code> and then using the <code>ggplotly</code> function to convert them, but this is sometimes very slow for any reason. So I want to create my plots directly in <code>plotly</code>...</p>

<p>I am trying now to change the axis title and want to add line breaks and later I also want to add subscript labels. But I am already failing at the newline in the title. Is there any trick?</p>

<pre><code>library(plotly)
library(dplyr)
plot_ly(mtcars, x = wt, y = mpg, text = rownames(mtcars), mode = "text") %&gt;%
  layout(xaxis=list(title='text with\nlinebreak'))
</code></pre>