Skip to content

Commit

Permalink
plotly
Browse files Browse the repository at this point in the history
  • Loading branch information
montyvesselinov committed Sep 17, 2023
1 parent f876fd9 commit 63be9be
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/plotlly_matrix.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import PlotlyJS

PlotlyJS.plot(
PlotlyJS.heatmap(;
x=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
y=["Morning", "Afternoon", "Evening"],
z=[1 25 30 50 1; 20 1 60 80 30; 30 60 1 5 20],
colorscale = "Portland",
),
PlotlyJS.Layout(; xaxis_side="top", yaxis_scaleanchor="x")
)
13 changes: 13 additions & 0 deletions src/NMFkPlotMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ import Gadfly
import Measures
import Colors
import Compose
import PlotlyJS

function plotlymatrix(X::AbstractMatrix; minvalue=minimumnan(X), maxvalue=maximumnan(X), key_tilte="", title="", xlabel="", ylabel="", xticks=nothing, yticks=nothing, xplot=nothing, yplot=nothing, xmatrix=nothing, ymatrix=nothing, gl=[], colormap=colormap_gyr, filename::AbstractString="", hsize::Measures.AbsoluteLength=6Compose.inch, vsize::Measures.AbsoluteLength=6Compose.inch, figuredir::AbstractString=".", colorkey::Bool=true, key_position::Symbol=:right, mask=nothing, dots=nothing, polygon=nothing, contour=nothing, linewidth::Measures.AbsoluteLength=2Gadfly.pt, key_title_font_size=10Gadfly.pt, key_label_font_size=10Gadfly.pt, major_label_font_size=12Gadfly.pt, minor_label_font_size=10Gadfly.pt, dotcolor="purple", linecolor="gray", background_color=nothing, defaultcolor=nothing, pointsize=1.5Gadfly.pt, dotsize=1.5Gadfly.pt, transform=nothing, code::Bool=false, plot::Bool=false, yflip::Bool=true, nbins::Integer=0, flatten::Bool=false, rectbin::Bool=(nbins>0) ? false : true, dpi::Number=imagedpi, quiet::Bool=false, permute::Bool=false)
PlotlyJS.plot(
PlotlyJS.heatmap(;
x = xticks,
y = yticks,
z = X,
colorscale = "Portland",
),
PlotlyJS.Layout(; xaxis_side="top", yaxis_scaleanchor="x")
)
end

function plotmatrix(X::AbstractVector; kw...)
plotmatrix(convert(Array{Float64,2}, permutedims(X)); kw...)
Expand Down

0 comments on commit 63be9be

Please sign in to comment.