Giter Club home page Giter Club logo

Comments (5)

DingWB avatar DingWB commented on May 16, 2024

I don't think this is an issue when you used a tight layout, if the real legend width of color_dict legend was smaller than the given legend_width=50, then there would be no influence.
Minor suggestion, you can decrease the width/height of the row/col dendrogram to make the figure looks better.

from pycomplexheatmap.

welyt avatar welyt commented on May 16, 2024

I have set the tight parameter, I tried setting row_ dendrogram=False, But the legend still has cover。

    plt.figure(figsize=(16, 10), dpi=300)
    cm = ph.ClusterMapPlotter(
        data=df_corr,
        label='pearson', show_rownames=False, row_names_side='left', top_annotation=col_ha,left_annotation=row_ha,
        show_colnames=True, col_cluster=True, row_cluster=True,
        col_dendrogram=True, row_dendrogram=False, row_dendrogram_size=20, col_dendrogram_size=20,legend_width=20,
        linewidths=0.001,linecolor='white',
        col_split_gap=2, row_split_gap=2)
    cm.ax.set_title(f"{prefix}-相关性热图—聚类", y=1.03, fontdict={'fontweight':'bold'})
    if debug:
        plt.show()
    else:
        plt.savefig(f"{out_dir}/{prefix}_相关性热图_聚类.png", bbox_inches = 'tight')

from pycomplexheatmap.

DingWB avatar DingWB commented on May 16, 2024

Please give me the dataset you used in this example, so that I can debug it.

from pycomplexheatmap.

welyt avatar welyt commented on May 16, 2024

Please give me the dataset you used in this example, so that I can debug it.
data_frame_in.csv
sample_info.csv

data_frame_in = pd.read_csv("data_frame_in.csv", sep="\t", index_col=0)
sample_info = pd.read_csv('sample_info.csv', sep="\t", index_col=0)
plt.figure(figsize=(16, 10), dpi=300)
col_ha = ph.HeatmapAnnotation(
    志愿者=ph.anno_simple(sample_info['志愿者编号'], cmap='Paired'),
    类别=ph.anno_simple(sample_info['类别'], cmap='Set1'), wspace=2,
    axis=1)
cm = ph.ClusterMapPlotter(
    data=data_frame_in,
    label='test', show_rownames=False, row_names_side='left', top_annotation=col_ha,
    show_colnames=True, col_cluster=True, row_cluster=True,
    col_dendrogram=True, row_dendrogram=True, row_dendrogram_size=20, col_dendrogram_size=20,legend_width=20)
cm.ax.set_title("热图—聚类", y=1.03, fontdict={'fontweight':'bold'})
plt.show()

from pycomplexheatmap.

welyt avatar welyt commented on May 16, 2024

Please give me the dataset you used in this example, so that I can debug it.

sorry, it may my fault(reboot jupyter), now it works fine!

from pycomplexheatmap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.