-
Notifications
You must be signed in to change notification settings - Fork 48
Add Image support #271
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
Add Image support #271
Conversation
@alexarchambault Documentation tests seem not relevant for Image Trace due to outdated documentation fork. plotly-scala would require to update documentation to the latest Plotly.js state. However, Image trace is working fine: import plotly.element.HoverInfo
import plotly.element.HoverInfo._
val z = Seq(
Seq(Seq(0, 33, 50), Seq(0, 66, 50), Seq(0, 100, 50)),
Seq(Seq(90, 33, 50), Seq(90, 66, 50), Seq(90, 100, 50)),
Seq(Seq(180, 33, 50), Seq(180, 66, 50), Seq(180, 100, 50)),
Seq(Seq(270, 33, 50), Seq(270, 66, 50), Seq(270, 100, 50)))
Image(
z = z,
x0=Some(0.05),
y0=Some(0.05),
hoverinfo = Some(HoverInfo(X, Y, Z)),
colormodel = Some("rgb")
).plot() |
@novakov-alexey Thanks for opening this! I'm about to update the documentation sub-module, I should open a PR for it, either later today or in the coming days. That should allow to add tests for this. Just ping me if I forget to come back here once it's done. |
Great, looking forward to that! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only left some minor comments.
I also updated the documentation sub-module in master
, feel free to rebase, and enable relevant tests for images.
.gitignore
Outdated
@@ -1,2 +1,3 @@ | |||
target/ | |||
.bsp/ | |||
.idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be added in a separate commit, to make the git history cleaner?
README.md
Outdated
```scala | ||
import $ivy.`org.plotly-scala::plotly-almond:0.8.0` | ||
import $ivy.`org.plotly-scala::plotly-almond:0.8.1` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, let's edit the README in a separate commit too.
There is a small problem that I do not know how to resolve on JSON encoding level. If we want to support 3-channel and 4 channel color models like RGB and RGBA, we might need to model colors in abstract class ZColor with ....
Color3(c1: Int, c2: Int, c3: Int) extends ZColor
// note that last property is Double, all other are Ints
Color4(c1: Int, c2: Int, c3: Int, alpha: Double) extends ZColor I tried to implement it, but failed to render these case classes without Latets API I came up with: import plotly.element.HoverInfo._
import plotly.element.ColorModel._
import plotly.element.Element._
val colors = Seq(
Seq(Seq(0d, 33d, 50d), Seq(0d, 66, 50), Seq(0d, 100, 50)),
Seq(Seq(90d, 33d, 50d), Seq(90d, 66, 50), Seq(90d, 100, 50)),
Seq(Seq(180d, 33d, 50d), Seq(180d, 66, 50), Seq(180d, 100, 50)),
Seq(Seq(270d, 33d, 50d), Seq(270d, 66, 50), Seq(270d, 100, 50)))
Image(z = colors)
.withX0(0.05)
.withY0(0.05)
.withHoverinfo(HoverInfo(X, Y, Z, HoverInfo.Color))
.withColormodel(RGB)
.plot() It works, but requires Double numbers for RGB, which is weird. |
a4dd543
to
334122d
Compare
New PR is here: #274 |
No description provided.