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

add sign detection for negative traces #118

Merged
merged 1 commit into from
Feb 26, 2024
Merged

add sign detection for negative traces #118

merged 1 commit into from
Feb 26, 2024

Conversation

jd-lara
Copy link
Member

@jd-lara jd-lara commented Feb 17, 2024

Creates a group to handle the negative values separately

Copy link

codecov bot commented Feb 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8060e16) 88.49% compared to head (b0958b1) 88.62%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #118      +/-   ##
==========================================
+ Coverage   88.49%   88.62%   +0.13%     
==========================================
  Files           6        6              
  Lines         339      343       +4     
==========================================
+ Hits          300      304       +4     
  Misses         39       39              
Flag Coverage Δ
unittests 88.62% <100.00%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/plotly_recipes.jl 97.43% <100.00%> (+0.13%) ⬆️

if stack
plot_kwargs[:stackgroup] = string(plot_length + 1)
plot_kwargs[:stackgroup] = string(plot_length + 1 + sign_group)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I fully understand this line. I get that we want the negative and non-negative data to go in different groups and that adding sign_group achieves that, but why are we naming the groups based on plot_length, and why the magic number sign_group = 10?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a 10 is such that is still compatible with the other uses of plot data frames.

@@ -94,7 +100,7 @@ function _dataframe_plots_internal(
layout_kwargs[:xaxis] =
Plots.PlotlyJS.attr(; showticklabels = !bar, title = "$time_interval")
layout_kwargs[:title] = "$title"
layout_kwargs[:barmode] = stack ? "stack" : "group"
layout_kwargs[:barmode] = stack ? "relative" : "group"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't object to this change, but my test stacked plot with negative data looks the same before vs. after. In what situation does this give a different-looking plot?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when generation is negative. That's the use case

@jd-lara jd-lara merged commit 34d1509 into main Feb 26, 2024
7 checks passed
@jd-lara jd-lara deleted the jd/negative_values branch July 10, 2024 19:40
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.

2 participants