Skip to content

[CDD] Crossbars are plotted out of order #89

Description

@pedroilidio

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)

Activity

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions