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

tspan in svg output is malformated #1625

Open
JohannesNaegele opened this issue Sep 11, 2023 · 5 comments
Open

tspan in svg output is malformated #1625

JohannesNaegele opened this issue Sep 11, 2023 · 5 comments

Comments

@JohannesNaegele
Copy link

In my use case every occurence of <tspan>text</tspan> in the svg output is malformated as </tspan>text</tspan> (observe the additional /).

The full code can be found here.

@bjarthur
Copy link
Member

is the extra backslash causing the plot to be rendered incorrectly?

would be much easier to help if you boiled the full code down to a simpler example that didn't depend on your package. your OS, julia version, Gadfly and Compose version would help too.

@JohannesNaegele
Copy link
Author

JohannesNaegele commented Sep 12, 2023

Apparently the arguments Scale.x_log10, Scale.y_log10 break the output. This example from the docs gives malformated output if I use the log10 scale:

D = DataFrame(x=[0.5,1], y=[0.5,1], x1=[0,0.5], y1=[0,0.5], x2=[1,1.5], y2=[1,1.5])
pb = plot(D, xmin=:x1, ymin=:y1, xmax=:x2, ymax=:y2, Geom.rect, Scale.x_log10, Scale.y_log10);

draw(SVG("./foo.svg", 20cm, 20cm), pb)

The extra backslash makes the svg unreadable.

@JohannesNaegele
Copy link
Author

Additional info: I am using [c91e804a] Gadfly v1.4.0 and

julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M2
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 1 on 4 virtual cores
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 1

@bjarthur
Copy link
Member

i can reproduce only if i import Cairo, Fontconfig, which is not needed for SVG output.

@JohannesNaegele
Copy link
Author

i can reproduce only if i import Cairo, Fontconfig, which is not needed for SVG output.

Good catch! MWE:

using Gadfly
using DataFrames
import Cairo, Fontconfig

D = DataFrame(x=[0.5,1], y=[0.5,1], x1=[0,0.5], y1=[0,0.5], x2=[1,1.5], y2=[1,1.5])
pb = plot(D, xmin=:x1, ymin=:y1, xmax=:x2, ymax=:y2, Geom.rect, Scale.x_log10, Scale.y_log10);

draw(SVG("./foo.svg", 20cm, 20cm), pb)

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