• <tfoot id='fF0US'></tfoot>
      <bdo id='fF0US'></bdo><ul id='fF0US'></ul>

    1. <legend id='fF0US'><style id='fF0US'><dir id='fF0US'><q id='fF0US'></q></dir></style></legend>
      <i id='fF0US'><tr id='fF0US'><dt id='fF0US'><q id='fF0US'><span id='fF0US'><b id='fF0US'><form id='fF0US'><ins id='fF0US'></ins><ul id='fF0US'></ul><sub id='fF0US'></sub></form><legend id='fF0US'></legend><bdo id='fF0US'><pre id='fF0US'><center id='fF0US'></center></pre></bdo></b><th id='fF0US'></th></span></q></dt></tr></i><div id='fF0US'><tfoot id='fF0US'></tfoot><dl id='fF0US'><fieldset id='fF0US'></fieldset></dl></div>

        <small id='fF0US'></small><noframes id='fF0US'>

        修复标题在两行上拆分时的 plotly ggplotly() 标题重叠图

        时间:2023-09-30

            <bdo id='UXe4X'></bdo><ul id='UXe4X'></ul>

            <small id='UXe4X'></small><noframes id='UXe4X'>

            <tfoot id='UXe4X'></tfoot>

                <tbody id='UXe4X'></tbody>
                <legend id='UXe4X'><style id='UXe4X'><dir id='UXe4X'><q id='UXe4X'></q></dir></style></legend>

                  <i id='UXe4X'><tr id='UXe4X'><dt id='UXe4X'><q id='UXe4X'><span id='UXe4X'><b id='UXe4X'><form id='UXe4X'><ins id='UXe4X'></ins><ul id='UXe4X'></ul><sub id='UXe4X'></sub></form><legend id='UXe4X'></legend><bdo id='UXe4X'><pre id='UXe4X'><center id='UXe4X'></center></pre></bdo></b><th id='UXe4X'></th></span></q></dt></tr></i><div id='UXe4X'><tfoot id='UXe4X'></tfoot><dl id='UXe4X'><fieldset id='UXe4X'></fieldset></dl></div>

                  本文介绍了修复标题在两行上拆分时的 plotly ggplotly() 标题重叠图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在下面的示例中,标题的第二行与情节略有重叠.有没有办法通过增加标题和情节之间的间距来解决这个问题?

                  In the example below, the second line of the title overlaps slightly with the plot. Is there a way to fix this by increasing the spacing between the title and plot?

                  library(ggplot2)
                  library(plotly)
                  library(magrittr)
                  
                  p1 <- ggplot(iris, aes(x = Sepal.Length, y = Petal.Length)) +
                    geom_point() + 
                    ggtitle("A REALLY, REALLY, REALLY LONG TITLE THAT I WANT TO
                  SPLIT INTO TWO LINES")
                  p1
                  
                  ggplotly() %>% config(collaborate=FALSE, cloud=FALSE, displaylogo=FALSE, modeBarButtonsToRemove=c("select2d", "sendDataToCloud", "pan2d", "resetScale2d", "hoverClosestCartesian", "hoverCompareCartesian", "lasso2d", "zoomIn2d", "zoomOut2d"))
                  

                  推荐答案

                  Plotly 忽略尾随换行符,还需要 HTML 换行符 <br/> 而不是 换行(见最后的例子).

                  Plotly ignores trailing new line characters and also needs HTML breaks <br /> instead of for new lines (see example at the end).

                  添加 <br/> 以手动打破标题并在布局中添加顶部 margin (layout(gp, margin=list(t= 75))).

                  Add <br /> to manually break your title and add a top margin to your layout (layout(gp, margin=list(t = 75))).

                  library(ggplot2)
                  library(plotly)
                  library(magrittr)
                  
                  p1 <- ggplot(iris, aes(x = Sepal.Length, y = Petal.Length)) +
                    geom_point() + 
                    ggtitle("A REALLY, REALLY, REALLY LONG TITLE THAT I WANT TO <br />
                  SPLIT INTO TWO LINES<br />
                  ")
                  p1
                  
                  gp <- ggplotly() %>% config(collaborate=FALSE, cloud=FALSE, displaylogo=FALSE, modeBarButtonsToRemove=c("select2d", "sendDataToCloud", "pan2d", "resetScale2d", "hoverClosestCartesian", "hoverCompareCartesian", "lasso2d", "zoomIn2d", "zoomOut2d"))
                  gp <- layout(gp, margin=list(t = 75))
                  gp
                  

                  <小时>

                  ggplot

                  情节

                  这篇关于修复标题在两行上拆分时的 plotly ggplotly() 标题重叠图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:是否可以在 plotly.js 中有一个水平颜色条 下一篇:Plotly.js 在点击时创建一个点

                  相关文章

                    <bdo id='cfrYY'></bdo><ul id='cfrYY'></ul>
                • <i id='cfrYY'><tr id='cfrYY'><dt id='cfrYY'><q id='cfrYY'><span id='cfrYY'><b id='cfrYY'><form id='cfrYY'><ins id='cfrYY'></ins><ul id='cfrYY'></ul><sub id='cfrYY'></sub></form><legend id='cfrYY'></legend><bdo id='cfrYY'><pre id='cfrYY'><center id='cfrYY'></center></pre></bdo></b><th id='cfrYY'></th></span></q></dt></tr></i><div id='cfrYY'><tfoot id='cfrYY'></tfoot><dl id='cfrYY'><fieldset id='cfrYY'></fieldset></dl></div>
                    <tfoot id='cfrYY'></tfoot>

                    <small id='cfrYY'></small><noframes id='cfrYY'>

                  1. <legend id='cfrYY'><style id='cfrYY'><dir id='cfrYY'><q id='cfrYY'></q></dir></style></legend>