# Questions: Gadfly and Cairo, Fontconfig

**URL:** https://discourse.julialang.org/t/questions-gadfly-and-cairo-fontconfig/26016
**Category:** General Usage
**Tags:** question, plotting
**Created:** [July 4, 2019, 4:43pm UTC](https://discourse.julialang.org/t/questions-gadfly-and-cairo-fontconfig/26016 "2019-07-04T16:43:21Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![sungjae](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sungjae](https://discourse.julialang.org/u/sungjae)
#### Post date: [July 4, 2019, 4:43pm UTC](https://discourse.julialang.org/t/questions-gadfly-and-cairo-fontconfig/26016/1 "2019-07-04T16:43:21Z")

</div>

It seems that this topic was discussed before, but I could not find an answer. I am using Julia 1.1.1.

I am trying to produce histograms by using Gadfly, but once I load up Cario and Fontconfig, the plot command stops working. Here are some examples.

Example 1:  
using RDatasets, Gadfly  
plot(dataset(“ggplot2”, “diamonds”), x=“Price”, color=“Cut”, Geom.histogram)

This works fine. No problem arises.

Example 2:  
using Cairo, Fontconfig  
using RDatasets, Gadfly  
eg = plot(dataset(“ggplot2”, “diamonds”), x=“Price”, color=“Cut”, Geom.histogram)  
draw(PDF(“eg.pdf”, 4inch, 4inch), eg)

Example 2 does not work. Has anybody encountered this problem before? Is there a solution?

Thank you very much.

Best,  
SJ

---

<div class="post-metadata">

### Author: ![sungjae](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sungjae](https://discourse.julialang.org/u/sungjae)
#### Post date: [July 4, 2019, 5:35pm UTC](https://discourse.julialang.org/t/questions-gadfly-and-cairo-fontconfig/26016/2 "2019-07-04T17:35:14Z")

</div>

Something strange about Example 2.

When I run this in REPL, I get an error message. If I save it as ``test.jl,‘’ and run it, it seems to work. I am very puzzled… Please help…

---

<div class="post-metadata">

### Author: ![Rob\_van\_Weelderen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rob_van_weelderen/32/7621_2.png) [@Rob\_van\_Weelderen](https://discourse.julialang.org/u/Rob_van_Weelderen)
#### Post date: [July 4, 2019, 8:00pm UTC](https://discourse.julialang.org/t/questions-gadfly-and-cairo-fontconfig/26016/3 "2019-07-04T20:00:46Z")

</div>

There’s a suggestion from a collaborator of mine who encounters a similar problem to swap:

`using Cairo, Fontconfig` to  
`using Fontconfig, Cairo`

In the first case it breaks with a kind of `unsafe_wrap` error, whereas in the second case there are only some complaining messages, but everything does functions.

Good luck,  
Rob.

---

<div class="post-metadata">

### Author: ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)
#### Post date: [July 4, 2019, 8:57pm UTC](https://discourse.julialang.org/t/questions-gadfly-and-cairo-fontconfig/26016/4 "2019-07-04T20:57:56Z")

</div>

Also, in [Pkg mode](https://julialang.github.io/Pkg.jl/v1/managing-packages/#Adding-registered-packages-1) do:

`add Compose#master`

Since I think these issues have been fixed on the master branch of Compose.jl (the graphics package used by Gadfly).

---

<div class="post-metadata">

### Author: ![sungjae](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sungjae](https://discourse.julialang.org/u/sungjae)
#### Post date: [July 4, 2019, 9:49pm UTC](https://discourse.julialang.org/t/questions-gadfly-and-cairo-fontconfig/26016/5 "2019-07-04T21:49:20Z")

</div>

Thanks!

---

<div class="post-metadata">

### Author: ![sungjae](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sungjae](https://discourse.julialang.org/u/sungjae)
#### Post date: [July 4, 2019, 9:50pm UTC](https://discourse.julialang.org/t/questions-gadfly-and-cairo-fontconfig/26016/6 "2019-07-04T21:50:15Z")

</div>

Thank you!
