# I'm not able to use Gadfly + Weave

**URL:** <https://discourse.julialang.org/t/im-not-able-to-use-gadfly-weave/47810>\
**Category:** New to Julia\
**Created:** [October 5, 2020, 7:12pm UTC](https://discourse.julialang.org/t/im-not-able-to-use-gadfly-weave/47810 "2020-10-05T19:12:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![conditionality](https://avatars.discourse-cdn.com/v4/letter/c/4af34b/32.png) [@conditionality](https://discourse.julialang.org/u/conditionality)\
**Post date:** [October 5, 2020, 7:12pm UTC](https://discourse.julialang.org/t/im-not-able-to-use-gadfly-weave/47810/1 "2020-10-05T19:12:42Z")

</div>

I have a very simple .jmd file

````julia
\```julia
using Gadfly
x = range(0, step=0.1, stop=2*pi)
println(x)
Gadfly.plot(x = x, y = sin.(x))
\```

````

(I had to escape the backticks when composing this message). When calling weave on the .jmd file, I get an error (see below). If I replace “Gadfly” with “Plots”, it works. If I run the code snippet in REPL, it works with both Plots and Gadfly. So why does it fail when using Gadfly in Weave?

Julia code invoking weave:  
`weave("path/to/file.jmd", out_path=save_path, doctype = "md2html", mod=mymodule)`

Error:

```julia
┌ Info: Weaving chunk 1 from line 8
└ progress = 0.0
┌ Info: Weaving chunk 2 from line 16
└ progress = 0.5
┌ Warning: ERROR: ErrorException occurred, including output in Weaved document
└ @ Weave C:\path\.julia\packages\Weave\lf3HS\src\run.jl:234
┌ Info: Weaved all chunks
└ progress = 1
ERROR: LoadError: SystemError: opening file "D:\\mypath\\reports\\20201005__20_56_56_605\\jl_ngvppF/report_2_1.png": No such file or directory
Stacktrace:
 [1] systemerror(::String, ::Int32; extrainfo::Nothing) at .\error.jl:168
 [2] #systemerror#48 at .\error.jl:167 [inlined]
 [3] systemerror at .\error.jl:167 [inlined]
 [4] open(::String; lock::Bool, read::Bool, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing) at .\iostream.jl:284
 [5] open(::String, ::String; lock::Bool) at .\iostream.jl:346
 [6] open at .\iostream.jl:346 [inlined]
 [7] img2base64(::String, ::String) at C:\path\.julia\packages\Weave\lf3HS\src\run.jl:152
 [8] embed_figures!(::Weave.CodeChunk, ::String) at C:\path\.julia\packages\Weave\lf3HS\src\run.jl:140
 [9] embed_figures! at C:\path\.julia\packages\Weave\lf3HS\src\run.jl:146 [inlined]
 [10] run_chunk(::Weave.CodeChunk, ::Weave.WeaveDoc, ::Weave.Report, ::Module) at C:\path\.julia\packages\Weave\lf3HS\src\run.jl:134
 [11] run_doc(::Weave.WeaveDoc; doctype::String, out_path::String, args::Dict{Any,Any}, mod::Module, fig_path::Nothing, fig_ext::Nothing, cache_path::String, cache::Symbol) at C:\path\.julia\packages\Weave\lf3HS\src\run.jl:74
 [12] weave(::String; doctype::String, informat::Nothing, out_path::String, args::Dict{Any,Any}, mod::Module, fig_path::Nothing, fig_ext::Nothing, cache_path::String, cache::Symbol, template::Nothing, css::Nothing, highlight_theme::Nothing, pandoc_options::Array{String,1}, latex_cmd::Array{String,1}, keep_unicode::Bool) at C:\path\.julia\packages\Weave\lf3HS\src\Weave.jl:177
 ...
 [20] top-level scope at .\REPL[4]:0
in expression starting at D:\mypath\myfile.jl:38

```

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [October 8, 2020, 2:16am UTC](https://discourse.julialang.org/t/im-not-able-to-use-gadfly-weave/47810/2 "2020-10-08T02:16:58Z")

</div>

what is weave?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [October 8, 2020, 2:21am UTC](https://discourse.julialang.org/t/im-not-able-to-use-gadfly-weave/47810/3 "2020-10-08T02:21:31Z")

</div>

[Weave.jl](https://github.com/JunoLab/Weave.jl)

---

<div class="post-metadata">

**Author:** ![Humphrey\_Lee](https://avatars.discourse-cdn.com/v4/letter/h/a88e4f/32.png) [@Humphrey\_Lee](https://discourse.julialang.org/u/Humphrey_Lee)\
**Post date:** [November 13, 2020, 7:20am UTC](https://discourse.julialang.org/t/im-not-able-to-use-gadfly-weave/47810/4 "2020-11-13T07:20:54Z")

</div>

Also having issue with Weave+Gadfly. BTW, I’m doing md2pdf as output format. Searched Internet and found below. Are they related?

[https://github.com/JunoLab/Weave.jl/issues/392](https://github.com/JunoLab/Weave.jl/issues/392)

For unknown reason, the file “D:\mypath\reports\20201005\_\_20\_56\_56\_605\jl\_ngvppF/report\_2\_1.png” (yours) is non-existent - that is what happened in my case.

---

<div class="post-metadata">

**Author:** ![Humphrey\_Lee](https://avatars.discourse-cdn.com/v4/letter/h/a88e4f/32.png) [@Humphrey\_Lee](https://discourse.julialang.org/u/Humphrey_Lee)\
**Post date:** [November 13, 2020, 9:39am UTC](https://discourse.julialang.org/t/im-not-able-to-use-gadfly-weave/47810/5 "2020-11-13T09:39:48Z")

</div>

Seems a PR has been filed → [https://github.com/JunoLab/Weave.jl/issues/403](https://github.com/JunoLab/Weave.jl/issues/403)

---

<div class="post-metadata">

**Author:** ![CiaranOMara](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ciaranomara/32/2589_2.png) [@CiaranOMara](https://discourse.julialang.org/u/CiaranOMara)\
**Post date:** [November 13, 2020, 10:48am UTC](https://discourse.julialang.org/t/im-not-able-to-use-gadfly-weave/47810/6 "2020-11-13T10:48:09Z")

</div>

Weave is attempting to load a PNG. I think you need to add `using Cairo, Fontconfig` for the presumed PNG to generate.

---

<div class="post-metadata">

**Author:** ![Humphrey\_Lee](https://avatars.discourse-cdn.com/v4/letter/h/a88e4f/32.png) [@Humphrey\_Lee](https://discourse.julialang.org/u/Humphrey_Lee)\
**Post date:** [November 17, 2020, 9:39am UTC](https://discourse.julialang.org/t/im-not-able-to-use-gadfly-weave/47810/7 "2020-11-17T09:39:45Z")

</div>

Yes, this works! My working code is below.

```julia
using Gadfly
using Cairo
using Fontconfig
#x = linspace(0, 2*pi)
x = range(0,stop=2*pi,length=10)
println(x)
plot(x = x, y = sin.(x))

```
