GiovineItalia / Gadfly.jl

Crafty statistical graphics for Julia.

Home Page:http://gadflyjl.org/stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

using Fontconfig shrinks plot window relative to axes

nathanrboyer opened this issue · comments

This works fine.

julia> using Gadfly
julia> plot(Geom.line, x=1:3, y=1:3)

image

This does not.

julia> using Gadfly, Cairo, Fontconfig
julia> plot(Geom.line, x=1:3, y=1:3)

image

The problem becomes worse for more complex examples. The plot in this discourse thread becomes unreadable, and using draw(PNG("Test.png", 6inch, 4inch), p) just further shrinks the plot.

I get the same output behavior running in Pluto, WSL terminal, and VSCode on Windows 11 using the newest version of all packages:

  • Julia: 1.7.2
  • Gadfly: 1.3.4
  • Cairo: 1.0.5
  • Fontconfig: 0.4.0

by "this does not" work, are you referring to the rotated x-axis labels? if so, try adding Guide.xticks(orientation=:horizontal).

if you're referring to the size of the plot changing, as in the discourse thread, then i'm not sure that's a Gadfly problem per se as if i save the plot to a file and then it looks fine. so pluto / vscode is probably wrapping the HTML in a weird way. see #1561

I am referring to the plot's size and distance from the axis labels. I see the same issue whether I save the plot to a file or view it as html.
Test

i still can't reproduce. me being on Gadfly master and julia 1.7.1 are the only differences. i'm on mac osx.
tried saving to PDF, SVG, PNG, PS and they all look fine.

To reiterate, the problem only appears immediately after adding the Fontconfig package.

  • If I only using Gadfly, then I can plot and save to SVG without any issues.
  • using Gadfly, Cairo also behaves normally.
  • using Gadfly, Cairo, Fontconfig produces the weird plot dimensions above no matter where I render or how I save the plots.

I imagine I should raise an issue with Fontconfig.jl, but I don't know what to say is wrong or how it interfaces with Gadfly.

what OS are you using?

Windows 11

The same problem here!

Root cause was found in duplicate issue #1587, so I am closing this one. Temporary workaround is to pin a dependency of Cairo.jl to an older version.

]add Pango_jll
]pin Pango_jll@1.42.4

I confirm with additional testing that Pango_jll@1.42.4 is needed. However, Pango_jll@1.47.0 and Pango_jll@1.50.0 fail!

]pin Pango_jll@1.42.4

I do not think this issue has been resolved.

@nathanrboyer have you found a solution to this problem? Other than using on old version of Pango_jll?

No, I stopped using Gadfly because of it. I only closed this issue because yours (#1587) is a duplicate, and there should not be two separate issues tracking the same problem. I haven't seen any indication that anyone has worked on this problem; presumably none of the current maintainers use Windows.