Pyoncoprint (matplotlib) legend not showing disappeared ty[es

38 Views Asked by At

I'm using such a marker from the example file of the package PyOncoprint:

rom matplotlib.patches import Polygon, Rectangle

mutation_markers = {
    "Amplification": dict(
        marker="fill",
        color="red",
        zindex=0
    ),
    "Deep Deletion": dict(
        marker="fill",
        color="blue",
        zindex=0
    ),
    "Splice Mutation (putative driver)": dict(
        marker="fill",
        color="darkorange",
        height=0.5,
        zindex=1
    ),
    "Splice Mutation (putative passenger)": dict(
        marker="fill",
        color="orange",
        height=0.5,
        zindex=1
    ),
    "Structural Variant (putative driver)": dict(
        marker="*",
        color="purple",
        lw=0,
        zindex=2
    ),}
fig, axes = op.oncoprint(mutation_markers,
                         figsize=[80, 30],
                         gap=[0.3, 0.1],                     # gap between cells (ratio)
                         title="TCGA Lung Adenocarcinoma (PanCancer Atlas), default sort method",
                         legend=True)
axis_right_barplot, axis_legend)
fig.patch.set_facecolor('white')

However, the legend of the plot output not always show all the 'marker' with their corresponding colour. For example, if the "Amplification" values and "Deep Deletion" values didn't appear in a certain table, then the legend of the output heatmap plot of this table will only show the grey colour of "Amplification" and "Deep Deletion".

As I have multiple vatious tables, I want to show all marker values and their corrsponding colour in the legend as I specified in code. Is there some way I can achieve that?

0

There are 0 best solutions below