Questions: Gadfly and Cairo, Fontconfig

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.


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…

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,

Also, in Pkg mode 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).


Thank you!