Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Tick Text works locally, but doesn't work when uploaded to plot.ly

I am using ggplotly in R to create a scatterplot, and then upload using api_create. Changing ticktext works locally, but when I upload the plot, the ticktext reverts to just showing default values. My only clue is that the json locally has ticktext listed out, whereas the plot.ly plot has converted it to ticktextsrc, with a pointer that I assume is to my data. Is there something wrong?

Here is a simple example:
https://plot.ly/~jtannen/7/#data

I tried to label the ticks a-h, which works on my local plot but doesn’t work upon uploading using api_create. The json references ticktextsrc, instead of ticktext.

Here is the generated json according to plot.ly:

{
  "data": [
    {
      "showlegend": false,
      "yaxis": "y",
      "ysrc": "jtannen:6:b2b443",
      "hoverinfo": "text",
      "textsrc": "jtannen:6:43f9d4",
      "marker": {
        "opacity": 1,
        "autocolorscale": false,
        "color": "rgba(0,0,0,1)",
        "symbol": "circle",
        "line": {
          "color": "rgba(0,0,0,1)",
          "width": 1.88976377952756
        },
        "size": 5.66929133858268
      },
      "xsrc": "jtannen:6:a5dbb2",
      "xaxis": "x",
      "text": [
        "x: 0.5286452<br />y: 0.2411272",
        "x: 0.6056680<br />y: 0.9458609",
        "x: 0.9784705<br />y: 0.2638407",
        "x: 0.3884859<br />y: 0.4482247",
        "x: 0.5663884<br />y: 0.4580097",
        "x: 0.7283770<br />y: 0.7872046",
        "x: 0.2348663<br />y: 0.7487802",
        "x: 0.6406663<br />y: 0.6498426",
        "x: 0.5745553<br />y: 0.2908037",
        "x: 0.4726864<br />y: 0.4539749"
      ],
      "y": [
        0.241127200890332,
        0.945860874606296,
        0.263840718660504,
        0.44822470843792,
        0.458009655820206,
        0.787204646505415,
        0.748780243797228,
        0.649842564482242,
        0.290803705807775,
        0.453974917763844
      ],
      "x": [
        0.528645229060203,
        0.60566803952679,
        0.978470477974042,
        0.388485931325704,
        0.56638835859485,
        0.728377014165744,
        0.234866292448714,
        0.640666339779273,
        0.574555322062224,
        0.472686406923458
      ],
      "type": "scatter",
      "hoveron": "points",
      "mode": "markers"
    }
  ],
  "layout": {
    "showlegend": false,
    "yaxis": {
      "domain": [
        0,
        1
      ],
      "showticklabels": true,
      "titlefont": {
        "color": "rgba(0,0,0,1)",
        "family": "",
        "size": 14.6118721461187
      },
      "tickvalssrc": "jtannen:6:72110f",
      "linewidth": 0,
      "autorange": false,
      "ticktextsrc": "jtannen:6:d72fba",
      "tickmode": "array",
      "title": "y",
      "ticks": "outside",
      "showgrid": true,
      "zeroline": false,
      "type": "linear",
      "automargin": true,
      "ticklen": 3.65296803652968,
      "categoryorder": "array",
      "hoverformat": ".2f",
      "tickcolor": "rgba(51,51,51,1)",
      "showline": false,
      "tickfont": {
        "color": "rgba(77,77,77,1)",
        "family": "",
        "size": 11.689497716895
      },
      "tickwidth": 0.66417600664176,
      "tickangle": 0,
      "gridwidth": 0.66417600664176,
      "range": [
        0.205890517204534,
        0.981097558292095
      ],
      "categoryarraysrc": "jtannen:6:2f6342",
      "gridcolor": "rgba(255,255,255,1)",
      "anchor": "x"
    },
    "paper_bgcolor": "rgba(255,255,255,1)",
    "plot_bgcolor": "rgba(235,235,235,1)",
    "shapes": [
      {
        "xref": "paper",
        "yref": "paper",
        "y1": 1,
        "y0": 0,
        "x0": 0,
        "x1": 1,
        "type": "rect",
        "line": {
          "width": 0
        }
      }
    ],
    "barmode": "relative",
    "xaxis": {
      "domain": [
        0,
        1
      ],
      "showticklabels": true,
      "titlefont": {
        "color": "rgba(0,0,0,1)",
        "family": "",
        "size": 14.6118721461187
      },
      "tickvalssrc": "jtannen:6:dd1b01",
      "linewidth": 0,
      "autorange": false,
      "ticktextsrc": "jtannen:6:fd0cdd",
      "tickmode": "array",
      "title": "x",
      "ticks": "outside",
      "showgrid": true,
      "zeroline": false,
      "type": "linear",
      "automargin": true,
      "ticklen": 3.65296803652968,
      "categoryorder": "array",
      "hoverformat": ".2f",
      "tickcolor": "rgba(51,51,51,1)",
      "showline": false,
      "tickfont": {
        "color": "rgba(77,77,77,1)",
        "family": "",
        "size": 11.689497716895
      },
      "tickwidth": 0.66417600664176,
      "tickangle": 0,
      "gridwidth": 0.66417600664176,
      "range": [
        0.197686083172448,
        1.01565068725031
      ],
      "categoryarraysrc": "jtannen:6:451932",
      "gridcolor": "rgba(255,255,255,1)",
      "anchor": "y"
    },
    "hovermode": "closest",
    "font": {
      "color": "rgba(0,0,0,1)",
      "family": "",
      "size": 14.6118721461187
    },
    "margin": {
      "r": 7.30593607305936,
      "b": 37.2506100359982,
      "l": 31.4155251141553,
      "t": 23.2962721364548
    },
    "legend": {
      "bordercolor": "transparent",
      "bgcolor": "rgba(255,255,255,1)",
      "font": {
        "color": "rgba(0,0,0,1)",
        "family": "",
        "size": 11.689497716895
      },
      "borderwidth": 1.88976377952756
    }
  }
}

