google-research / rliable

[NeurIPS'21 Outstanding Paper] Library for reliable evaluation on RL and ML benchmarks, even with only a handful of seeds.
https://agarwl.github.io/rliable
Apache License 2.0
747 stars 46 forks source link

Fix vertical alignement of y labels #21

Closed qgallouedec closed 7 months ago

qgallouedec commented 10 months ago

There's a slight shift in the position of the y-axis labels. This is all the more apparent when the size of the figures is reduced.

This PR fixes this.

Before: before

After: after

To reproduce:

from rliable import library as rly
from rliable import metrics
from rliable import plot_utils
import numpy as np

# Set the seed
np.random.seed(0)

# Pairs of normalized score matrices for pairs of algorithms we want to compare
algo_pairs = {
    "Algo A,Algo B": (np.random.rand(100, 5), np.random.rand(100, 5)),
    "Algo C,Algo D": (np.random.rand(100, 5), np.random.rand(100, 5)),
}
average_probabilities, average_prob_cis = rly.get_interval_estimates(algo_pairs, metrics.probability_of_improvement, reps=10)
ax = plot_utils.plot_probability_of_improvement(average_probabilities, average_prob_cis, figsize=(3, 1))

# Save the figure with tight bounding box
ax.figure.savefig("after.png", bbox_inches="tight")
araffin commented 7 months ago

@agarwl would it be possible to review/merge and release a new version of rliable?

I have experienced the same issue in the past but I'm glad @qgallouedec found a solution (I only used a hack on my side).

agarwl commented 7 months ago

Done.

araffin commented 7 months ago

thanks =)