-
Notifications
You must be signed in to change notification settings - Fork 633
Let gg2list return a figure object #210
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
Conversation
On TravisCI, commit d39157d was successfully merged with d9ecaf4 (master) to create 4e02b73. A visual testing table comparing d9ecaf4 with 4e02b73 can be found here: |
Assuming we want to go forward with the current design, these changes look good to me... However, since this introduces some backwards-incompatible changes, I thought I'd mention again that having If plotly <- function(p, username, key, ...) UseMethod("plotly") plotly.plotly_figure <- function(p, username, key, ...) {
if (missing(username)) username <- Sys.getenv("PLOTLY_USER")
if (missing(key)) key <- Sys.getenv("PLOTLY_KEY")
# make call to API and return response
make_call(p, username, key, ...)
} plotly.default <- function(p, username, key, ...) {
if (missing(username)) username <- Sys.getenv("PLOTLY_USER")
if (missing(key)) key <- Sys.getenv("PLOTLY_KEY")
# make call to API and return response
make_call(gg2list(p), username, key, ...)
} Of course, making this change would cause more serious backwards-incompatible changes, which will upset current users, but making the necessary changes shouldn't be that hard. @mkcor @chriddyp if you're willing to make these changes, please let me know, and I'll start a pull request. |
@cpsievert Thanks for your insight. I think this conversation belongs there #40 so I'll reply there about your re-design suggestions. I understand it's a related issue as far as we're introducing backwards incompatibility. I admit, I'm not very concerned with backwards incompatibility here (maybe I should care a lot, just by principle) because I doubt that many projects around the world rely on our |
@cldougl Once this is merged, |
I'm not too worried about backwards incompatibility since this is a private function anyway. This is a good step forward for usability in Shiny and some other customizability, so 👍 ! @cpsievert , @mkcor , @13bzhang , @cldougl - let's meditate 🙏 on the redesign of #40 this week and convene sometime next week with a more thorough discussion! |
Thanks, @chriddyp ! Strictly speaking / technically, Okay, I'll sync up with |
On TravisCI, commit aff2997 was successfully merged with d9ecaf4 (master) to create 512b5b5. A visual testing table comparing d9ecaf4 with 512b5b5 can be found here: |
Let gg2list return a figure object
I agree that these "backwards-incompatible" changes aren't a huge deal; but nevertheless, I like to follow the semantic versioning protocol, which would suggest to bump the version to 0.6. Sorry I didn't mention that earlier. Again, not a big deal, but something to consider for the future. |
@cpsievert Great call! You are right. I care about versioning properly. Submitting #215 |
gg2list()
returns a list of lists which is converted into the final JSON file byggplotly()
.It makes a lot more sense in the plotly framework to have
gg2list()
return a figure object, i.e., with dimensionsdata
andlayout
. This way, users can apply it to a ggplot2 plot, say,gg
:It could be an opportunity to rewrite the
plotly()
method (as inpy$plotly()
), making things explicit and less 'flexible' (dot-dot-dot argument). But this is not as urgent so I have only adapted to the new figure return (7f4435c).Tests won't pass as of commit 6b2a8e8, I'm going to make extensive use of
sed
to update our tests accordingly./cc @chriddyp @etpinard @cpsievert @tdhock