R Code:

test_gg <- ggplot(
  data.frame(
    x = runif(10),
    y = runif(10)
  ),
  aes(x=x, y=y)
) +
  geom_point() +
  scale_x_continuous(
    breaks = seq(0,1,0.1),
    labels = letters[1:11]
  ) +
  scale_y_continuous(
    breaks = seq(0,1,0.1),
    labels = letters[1:11]
  )

ggplotly(test_gg)

api_create(ggplotly(test_gg), filename = 'test_scatterb')

I’m using R package plotly 4.8.0

> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] plotly_4.8.0  ggplot2_3.0.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.13        bindr_0.1           magrittr_1.5        munsell_0.4.3      
 [5] xtable_1.8-2        viridisLite_0.2.0   colorspace_1.3-2    R6_2.2.2           
 [9] rlang_0.2.1         httr_1.3.1          plyr_1.8.4          dplyr_0.7.4        
[13] tools_3.3.3         grid_3.3.3          data.table_1.10.4-3 gtable_0.2.0       
[17] withr_2.1.0.9000    crosstalk_1.0.0     htmltools_0.3.5     yaml_2.1.14        
[21] lazyeval_0.2.1      assertthat_0.1      digest_0.6.12       tibble_1.3.4       
[25] bindrcpp_0.2        shiny_1.0.0         tidyr_0.7.2         purrr_0.2.4        
[29] htmlwidgets_1.2     curl_3.0            mime_0.5            glue_1.2.0         
[33] scales_0.5.0.9000   jsonlite_1.5        httpuv_1.3.3        pkgconfig_2.0.1    

Thank you!

Hi @jtannen

Thanks for reporting and the comprehensive summary.

You have stumbled upon a known bug. In short, there currently exists an issue with the way ‘src-able’ attributes work on the cloud service (plot.ly)

You can follow updates concerning this issue here https://github.com/ropensci/plotly/issues/1197