-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Reduce plot size #501
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
Reduce plot size #501
Conversation
…ng, i.e. regular plotly with 1.2MB javascript in each plot, or having plotly.min.js in a seperate file
@chriddyp , did you ever take a peek at this one? I think @fu makes a good point here. Right now we're just copying in the entire script where we could just be linking it as suggested. Is there a use-case that I'm not considering? This is more complex (as was suggested, we need to make sure the One alternate route would be to allow users to use a flag like:
That can set a module-level flag to change the behavior of |
Yeah, that makes sense. Perhaps something like |
^^ yah, definitely something more specific than The other thing I don't want to do is have a million hard-to-discover functions. We could alternatively keep this in config?
We can name-space
... which should really have an alias like:
I like the idea of having a central place where all the current options can be sorted out. Really I'm ok with either option though since we can just deprecate it later... @fu, can you change this so that the user has to manually call a function or set some config to get this to happen? |
Hi Guys, thanks for picking this one up! I would happily go back and adapt my pull request to have it in the config or use a function call. Personally, I would go for the config solution, would that be ok? Cheers .c |
Yup that's fine by me! Let me know if you have any questions. Thanks @fu! |
…ml and js into two files
Hi again, second thought, setting the config file seems not straight forward in the current implementation, or maybe I could not find the obvious way :) Form my understanding, I would have to adjust set_config_file to accept my "offline_serve_plotlyjs_from_directory", and for all following parts this would need to be adjusted as well. Adding just a **kwargs might be a way but sort of defeats all your checking in set_config_file. Therefore, I opted for the second option: adding serve_plotlyjs_from_directory() that sets a global variable. Pull request on its way Cheers and thank you for the great plotly lib - keep up the good work! .c |
Yah, it's definitely not straightforward because there are three levels of settings that you can set:
The function call is fine for now, can always just change the function implementation later such that it updates the Thanks for the update :) |
Hi,
I added a kwarg outsource_plotly, that allows the plotly.js to be separated from the actual plot. The code just adds a separate file containing the plotly.min.js into the plot folder. While it is not so convenient for a single plot (two files vs one file), it is very good if one creates many plots in one folder, since all plots share the same js.library and thus the overall plotting size is reduced significantly.
Cheers
.c