Skip to content

pyplot.errorbar attempts to plot 0 on a log axis in SVGs #6563

Closed

Description

@BrianLandry

pyplot.errorbar will attempt to plot a 0 point errorbar on a log axis when saving as a SVG, despite 0 not existing on a log axis. Although the SVG will be visualized correctly by chrome ect., it will crash inkscape, and be unable to be moved in illustrator. This can be accomplished with the following code

import matplotlib.pyplot as plt
plt.errorbar([0,1],[2,3],([0.5, 0.5],[0.5, 0.5]))
plt.xscale('log')
plt.savefig('example.svg')

This will generate a SVG with the following line:

<path clip-path="url(#p8e1df78064)" d="M -116021015.957275 252 
" style="fill:none;stroke:#0000ff;"/>

Where I think the " -116021015.957275" value is an attempt to plot at the 0 point on the log axis, which does not exist. Removing the zero point alleviates the reported problems

This was done in Windows 10, Python 2.7.11, Matplotlib 1.5.1, installed via Anaconda 4.0.0

Edit: This also appears to be an issue with pyplot.plot. However, for some pyplot.plot plots I do not get errors when working with some of them in illustrator, but regardless, they all still contain the highly negative location value in their XML.

Activity

  1. tacaswell commented on Jun 10, 2016

    @tacaswell
    Member

    Do pngs render correctly?

  2. added this to the milestone on Jun 10, 2016
  3. BrianLandry commented on Jun 10, 2016

    @BrianLandry
    Author

    Yes. SVGs even render correctly when viewed in chrome or IPython notebook.
    The bug only has consequence when vector editors try to work the the SVGs

    On Thu, Jun 9, 2016, 9:49 PM Thomas A Caswell notifications@github.com
    wrote:

    Do pngs render correctly?

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub
    #6563 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe/ACT_ZeP23aGmJE1D-V_tiJ7jqWCy8VHOks5qKNCtgaJpZM4Ixk4Q
    .

  4. tacaswell commented on Jun 10, 2016

    @tacaswell
    Member

    Can you try the 2.0.0b1 or 1.5.1rc2 release (conda install matplotlib -c conda-forge -c conda-forge/label/rc)? There was some work done on clipping with large numbers + vector backends (driven by pdf issues, but #5911).

  5. BrianLandry commented on Jun 12, 2016

    @BrianLandry
    Author

    I used your command to install maptlotlib 2.0.0b1. This appeared to address this issue. I could no longer find the extreme value in the SVG xml and the svg functioned correctly when loaded into illustrator suggesting that the problem was fixed.

    Thanks for the support! Feel free to close the issue.

  6. tacaswell commented on Jun 12, 2016

    @tacaswell
    Member

    Closed by #5911 .

  7. tacaswell commented on Jun 12, 2016

    @tacaswell
    Member

    @BrianLandry Thank you for reporting this bug and following up to check if it was already fixed. We really do greatly appreciate both of those things!

  8. modified the milestones: , on Jul 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions