Skip to content

Bar Plots and Negative Values #461

@bclehmann

Description

@bclehmann

Describe the bug
Bar Plots do not play nice with negative values:

  • Unless panned/zoomed, the plot will only show y values >0 (Quadrant 1, assuming non-negative x-values)
    image
  • Error bars are drawn from the topmost point, which for negative values is 0
    image

Negative values on bar plots are atypical, but I was looking at making waterfall charts:
image

You might recognize waterfall charts as a generalization of a Gantt chart:
image

I will probably work on this sometime soon-ish. I noticed it because I was thinking about implementing waterfall charts as bar charts with an extra std::shared_ptr<double> offsets parameter, but the handling of negative values put a damper on things.

To Reproduce
Create a bar plot with negative y values.

//xs, ys, yError
var barPlot = plt.PlotBar(new double[]{1,2,3}, new double[]{1,0,-1}, new double[]{1,1,1});

Screenshots
I embedded them in the list :/

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUGunexpected behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions