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

SVG output broken #696

Merged
merged 1 commit into from Feb 7, 2012
Merged

SVG output broken #696

merged 1 commit into from Feb 7, 2012

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Feb 7, 2012

SVG output is broken, as validated through http://validator.w3.org/#validate_by_upload
e.g. run the following and upload the output, and the id's on elements are used multiple times:

from matplotlib.figure import Figure
from matplotlib.backends.backend_svg import FigureCanvasSVG

def get_series():
    yield [2.5, 1.5, 0.5], [1.1, 2.1, 3.1], dict(color='b', hatch='|')
    yield [2.6, 1.6, 0.6], [1.2, 2.2, 3.2], dict(color='r', hatch='|')

def do_chart(file):
    fig = Figure(facecolor='#FFFFFF')
    canvas = FigureCanvasSVG(fig)
    ax = fig.add_subplot(1, 1, 1)
    for xs, ys, attributes in get_series():
        ax.barh(xs, ys, 0.1, **attributes)
    canvas.print_figure(from_file)

if __name__ == '__main__':
    from_file = r"C:\temp\prob.svg"
    do_chart(from_file)

@mdboom
Copy link
Member

mdboom commented Feb 7, 2012

This pull request seems to resolve this issue. Can you please test, if possible?

@ruidc
Copy link
Author

ruidc commented Feb 7, 2012

Confirmed fixed for this scenario, I do have another where the following still fails validation:

required attribute "d" not specified
      <path id="Taz-SemiLight-20"/>

but this will take quite a while to produce a reduced test case.

mdboom added a commit that referenced this pull request Feb 7, 2012
@mdboom mdboom merged commit 9c676df into matplotlib:v1.1.x Feb 7, 2012
@mdboom mdboom deleted the svg-duplicate-ids branch March 3, 2015 18:44
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

Successfully merging this pull request may close these issues.

None yet

2 participants