GiovineItalia / Gadfly.jl

Crafty statistical graphics for Julia.

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tspan in svg output is malformated

JohannesNaegele opened this issue · comments

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.

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.

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.

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

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

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)