Skip to content

[CDD] Crossbars are plotted out of order #89

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

Open
pedroilidio opened this issue Apr 17, 2025 · 0 comments
Open

[CDD] Crossbars are plotted out of order #89

pedroilidio opened this issue Apr 17, 2025 · 0 comments
Assignees
Labels

Comments

@pedroilidio
Copy link

This was one of the bugs pointed out in #87. I'll modify #87 to also solve this issue.

Description:

The points composing the crossbars are not plotted in order, causing lines to be drawn back and forth. This is visible when setting a non-contigous linestyle or when the color is not fully opaque.

Current behavior:

Image

Expected behavior:

Image

To Reproduce:

Run the following script with PYTHONHASHSEED=3 python issue89.py (since we use sets to represent the crossbars, the order of points is dependent on the internal seed for the Python hashing).

# filename: issue89.py
import numpy as np
import matplotlib.pyplot as plt
from pandas import DataFrame, Series

from scikit_posthocs import critical_difference_diagram

n = 10
rng = np.random.default_rng(0)

index = np.arange(n).astype(str)
ranks = Series(rng.uniform(size=n), index=index)
sig_matrix = DataFrame(1, index=index, columns=index)

plt.figure(figsize=(5, 2))
output = critical_difference_diagram(
    ranks,
    sig_matrix,
    crossbar_props={"marker": "o", "linestyle": ":", "alpha": 0.5, "linewidth": 5},
)
plt.tight_layout()
plt.savefig("issue89.png")
for level in output["crossbars"]:
    for bar in level:
        bar.set_xdata(sorted(bar.get_xdata()))
plt.savefig("issue89_solved.png")

System and package information (please complete the following information):

  • OS: Windows 11, x86_64
  • Package version: (e.g. 0.11.4)
pedroilidio added a commit to pedroilidio/scikit-posthocs that referenced this issue Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants