You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I could also produce a nice heatmap automatically from the resulting POCP TSV.
Here is some example code:
mamba create -n py-pocp seaborn matplotlib pandas
importpandasaspdimportseabornassnsimportmatplotlib.pyplotaspltimportnumpyasnp# Read the TSV filedata=pd.read_csv("pocp.tsv", sep="\t", index_col=0)
# Convert values to numericdata=data.apply(pd.to_numeric, errors="coerce")
# Check if conversion is successfulifdata.isnull().values.any():
raiseValueError("Unable to convert all values to numeric!")
# Use upper or lower triangle of the matrixupper_triangle=np.triu(data)
lower_triangle=np.tril(data)
# Combine upper and lower trianglescombined_data=upper_triangle+lower_triangle-np.diag(np.diag(data))
# Create a new DataFrame with the original labelscombined_df=pd.DataFrame(combined_data, index=data.index, columns=data.columns)
# Create a heatmap using seabornsns.set(font_scale=1.0)
plt.figure(figsize=(16, 8))
heatmap=sns.heatmap(combined_df, cmap="viridis", annot=True, fmt=".1f", linewidths=.5, square=True, cbar_kws={"shrink": 0.6})
# Move the x-axis labels to the topplt.tick_params(top=True, labeltop=True, bottom=False, labelbottom=False)
# Set axis labels and plot titleplt.xlabel("")
plt.ylabel("")
plt.title("")
# Rotate y-axis labels for better readabilityplt.yticks(rotation=0)
# Save the figure as an SVG fileheatmap.get_figure().savefig("pocp-heatmap.svg", format="svg", bbox_inches="tight")
# Show the plotplt.show()
The text was updated successfully, but these errors were encountered:
I could also produce a nice heatmap automatically from the resulting POCP TSV.
Here is some example code:
The text was updated successfully, but these errors were encountered: