Skip to content

Conversation

mwaskom
Copy link
Owner

@mwaskom mwaskom commented Jul 5, 2022

A few tweaks here:

  • Skip bars with 0 height
  • Add sticky edges to clamp the axis limits at the bottom of the bar
  • Clip the bar artist to avoid edges extending beyond the bar extent

The third tweak is the most interesting think here, although I am somewhat concerned it will cause problems in the future and I am thinking of it as an experimental solution for now. The idea is to avoid the effect that you get at the interface of dodged or stacked bars with nontrivial edge widths:

so.Plot(tips, "time", color="sex").add(so.Bar(edgewidth=5, fill=False), so.Hist(), so.Dodge())

Old:
image

New:
image

One aspect of the implementation that I don't love is the need to double the internal linewidth and half the dashes (when present). That could cause some unpleasant surprises when working with the artists directly, but I am not certain how to work around it.

@codecov
Copy link

codecov bot commented Jul 6, 2022

Codecov Report

Merging #2889 (5871f83) into master (d708840) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2889      +/-   ##
==========================================
+ Coverage   98.15%   98.19%   +0.03%     
==========================================
  Files          69       69              
  Lines       22406    22435      +29     
==========================================
+ Hits        21993    22030      +37     
+ Misses        413      405       -8     
Impacted Files Coverage Δ
seaborn/_marks/bars.py 100.00% <100.00%> (ø)
tests/_marks/test_bars.py 100.00% <100.00%> (+12.69%) ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant