GiovineItalia / Compose.jl

Declarative vector graphics
http://giovineitalia.github.io/Compose.jl/latest/
Other
248 stars 81 forks source link

Missing MIME type? #20

Open chrism0dwk opened 11 years ago

chrism0dwk commented 11 years ago

Hi,

I think I may have found a bug in Compose when using the D3 backend with a Gadfly plot. MacOSX, Julia-0.2-pre, Gadfly 0.1.5, and Compose 0.1.4.

Steps to reproduce:

julia> p = plot(iris, x="Sepal.Length", y="Sepal.Width", Geom.point) julia> draw(D3(6inch, 4inch), p) WARNING: Unable to emit data of type Emitable in emit at /Users/stsiab/.julia/Compose/src/Compose.jl:406

Digging around in the source code, I see that "image/svg+xml" MIME type is added to the 'emitters' Dict at Compose.jl:422. However, inserting a diagnostic print statement into the emit(x::Emitable) function shows the requested MIME type to be "application/javascript".

I notice that the "application/javascript" MIMEtype is set in d3.jl:162. Is this correct?

Cheers,

Chris

dcjones commented 11 years ago

The correct behavior draw(D3(6inch, 4inch), p) from the repl is to open a browser pointed at the graphic, but I haven't finished implementing that for the D3 backend. I have something a little more fancy in mind that I'm working on.

In the mean time, you can write output to a file like draw(D3("output.js", 6inch, 4inch), p), or view the plot from the repl with the SVG backend draw(SVG(6inch, 4inch), p).

chrism0dwk commented 11 years ago

On 5/07/2013, at 9:07 AM, Daniel Jones notifications@github.com wrote:

The correct behavior draw(D3(6inch, 4inch), p) from the repl is to open a browser pointed at the graphic, but I haven't finished implementing that for the D3 backend. I have something a little more fancy in mind that I'm working on.

In the mean time, you can write output to a file like draw(D3("output.js", 6inch, 4inch), p), or view the plot from the repl with the SVG backend draw(SVG(6inch, 4inch), p).

Hi Daniel,

Sounds great! Thanks for the info, and shout if you want me to test it out.

Cheers,

Chris