Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Tickvals not saving with api_create

I manually set the tickvals for my y-axis for a plot_ly plot. When I view the plot output from R, the axis labels work fine. However, when I export this plot using api_create, the custom tickvals are not retained – the axis values are back to their automated form.

Here is a screenshot of my plot output from R:

But in plot.ly after exporting with api_create, the y-axis values do not match:

Here is my code for the plot:

plot <- plot_ly(actions,
x=~DatePlot,
y=~Amount,
color=~Affected,
type=“scatter”,
mode=“markers”,
hoverinfo=“text”,
text=~paste(“Target:”, Target, “
Topics:”, Topics, “
States:”, States, “
Date:”, Date, “
Amount:”, AmountText, “
Consumers Compensated:”, CompensatedText),
size=~CompensatedSize,
sizes=c(10,50),
marker=list(opacity=0.5, sizemode=“diameter”)) %>%
layout(title=“CFPB Enforcement Actions”,
xaxis=list(title=“Date”,
zeroline=FALSE),
yaxis=list(title=“Fine Amount (dollars)”,
zeroline=FALSE,
tickmode=“array”,
tickvals=c(10000,50000000,100000000,150000000,200000000,
250000000,500000000,750000000,1000000000),
ticktext=c(“10K”,“50M”,“100M”,“150M”,“200M”,“250M”,“500M”,
“750M”,“1B”)))
api_create(plot, filename=“NewEconomyProject_CFPBEnforcementActionsNY”)

Does anyone know how I can preserve the tick values I had set in R when exporting with api_create?

R version: 3.4.1
Plotly version: 4.7.0

Hi @emilynmoss,

I’ve opened an issue which you can follow here https://github.com/ropensci/plotly/issues/1106