Skip to content

Question about working other plotting packages like seaborn. #792

Description

@gepcel

Many other packages provide numerous supplements for Matplotlib. Occasionally, I need a feature that Ultraplot lacks. For instance, I miss useful statistical methods and finely tuned color themes of seaborn. I learned about ax.external(), so I gave it a try. Let's look at an example:

# %% import seaborn and prepare data
import seaborn as sns
x = np.random.randn(1000)+3
df = pd.DataFrame(x, columns=["Test Values"])
# %% plot with only seaborn and move legend
# legend was moved successfully
ax = sns.histplot(df, kde=True, legend=True)
sns.move_legend(ax, "upper left")
# %% plot with ultraplot and seaborn
# legend cannot be moved.
fig, ax = pplt.subplot()
with ax.external():
sns.histplot(df, ax=ax, kde=True, legend=True)
sns.move_legend(ax, "upper right")

I understand that working with other packages isn't really Ultraplot's agenda, and cooperation isn't always straightforward. I was also surprised to find that I can't control the legend position in Seaborn's histplot with some kind of loc argument—perhaps I missed something. Are there other ways to integrate Seaborn with Ultraplot that I'm unaware of?

Maybe we could consider adding some useful statistical fitting methods directly into Ultraplot?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions