Is there an approach for eliminating the line that appears above the title when importing it as a PNG file into Word?

# Objective is to draw a graph using plotly and import the graph into word.
# Graph generated using the code below saved as a PNG file.
# Imported PNG file into word.
# A line appears above the title when importing PNG file into Word. Like to remove the line.

frData <- data.frame(Prob = seq(1, 0.1, by = -0.10), Location = paste0("ST", 1:10), rank = 1:10)
frData$xx <- ifelse(frData$Location %in% c("ST9", "ST10"), frData$Prob + 0.10, frData$Prob - 0.10)

library(dplyr
library(plotly)

m <- list(
  l = 50,
  r = 50,
  b = 75,
  t = 30,
  pad = 10
)

fig1 <- plot_ly(frData, x = ~Prob, y = ~reorder(Location, Prob), name = '<b>Model based ranking</b>',
                type = 'bar', orientation = 'h',
                marker = list(color = 'rgba(50, 171, 96, 0.6)',
                              line = list(color = 'rgba(50, 171, 96, 1.0)', width = 1)))
fig1 <- fig1 %>% layout(yaxis = list(showgrid = FALSE, showline = FALSE, showticklabels = TRUE, domain= c(0, 0.95), title = "<b>Location</b> \n \n \n \n"),
                        xaxis = list(zeroline = TRUE, showline = TRUE, showticklabels = TRUE, showgrid = TRUE, title = "<b>Probability</b>"), plot_bgcolor='#e5ecf6')
fig1 <- fig1 %>% add_annotations(xref = 'x1', yref = 'y',
                                 x = frData$xx,  y = frData$Location,
                                 text = paste("Rank = ", frData$rank, " , ", "Probability = ", round(frData$Prob, 1)),
                                 font = list(family = 'Arial', size = 12, color = '003'),
                                 showarrow = FALSE) %>%
  layout( plot_bgcolor='#e5ecf6',xaxis = list(titlefont = list(size = 18), tickfont = list(size = 15), gridcolor = "LightPink"),
          yaxis = list(titlefont = list(size = 18), tickfont = list(size = 15), gridcolor = "LightPink") )  %>%
  layout(annotations =
           list(x = 0.0, y = -0.1,
                font = list(color = "black", size=14),
                showarrow = F,
                xref='paper',
                yref='paper'))

fig1 <- fig1 %>% layout(title = "<b>Figure. Ranking of Locations \n Concordance-Statistic = 0.80</b>", size = 20, y = 0.5, x = 0.5, xanchor = 'center', yanchor = 'top')

fig1 <- fig1 %>% layout(autosize = F, width = 1150, height = 800, margin = m)

fig1

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.