# Getting Franklin.jl to display plots with Literate.jl

**URL:** https://discourse.julialang.org/t/getting-franklin-jl-to-display-plots-with-literate-jl/62025
**Category:** General Usage
**Tags:** plotting, literate-programming, franklin
**Created:** [May 28, 2021, 11:32pm UTC](https://discourse.julialang.org/t/getting-franklin-jl-to-display-plots-with-literate-jl/62025 "2021-05-28T23:32:37Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mattgiamou](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattgiamou/32/25111_2.png) [@mattgiamou](https://discourse.julialang.org/u/mattgiamou)
#### Post date: [May 28, 2021, 11:32pm UTC](https://discourse.julialang.org/t/getting-franklin-jl-to-display-plots-with-literate-jl/62025/1 "2021-05-28T23:32:37Z")

</div>

I’m following [these instructions](https://franklinjl.org/code/literate/) on getting Franklin.jl to deploy Julia notebooks with Literate.jl with GitHub pages. I’m using the following minimal example from the [Literate.jl documentation](https://fredrikekre.github.io/Literate.jl/v2.0/generated/example/#Output-Capturing-1):

```julia
# Testing plot display:
x = range(0, stop=6π, length=1000)
y1 = sin.(x)
y2 = cos.(x)
plot(x, [y1, y2])

```

Instead of displaying the plot on my site, I get the following output:

```julia
Plot{Plots.GRBackend() n=2}

```

Everything else is working fine - I’m using `@def showall = true`, and blocks that end with non-plotting commands display the correct output.

Please let me know if I’ve fundamentally misunderstood something! This is my first post on Discourse, so I appreciate your patience and help.

---

<div class="post-metadata">

### Author: ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)
#### Post date: [June 1, 2021, 8:06am UTC](https://discourse.julialang.org/t/getting-franklin-jl-to-display-plots-with-literate-jl/62025/2 "2021-06-01T08:06:03Z")

</div>

Hello @mattgiamou , apologies for not responding earlier.

For plots, Franklin can work with physical files (actual .jpeg or .png or whatever). So you just need to save your plot and point to it.

What happens in your case is that Franklin applies a basic ‘show’ method to the last object, and in this case it just shows the name of the object. There could be a fallback detecting the MIME type of the object and trying to display a PNG rendered version of the plot but it’s not there yet.

### What you have to do now

add a couple of lines of code to save the figure explicitly and then load that image.

Here’s an example of how you could do this:

[https://github.com/alan-turing-institute/DataScienceTutorials.jl/blob/702bf83f293a13ca5eedf31cefb4686fe4bb64d7/\_literate/EX-boston-lgbm.jl#L46-L53](https://github.com/alan-turing-institute/DataScienceTutorials.jl/blob/702bf83f293a13ca5eedf31cefb4686fe4bb64d7/_literate/EX-boston-lgbm.jl#L46-L53)

the ‘output’ macro is there to help you get an automatic path for saving files. You don’t have to use it and could use an explicit path yourself if you preferred.

---

<div class="post-metadata">

### Author: ![mattgiamou](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattgiamou/32/25111_2.png) [@mattgiamou](https://discourse.julialang.org/u/mattgiamou)
#### Post date: [June 1, 2021, 2:39pm UTC](https://discourse.julialang.org/t/getting-franklin-jl-to-display-plots-with-literate-jl/62025/3 "2021-06-01T14:39:22Z")

</div>

Thank you for the prompt and detailed response @tlienart! Franklin is fantastic software, can’t wait to continue playing around with it.

---

<div class="post-metadata">

### Author: ![mikeliux](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikeliux/32/35170_2.png) [@mikeliux](https://discourse.julialang.org/u/mikeliux)
#### Post date: [January 29, 2025, 9:18am UTC](https://discourse.julialang.org/t/getting-franklin-jl-to-display-plots-with-literate-jl/62025/4 "2025-01-29T09:18:22Z")

</div>

> [@tlienart](#):
>
> Here’s an example of how you could do this:
> 
> [https://github.com/alan-turing-institute/DataScienceTutorials.jl/blob/702bf83f293a13ca5eedf31cefb4686fe4bb64d7/\_literate/EX-boston-lgbm.jl#L46-L53](https://github.com/alan-turing-institute/DataScienceTutorials.jl/blob/702bf83f293a13ca5eedf31cefb4686fe4bb64d7/_literate/EX-boston-lgbm.jl#L46-L53)

Sadly, the link is broken now.

---

<div class="post-metadata">

### Author: ![Cena](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cena/32/215701_2.png) [@Cena](https://discourse.julialang.org/u/Cena)
#### Post date: [March 10, 2025, 5:06pm UTC](https://discourse.julialang.org/t/getting-franklin-jl-to-display-plots-with-literate-jl/62025/5 "2025-03-10T17:06:55Z")

</div>

Looks like it’s here now:

[https://github.com/JuliaAI/DataScienceTutorials.jl/blob/master/\_literate/end-to-end/boston-lgbm/tutorial.jl](https://github.com/JuliaAI/DataScienceTutorials.jl/blob/master/_literate/end-to-end/boston-lgbm/tutorial.jl)

possibly around lines 67-73.
