-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Type of Trace
#470
Comments
There is full support for |
@empet , I guess what I was after is something similar to Python or MATLAB. Personally, I'd be happy to stay away from |
It's surprising that you need to generate an image from an |
The reason is for performance it is better to use planar from for image. I guess being able to replicate what's on the Python page will be great: https://plotly.com/python/imshow/. |
Running each example from |
To convince yourself just run:
and
In the first Plot the typeof(z) is Array{Float64, 3}, while in the second one Array{Int64, 3}, which is interpreted correctly by plotly.js. LE: Even
works, and this means that somewhere behind the scenes the Int64 values are converted to UInt8. |
I ended up with: function DisplayImage(mI :: Matrix{T}; tuImgSize :: Tuple{N, N} = size(mI), titleStr :: String = "" ) where {T, N <: Integer}
# Displays a grayscale image in the range [0, 1]
oTr1 = heatmap(z = UInt8.(round.(255 * mI))[end:-1:1, :], showscale = false, colorscale = "Greys");
oLayout = Layout(title = titleStr, width = tuImgSize[2] + 100, height = tuImgSize[1] + 100,
hovermode = "closest", margin = attr(l = 50, r = 50, b = 50, t = 50, pad = 0));
hP = plot([oTr1], oLayout);
return hP; #<! display(hP);
end
function DisplayImage(mI :: Array{T, 3}; tuImgSize :: Tuple{N, N} = size(mI)[1:2], titleStr :: String = "" ) where {T, N <: Integer}
# Displays an RGB image in the range [0, 1]
oTr1 = image(z = permutedims(UInt8.(round.(255 * mI)), (3, 2, 1)), colormodel = "rgb");
oLayout = Layout(title = titleStr, width = tuImgSize[2] + 100, height = tuImgSize[1] + 100,
hovermode = "closest", margin = attr(l = 50, r = 50, b = 50, t = 50, pad = 0));
hP = plot([oTr1], oLayout);
return hP; #<! display(hP);
end The nice thing, it also allows I find |
For MATLAB, Python and JS there is a support for the
image
type of trace.It would be great to have it in Julia as well.
By the way, please make it support
AbstractArrays
and not only the image type from Julia Images.By the way, there is some reference for Julia as well, but not in the official documentation.
The text was updated successfully, but these errors were encountered: