Code Monkey home page Code Monkey logo

Comments (5)

DingWB avatar DingWB commented on May 22, 2024

I am not sure whether this is a displaying issue, please check whether this issue is still here if you save it into pdf using savefig(**,bbox_inches='tight') and open the pdf.

from pycomplexheatmap.

racng avatar racng commented on May 22, 2024

Saving as PDF didn't change the results. I realized this is caused by the fact that I used the basic ASTERISK U+002A * instead of U+2217 ASTERISK OPERATOR ∗. The basic asterisk sits higher.
I also had to change the font to Courier with annot_kws={'fontname':'Courier'}

from pycomplexheatmap.

DingWB avatar DingWB commented on May 22, 2024

Thanks for helping debug.
Could you please paste your completed updated code here so that other users could potentially avoid such an issue?

from pycomplexheatmap.

racng avatar racng commented on May 22, 2024

Here is the code:

# Assuming you have a dataframe of heatmap values and another matrix of corresponding p-values
heatmap = ...
pval = ...

# Format stars for significance. Note we are using the asterisk operator.
def fmt_star(x):
    if x >= 0.05:
        return ' '
    elif x < 0.05:
        return '∗'
    elif x < 0.01:
        return '∗∗'
    elif x < 0.001:
        return '∗∗∗'

# Matrix of star annotation
star = pval.map(fmt_star)

# Plot heatmap with custom star annotation
# We pass additional keyword arugments to customize the font of the annotation
# Choose a monospaced typeface that can render the U+2217 ASTERISK OPERATOR ∗ (ex. Courier)
cm = pch.ClusterMapPlotter(
    data=heatmap,
    ...,
    annot=star, fmt=None, annot_kws={'fontname': 'Courier'},
    )

from pycomplexheatmap.

DingWB avatar DingWB commented on May 22, 2024

Thanks. @racng

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.