mwaskom / seaborn

Statistical data visualization in Python
https://seaborn.pydata.org
BSD 3-Clause "New" or "Revised" License
12.63k stars 1.93k forks source link

seaborn.objects.Plot.theme unexpected yaxis behavior in 0.13 #3659

Open cwberardi opened 8 months ago

cwberardi commented 8 months ago

I'm having an issue in 0.13.2 with y-axis formatting. The issue was not present in 0.12. Setting ytick.labelleft : False with ytick.labelright : True using seaborn.objects.Plot.theme in 0.12 would move the ylabels from left to right, but in 0.13 it creates a right label without removing the left.

from matplotlib import pyplot as plt
import seaborn as sns
import seaborn.objects as so
import pandas as pd

# create simple dataframe

df = pd.DataFrame(
    {
        "X": [1, 2, 3, 4],
        "Y1": [1, 2, 3, 4],
        "Y2": [0, 3, 9, 81],
    }
)

(
    so.Plot(df, x="X", y="Y1")
    .add(so.Line(color="C0"))
    .theme(    {"ytick.labelleft": False,
                        "ytick.labelright": True}

                )
)

output

I have not been able to find a workaround.

mwaskom commented 8 months ago

This sounds like a duplicate or maybe just a related issue as https://github.com/mwaskom/seaborn/issues/3614

cwberardi commented 8 months ago

This sounds like a duplicate or maybe just a related issue as #3614

I had the same thought, but because I didn't have a good hypothesis "why" I opened a new issue.

mwaskom commented 8 months ago

Yeah no worries, just linking them as it seems similar (though not identical)