Plot() output written to HTML file?

Thank you @pfitzseb!! :+1: This is working nicely for the plot. Requires no major dependencies and is quite straightforward. Let me play with a few other options and will mark this as solution if nothing simpler is found.

I know including the plot data itself wasn’t part of the requirement, but trying to do that and get it to look clean. BrowseTables.jl doesn’t seem to work within the loop ( HTMLTable(data) produces blank output).
Found a formatting solution in the Formatted printing of arrays thread:

Base.show(io::IO, f::Float64) = @printf io "%1.3f" f

and "%1.4f" for 4 sign digits, etc. Looking at DataFrames as well, as the show there can control scope of which rows/columns to output. Here is code and output at this point:

using Plots ; gr() 
Base.show(io::IO, f::Float64) = @printf io "%1.3f" f
data = rand(14)
p=Plots.plot(1:14, data)
open("index.html", "w") do io
  show(io, data)
  show(io, "text/html", p)
end

using DataFrames
df=rand(11)
p=Plots.plot(1:11, df)
open("index.html", "w") do io
  show(io, df)
  show(io, "text/html", p)
end

2 Likes