Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error running first example of the tutorial: wrong local file association ? #1456

Closed
kforner opened this issue Jun 15, 2020 · 4 comments
Closed

Comments

@kforner
Copy link

kforner commented Jun 15, 2020

I just installed julia 1.4.2 using the linux binaries provided by https://julialang.org/downloads/
then I installed Gadfly and RDatasets using the pkg shell (add Gadfly, add RDatasets).

When I run this code:

using Gadfly
using RDatasets
# takes a long... time
iris = dataset("datasets", "iris")

plot(iris, x=:SepalLength, y=:SepalWidth, Geom.point)

Then I have an image view app that pops up with an error like:

Could not load image “jl_X6LoVH.html”.
Error domain 1 code 76 on line 6 column 10 of file:///tmp/jl_X6LoVH.html: Opening and ending tag mismatch: meta line 0 and head

I guess the error makes sense if the image viewer parses a html file instead of an image.

My questions:

  • am I the only one getting this ?
  • is this a local problem with file association ?
  • any hint of solving it ?

Thanks.
Karl

@Mattriks
Copy link
Member

Does saving to a file work? e.g.

p = plot(iris, x=:SepalLength, y=:SepalWidth, Geom.point)
draw(PNG("iris1.png"), p)
draw(PDF("iris1.pdf"), p)
draw(SVG("iris1.svg"), p)

Does this show an error? e.g.

p = plot(iris, x=:SepalLength, y=:SepalWidth, Geom.point)
draw(PNG(), p)

@kforner
Copy link
Author

kforner commented Jun 16, 2020

draw(PNG("iris1.png"), p)

ERROR: The Cairo and Fontconfig packages are necessary for saving as PNG.
Add them with the package manager if necessary, then run import Cairo, Fontconfig before invoking PNG.

draw(PDF("iris1.pdf"), p)

ERROR: The Cairo and Fontconfig packages are necessary for saving as PDF.
Add them with the package manager if necessary, then run import Cairo, Fontconfig before invoking PDF.

draw(SVG("iris1.svg"), p)

This works but the image has a transparent background

draw(PNG(), p)

ERROR: The Cairo and Fontconfig packages are necessary for saving as PNG.
Add them with the package manager if necessary, then run import Cairo, Fontconfig before invoking PNG.

installing Cairo fixes the above errors.
The Pdf has a non-transparent background.

draw(PNG(), p)

Compose.Image{Compose.PNGBackend}(IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=47965, maxsize=Inf, ptr=47966, mark=-1), Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000000000000, 535.0, 378.0), Cairo.CairoContext(Ptr{Nothing} @0x0000000000000000, Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000000000000, 535.0, 378.0), Ptr{Nothing} @0x000000000533b170), 534.5059133378628, 377.9527559055118, RGBA{Float64}(0.0,0.0,0.0,0.0), RGBA{Float64}(0.0,0.0,0.0,1.0), Float64[], Compose.LineCapButt(), Compose.LineJoinMiter(), true, 0.3mm, 3.880555555555555mm, "Helvetica Neue,Helvetica,Arial,sans", nothing, false, Compose.ImagePropertyState[], Compose.ImagePropertyFrame[], Dict{Type,Union{Nothing, Compose.Property}}(), true, false, nothing, true, true, 3.7795275590551185, nothing, nothing)

@Mattriks
Copy link
Member

Yes I should have added import Cairo, Fontconfig (which is necessary for png, pdf). You can control the background using the options in Theme. Type ?Theme or see the Theme section.

Not sure what your original error is due to. If you can save to a file, then it seems to be a local system issue about your default display software. You might try the suggestion in this Julia discourse post.

@kforner
Copy link
Author

kforner commented Jun 16, 2020

ok thanks

@kforner kforner closed this as completed Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants