How do I resolve LoadError while trying to make a png on Windows using Julia Studio and Gadfly?

281 Views Asked by At

I'm currently working through this tutorial and I'm having trouble getting the png image to display. This is my program.

using DataFrames
using Gadfly

train_df = readtable("winequality-red.csv", separator=';')

_, count = hist(train_df["quality"])
class = sort(unique(train_df["quality"]))
value_counts = DataFrame(count=count, class=class)
#value_counts

p = plot(value_counts, x="class", y="count", Geom.bar(), Guide.title("Class distributions (\"quality\")"))
draw(PNG(14cm, 10cm), p)

the error I get is

LoadError("C:/Users/John/Desktop/helloworld.jl",12,MethodError(PNG,(140.0mm,100.0mm)))

I've tried some of the things mentioned in this discussion, however I haven't made any observable progress.

1

There are 1 best solutions below

1
John On

I was able to solve my problem by installing Cairo.

Pkg.add("Cairo")

and changing this line

draw(PNG(14cm, 10cm), p)

to

draw(PNG("chart.png", 14cm, 10cm), p)

and then opening chart.png with Julia Studio

enter image description here