# Plot() output written to HTML file?

**URL:** <https://discourse.julialang.org/t/plot-output-written-to-html-file/31182>\
**Category:** Tooling\
**Tags:** question, plotting\
**Created:** [November 17, 2019, 4:19pm UTC](https://discourse.julialang.org/t/plot-output-written-to-html-file/31182 "2019-11-17T16:19:01Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![pontus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pontus/32/10438_2.png) [@pontus](https://discourse.julialang.org/u/pontus)\
**Post date:** [November 18, 2019, 5:25pm UTC](https://discourse.julialang.org/t/plot-output-written-to-html-file/31182/7 "2019-11-18T17:25:18Z")

</div>

Thank you @pfitzseb!! 👍 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](https://discourse.julialang.org/t/formatted-printing-of-arrays/3121) thread:

```julia
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:

```julia
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

```

 ![pfitzseb_soln_showFormatted3SignDig](https://global.discourse-cdn.com/julialang/original/3X/8/9/893d88351a842fa880eef985587f032d297c8a4b.png)

---

_[View the full topic](https://discourse.julialang.org/t/plot-output-written-to-html-file/31182)._
