Skip to content

Commit

Permalink
fixing up ticks and margins
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcfee committed May 9, 2024
1 parent 7390d25 commit 712d84d
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions mir_eval/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ def segments(

if new_axes:
ax.set_ylim([0, 1])
ax.set_yticks([])
# Very small positive number here to preserve ticks
ax.margins(x=1e-3, y=0, tight=None)

# Infer height
if base is None:
Expand All @@ -162,7 +165,7 @@ def segments(
continue

# style = next(cycler)
_bar = ax.bar([0], [0], visible=False)
_bar = ax.bar([0.5], [0.5], visible=False)
style = {
k: v
for k, v in _bar[0].properties().items()
Expand Down Expand Up @@ -191,14 +194,6 @@ def segments(
)
ann.set_clip_path(rect)

if new_axes:
ax.set_yticks([])
ax.set_xlim(intervals.min(), intervals.max())

# Only expand if we have data
if intervals.size:
__expand_limits(ax, [intervals.min(), intervals.max()], which="x")

return ax


Expand Down Expand Up @@ -342,6 +337,10 @@ def labeled_intervals(
ax.set_yticklabels(ticks, va="bottom")
ax.yaxis.set_major_formatter(IntervalFormatter(base, ticks))

if new_axes:
# Very small positive number here to preserve ticks
ax.margins(x=1e-3, y=0, tight=None)

if base.size:
__expand_limits(ax, [base.min(), (base + height).max()], which="y")
if intervals.size:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline_images/test_display/test_display_segment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline_images/test_display/test_display_segment_text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline_images/test_display/test_display_separation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 712d84d

Please sign in to comment.