Skip to content

Add Image support 2 #274

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

Conversation

novakov-alexey-zz
Copy link

I have created new PR, previous #271 was created from old fork state.
This issue is still relevant: #271 (comment)

@novakov-alexey-zz
Copy link
Author

I didn't get how to do documentation test. It seems Plotly documentation has moved to another repository. See here: https://github.com/plotly/documentation.

Also, I can't find Image documentation containing some JavaScript example, only such reference page https://github.com/plotly/graphing-library-docs/blob/6646a9bcb68b10acf5f4708d58d7c16db11383ee/_posts/reference_pages/javascript/2020-07-20-image.html

@alexarchambault
Copy link
Owner

It seems there are some image examples in the plotly documentation, under plotly-documentation/_posts/plotly_js/fundamentals/images. These can be enabled by adding "fundamentals/images" around here.

But it seems images are added in the layout in these examples. Is it what you expected? The Image class should be moved under the plotly.layout namespace if that's the case.

@novakov-alexey-zz
Copy link
Author

It seems there are some image examples in the plotly documentation, under plotly-documentation/_posts/plotly_js/fundamentals/images. These can be enabled by adding "fundamentals/images" around here.

But it seems images are added in the layout in these examples. Is it what you expected? The Image class should be moved under the plotly.layout namespace if that's the case.

Just looked at layout/images as well. Looks like these are to display images from PNG using URL to that image. This is a bit different use-case than Traces/Image that I have added in this PR. The last one allows to draw a 2D image from pixels array on the plot. Think of MNIST dataset visualization where you have grey-scaled or RGB images as 2D matrix of integers (1 - 3). We can create such pixels array programmatically and draw any rasters.

As for documentation path, I would expect some JS examples here: https://github.com/plotly/graphing-library-docs/tree/master/_posts/plotly_js/basic , but there is no basic/image :-(

The only piece of documentation I have found on the subject is here: https://plotly.com/javascript/reference/image/
Not sure if it helps us.

@novakov-alexey-zz
Copy link
Author

what else needs to be done to merge this PR?

@alexarchambault
Copy link
Owner

Sorry, meant to come back at this earlier...

Just adding a simple non regression tests would be fine. Rather than relying on snippets from the plotly documentation, we could just write our own. A test could be added at the end of DocumentationTests, calling plotlyDemoElements with a custom snippet, creating an image in JS, with some of the fields of plotly.Image. Just so that image support doesn't regress in the future.

@novakov-alexey-zz
Copy link
Author

@alexarchambault just added such test. Please have a look.

Copy link
Owner

@alexarchambault alexarchambault left a comment

Choose a reason for hiding this comment

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

Thanks!

@alexarchambault
Copy link
Owner

@novakov-alexey I squashed some commits manually, and pushed that directly to master. This PR changes are now in master, closing it.

@novakov-alexey-zz
Copy link
Author

@alexarchambault perfect, thanks!

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.

3 participants