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

geom_bar does not support negative values #64

Closed
ghost opened this issue Apr 18, 2020 · 2 comments
Closed

geom_bar does not support negative values #64

ghost opened this issue Apr 18, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Apr 18, 2020

Issue:

geom_bar does not support plotting with negative heights. Instead, bars with negative heights are rendered as having zero height.

Example:

import ggplotnim

let trials = @["A", "B", "C", "D", "E"]
let values = @[1.0, 0.5, 0, -0.5, -1.0]

var df = newDataFrame()
df["Trial"] = toColumn(trials)
df["Value"] = toColumn(values)

ggplot(df, aes(x="Trial", y="Value")) + 
  geom_bar(stat="identity", position="identity") + 
  ggsave("demo.png")

An equivalent with R/ggplot would produce produce a bar plot with five bars, the first two extending above the x axis, the third sitting on it, and the last two below. However, this snippet instead produces this:

Not right

@Vindaar
Copy link
Owner

Vindaar commented Apr 18, 2020

Fixed by #65. I turned your example into a recipe here:

https://github.com/Vindaar/ggplotnim/blob/allowNegBars/recipes.org#bar-plot-with-negative-values

@Vindaar
Copy link
Owner

Vindaar commented Apr 18, 2020

#65 is merged, closing this.

@Vindaar Vindaar closed this as completed Apr 18, 2020
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

No branches or pull requests

1 participant