Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
This repository was archived by the owner on Aug 27, 2026. It is now read-only.

(some PDF viewers) Orca using plotly.js > 1.49.5 creates thin lines for bars with 0 length #345

Description

@michaelbabyn

0-length bars are visible in pdfs generated by Orca even though they aren't visible in the plotly.js graphs.

image001

I can reproduce this issue using orca directly using this method with the below json figure.

{"data": [{"y": ["This", "is", "a", "test", "placeholder"], "x": [12, 9, 15, 12, 0], "type": "bar", "orientation": "h"}], "layout": {"xaxis": {"type": "categorical", "showgrid": false, "zeroline": false}, "yaxis": {"title": "test", "zeroline": false}}}

Activity

  1. michaelbabyn commented on Aug 17, 2020

    @michaelbabyn
    Author

    Note that the issue doesn't appear when I look at the pdf using Ubuntu's built in document viewer but it does appear when I open the PDF in chrome.

    fig.pdf

  2. cldougl commented on Aug 19, 2020

    @cldougl
    Member

    cc @plotly/product

  3. nicolaskruchten commented on Aug 20, 2020

    @nicolaskruchten
    Contributor

    @antoinerg can you take a look plz?

  4. changed the title [-]Orca using plotly.js > 1.49.5 creates thin lines for bars with 0 length[/-] [+](some PDF viewers) Orca using plotly.js > 1.49.5 creates thin lines for bars with 0 length[/+] on Aug 20, 2020
  5. archmoj commented on Aug 20, 2020

    @archmoj

    The v1.49.5 changelog is here: https://github.com/plotly/plotly.js/releases/tag/v1.49.5
    What is the last plotly.js version that this works fine? Is that v1.49.4?

  6. michaelbabyn commented on Aug 20, 2020

    @michaelbabyn
    Author

    @archmoj 1.49.5 works and 1.50.0 is the first version that fails

  7. archmoj commented on Aug 20, 2020

    @archmoj

    Is this only problematic when the zero bars are on sides of the graph, not in the middle?

  8. michaelbabyn commented on Aug 20, 2020

    @michaelbabyn
    Author

    When the zero bars are in the middle on 1.50.0, the line appears before saving the chart to a PDF https://codepen.io/michaelbabyn/pen/xxVRbjY

  9. michaelbabyn commented on Aug 20, 2020

    @michaelbabyn
    Author

    Note that I can reproduce the issue by printing the page to PDF using chrome if that makes debugging easier

  10. archmoj commented on Aug 20, 2020

    @archmoj
  11. antoinerg commented on Aug 20, 2020

    @antoinerg
    Collaborator

    Thanks @michaelbabyn for the clear description of the issue and the Codepen to reproduce the issue! Thanks @archmoj for the references!

    The reason why plotly.js puts a bar with a width of 0 is to properly support transitions. We can't transition a bar from being non-existent to having a finite value. Anyway, that's the conclusion I reached when introducing plotly/plotly.js#4180.

    It looks like a Chromium bug to me that rectangles with zero width would appear in its PDF output. Anyway, I think we could and should fix this in plotly.js since it will affect any Chromium user printing web pages and not just Orca users.

  12. antoinerg commented on Sep 8, 2020

    @antoinerg
    Collaborator

    I tried to extract the ghost SVG element from a plotly.js figure and put it into a Codepen in order to reproduce the issue: https://codepen.io/antoinerg/full/MWyvQWx . I was hoping to see a thin line when printing to PDF but alas, the rendering there is OK. I'm not sure what makes Chromium to render thin lines when printing plotly.js figure to PDF 😕

  13. antoinerg commented on Nov 20, 2020

    @antoinerg
    Collaborator
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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions