Skip to content
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

Unable to get coloured graph. #133

Closed
varundewaker opened this issue Jun 22, 2023 · 7 comments
Closed

Unable to get coloured graph. #133

varundewaker opened this issue Jun 22, 2023 · 7 comments

Comments

@varundewaker
Copy link

Hello chemosim-lab
When I run this code i get graph but it is not colored whereas legends are indicated in colored. I am using Ubuntu 20.04.6 LTS and notebook in firefox. I usually get following warning.
home/XXXX/miniconda3/envs/prolif/lib/python3.11/site-packages/seaborn/axisgrid.py:118: UserWarning: Tight layout not applied. tight_layout cannot make axes width small enough to accommodate all axes decorations
self._figure.tight_layout(*args, **kwargs). Please suggest how to get colored graph. Thanks in advance.

import seaborn as sns
import pandas as pd

reorganize data

data = df.reset_index()
data = pd.melt(data, id_vars=["Frame"], var_name=["residue","interaction"])
data = data[data["value"] != False]
data.reset_index(inplace=True, drop=True)

plot

sns.set_theme(font_scale=.8, style="white", context="talk")
g = sns.catplot(
data=data, x="interaction", y="Frame", hue="interaction", col="residue",
hue_order=["Hydrophobic", "HBDonor", "HBAcceptor", "PiStacking", "CationPi", "Cationic"],
height=3, aspect=0.2, jitter=0, sharex=False, marker="_", s=8, linewidth=3.5,
)
g.set_titles("{col_name}")
g.set(xticks=[], ylim=(-.5, data.Frame.max()+1))
g.set_xticklabels([])
g.set_xlabels("")
g.fig.subplots_adjust(wspace=0)
g.add_legend()
g.despine(bottom=True)
for ax in g.axes.flat:
ax.invert_yaxis()
ax.set_title(ax.get_title(), pad=15, rotation=60, ha="center", va="baseline")

@cbouy
Copy link
Member

cbouy commented Jun 24, 2023

Hi,

What do you mean by "not colored", is it just one single color or you can't see anything at all?
Also, what's the output of df.melt()["interaction"].value_counts()?

Best,
Cédric

@varundewaker
Copy link
Author

Thanks for your response. This is the part of output file. Hope you understand the issue clearly now. I used this command
df = fp.to_dataframe()
df
df.melt()["interaction"].value_counts()

The output I get
VdWContact 4422
Hydrophobic 4020
HBAcceptor 603
PiCation 603
HBDonor 603
PiStacking 402
Name: interaction, dtype: int64


83-99-crop

@cbouy
Copy link
Member

cbouy commented Jun 26, 2023

Okay I see now! Which version of seaborn are you using? You can get the version with:

import seaborn as sns
print(sns.__version__)

It might be that there's an edge around the markers in the plot which hides the actual color due to recent changes in the library

@varundewaker
Copy link
Author

I got this when I executed this command in jupyter
import seaborn as sns
print(sns.version)

0.12.2

@cbouy
Copy link
Member

cbouy commented Jun 28, 2023

Try installing 0.11.0 instead:
pip install seaborn==0.11.0 or conda install seaborn==0.11.0 depending on which package manager you use

@varundewaker
Copy link
Author

This frozen installation of conda install seaborn==0.11.0 didn't worked for me because it downgraded other libraries also. I used old one https://github.com/chemosim-lab/ProLIF-paper old version and its working.
During installation i think https://github.com/chemosim-lab/ProLIF/blob/master/.binder/environment.yml, the given seaborn is not installing rather it install updated seaborn package (0.12.2). Please look in this matter. Thanks for your support.

@cbouy
Copy link
Member

cbouy commented Jun 29, 2023

I see, I plan to include this seaborn code snippet directly in Prolif for the next update so I'll address this compatibility issue by then.

@cbouy cbouy closed this as completed Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants