How do I get rid of the scrollbar to show the full legend and save the plot as a png?
I am trying to save a plotly graph in r, but the legend has a scroll bar.
My code:
plot_ly(data = stats_salary, x = ~Salary, y = ~PPG, color = ~Team,
hoverinfo = "text",
text = ~paste("Player: ", Player,
"<br>Salary: ", "$",format(Salary, big.mark = ","),
"<br>PPG: ", round(PPG, digits = 3),
"<br>Team: ", Team)) %>%
layout(
title = "Salary vs Point Per Game by Player",
xaxis = list(title = "Player's Salary"),
yaxis = list(title = "Points per Game")
)
My output:
I would like to save this chart as a png. Whenever I run this code, I get a NULL error:
export(plot, file = "plot.png")
How do I get rid of the scrollbar to show the full legend and save the plot as a png?