Skip to content

X-Axis Disappears in api_create() #1197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
m-champion opened this issue Feb 15, 2018 · 7 comments
Closed

X-Axis Disappears in api_create() #1197

m-champion opened this issue Feb 15, 2018 · 7 comments

Comments

@m-champion
Copy link

Greetings.

I have been having an issue recently where the x-axis labels have been disappearing from graphs I've created in R once uploaded using api_create(). I've repeated this numerous times, and it seems entirely reproducible. I've supplied the short R code that highlights the issue. This x-axis disappearance occurs whether or not the ggplotly() function is called before api_create().

I've attempted to specify x-axis markers in ggplotly() as well before uploading, but these are stripped during upload. I've also removed all theme values, and the x-axis is still removed. I've changed the geom between bar() and col() to the same effect.

Here is the graph as intended:
https://drive.google.com/file/d/1lQDq98FwYMhS0zxttrrZnOpU3T8JeHar/view?usp=sharing

Here is the graph after upload:
https://plot.ly/~m_champion/102/


Code Example

example <- ggplot(mtcars, aes(x = rownames(mtcars), y = mpg)) + 
  geom_col() + 
  #geom_bar(stat = "identity") +  #X-Axis disappears in both geom_col() and geom_bar()
  ggtitle("Cars by MPG") + 
  ylab("Miles per Gallon") + 
  xlab("Car Make and Model") 

example.plotly <- ggplotly(example)
api_create(example.plotly, "Example/example")
@cpsievert
Copy link
Collaborator

Seems to be working if you upgrade to the dev version https://plot.ly/~cpsievert/22934/

devtools::install_github('ropensci/plotly')

@m-champion
Copy link
Author

Hi There, it's not fixed. In your own example it's broken, and it is still broken even after utilising the dev version. Can you please re-open this?

@cpsievert cpsievert reopened this Feb 21, 2018
@cpsievert
Copy link
Collaborator

cpsievert commented Feb 21, 2018

Huh, it seems "src-able" layout attributes are not being rendered properly on our cloud service, here's a more minimal example:

library(plotly)

p <- plot_ly(x = c("a", "b"), y = c(1, 2)) %>%
  add_bars() %>%
  layout(
    xaxis = list(
      ticktext = c("AAA", "BBB"), 
      tickvals = c(0, 1)
    )
  )

api_create(p)

Looking into it...

@m-champion
Copy link
Author

Thanks for taking a look! And apologies on the gruff language - I should not comment before coffee...

@cpsievert
Copy link
Collaborator

@cpsievert
Copy link
Collaborator

I've done everything I can do here. It's now up to plotly's backend team to fix this issue.

@michaelbabyn
Copy link
Contributor

@cpsievert , I saw the above issue when working on plotly documentation and the above example works if I use list instead of c for ticktext and tickvals. Then I found this issue on streambed which decided that they wouldn't support *src references for layout attributes.

So the issue is that plotly.R shouldn't src-ify layout attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants