Skip to content

Offline mode is now default for plotly(). #357

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

Merged
merged 4 commits into from
Aug 26, 2021
Merged

Conversation

jolinos
Copy link
Contributor

@jolinos jolinos commented Aug 24, 2021

Offline mode is now default for plotly as in the example below.

trace1 = struct(...
  'x', [1, 2, 3, 4], ...
  'y', [0, 2, 3, 5], ...
  'fill', 'tozeroy', ...
  'type', 'scatter');
trace2 = struct(...
  'x', [1, 2, 3, 4], ...
  'y', [3, 5, 1, 7], ...
  'fill', 'tonexty', ...
  'type', 'scatter');
data = {trace1, trace2};
response = plotly(data, struct('filename', 'basic-area', 'fileopt', 'overwrite'));
url = response.url

@gilbertogalvis
Copy link
Contributor

Tested it.
This working fine!

Note: When online mode is used, this returns the url to chart-studio

@jackparmer
Copy link
Contributor

@harshpurwar can you please review as well?

@harshpurwar harshpurwar self-requested a review August 25, 2021 21:09
Copy link
Contributor

@harshpurwar harshpurwar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First things first, this doesn't work as one would expect it to, see the attached screenshot (not truly offline!). Now, I know I see this because I haven't set up plotly with API Key from Chart Studio. But that is the point, we shouldn't be needing the API key for offline usage, right @jackparmer?
The solution for this is already in the master branch. So, if plotlynofig.m was taken from the current master, this would have worked.

Now the second thing I would like to comment on is the fact that we don't want to have two similar classes plotlyfig and plotlynofig, the differences between the two aren't too many (see the attached file: diff_fig_noFig.txt). Is there a reason why we couldn't do this by checking the number & type of input arguments and then calling the right functions all within the same class? I don't think it is a good idea to have two similar classes plotlyfig and plotlynofig, it just calls in for a lot more future work!

image

@jolinos
Copy link
Contributor Author

jolinos commented Aug 25, 2021 via email

@jolinos
Copy link
Contributor Author

jolinos commented Aug 26, 2021

First things first, this doesn't work as one would expect it to, see the attached screenshot (not truly offline!). Now, I know I see this because I haven't set up plotly with API Key from Chart Studio. But that is the point, we shouldn't be needing the API key for offline usage, right @jackparmer?
The solution for this is already in the master branch. So, if plotlynofig.m was taken from the current master, this would have worked.

Now the second thing I would like to comment on is the fact that we don't want to have two similar classes plotlyfig and plotlynofig, the differences between the two aren't too many (see the attached file: diff_fig_noFig.txt). Is there a reason why we couldn't do this by checking the number & type of input arguments and then calling the right functions all within the same class? I don't think it is a good idea to have two similar classes plotlyfig and plotlynofig, it just calls in for a lot more future work!

image

@harshpurwar I have tried what you suggested and it is not working. I know for sure that what I did is working and @gilbertogalvis confirmed it! Maybe you are not having the correct files. By the way, there was no plotlynofig before, it is a new file that I added to try to mimic what plotlyfig is doing but this time when passed only data and NOT a figure. I understand your worries about having two similar classes but I guess it is also good to know that one is from a figure and the other is not. I think you are confusing between "fig2plotly" and "plotly". fig2plotly takes in a matlab figure, while plotly takes in data with some layout.

@jackparmer
Copy link
Contributor

jackparmer commented Aug 26, 2021

correct - an API key should never be required for offline usage at any point

@jackparmer
Copy link
Contributor

I also agree that we don't want two classes that are essentially the same. We need to keep the code DRY (don't repeat yourself) so that it is maintainable

@jackparmer
Copy link
Contributor

please merge this PR for now @jolinos so that your plotly() documentation work is unblocked. @harshpurwar can then fix some of these remaining issues in a follow up PR later. For now the important task for you @jolinos is the plotly() documentation pages.

@jackparmer jackparmer merged commit 14c84ca into master Aug 26, 2021
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

Successfully merging this pull request may close these issues.

4 participants