How to use the plotnine.element_blank function in plotnine

To help you get started, we’ve selected a few plotnine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dputhier / pygtftk / pygtftk / plugins / heatmap.py View on Github external
dm = dm.drop('extra', axis=1)

    # -------------------------------------------------------------------------
    #
    # Preparing diagram
    #
    # -------------------------------------------------------------------------

    message("Preparing diagram")

    p = ggplot(data=dm, mapping=aes('pos',
                                    'gene')) + geom_tile(aes(fill='exprs'))

    p += theme_bw()
    p += theme(legend_text=element_text(size=6),
               panel_grid_major=element_blank(),
               panel_grid_minor=element_blank(),
               panel_border=element_rect(colour="black", size=1),
               legend_key_size=2,
               legend_position="top",
               legend_key=element_rect(colour="white"),
               axis_text_y=element_text(colour="#333333",
                                        size=4),
               axis_line=element_line(size=0.1, colour=""),
               axis_text_x=element_text(colour="#333333",
                                        size=6, angle=65,
                                        face="plain"),
               axis_title_x=element_text(colour="#333333",
                                         size=8, angle=0,
                                         face="plain"),
               axis_title_y=element_text(colour="#333333",
                                         size=8, angle=90,
github dputhier / pygtftk / pygtftk / plugins / ologram.py View on Github external
if display_fit_quality:
            fit_qual_text = dm[statname + '_negbinom_fit_quality'].append(na_series)
            fit_qual_text.index = range(len(fit_qual_text))

            text_with_fit = list()
            for t, f in zip(text.tolist(), fit_qual_text.tolist()):
                text_with_fit += [t + "\n" + 'fit={0:.2g}'.format(f)]
            text = pd.Series(text_with_fit)

        aes_plot = aes(x='Feature', y=text_pos, label=text)
        p += geom_label(mapping=aes_plot, stat='identity',
                        size=5, boxstyle='round', label_size=0.2,
                        color='white', fill=signif_color)

        # Theme
        p += theme(legend_title=element_blank(),
                   legend_position="top",
                   legend_box_spacing=0.65,
                   legend_key_size=8,
                   legend_text=element_text(size=8),
                   legend_key=element_blank(),
                   axis_title_x=element_blank(),
                   axis_title_y=element_text(colour='#333333',
                                             size=8,
                                             hjust=4,
                                             angle=90,
                                             face="plain"),
                   axis_text_y=element_text(size=5,
                                            margin={'r': 0},
                                            angle=0),
                   axis_text_x=element_text(size=5,
                                            angle=45)
github dm3ll3n / ezpq / ezpq / Plot.py View on Github external
elif grid_axis == 'x':
            drop_grid.update(['panel_grid_major_y', 'panel_grid_minor_y'])
            if grid_lines == 'major':
                drop_grid.add('panel_grid_minor_y')
            elif grid_lines == 'minor':
                drop_grid.add('panel_grid_major_y')
        elif grid_axis == 'y':
            drop_grid.update(['panel_grid_major_x', 'panel_grid_minor_x'])
            if grid_lines == 'major':
                drop_grid.add('panel_grid_minor_x')
            elif grid_lines == 'minor':
                drop_grid.add('panel_grid_major_x')

        grid_opt = dict()
        for x in drop_grid:
            grid_opt[x] = gg.element_blank()

        return getattr(gg, 'theme_'+theme)() + \
                gg.theme(panel_border = gg.element_blank(),
                          axis_line = gg.element_line(color = "black"),
                          **grid_opt)
github TyberiusPrime / pyggplot / pyggplot / plot_nine.py View on Github external
def hide_axis_ticks_x(self):
        return self._change_theme('axis_ticks_major_x', p9.element_blank())
github dputhier / pygtftk / pygtftk / plugins / heatmap.py View on Github external
size=7,
                                         angle=rotate_x_label),
               strip_background=element_rect(colour="#000000",
                                             fill="#000000")
               )

    p += scale_fill_gradientn(colors=color_palette_list,
                              name="Signal", na_value="#222222")

    p += plotnine.labels.xlab(xlabel)
    p += plotnine.labels.ylab("Genes")

    if not show_row_names:
        p += theme(axis_text_y=element_blank(),
                   axis_ticks_major_y=element_blank(),
                   axis_ticks_minor_y=element_blank())

    if config['ft_type'] in ["transcript", "user_regions"]:

        if config['from']:

            if config['to']:
                ticks = [0, bin_nb_ups / 2] + list(np.linspace(bin_nb_ups, bin_nb_main + bin_nb_ups, 11)) + [
                    bin_nb_total - bin_nb_dws / 2, bin_nb_total]
                ticks = [x / bin_nb_total * 100 for x in ticks]
                labels = [-fr,
                          round(-fr / 2, 0)
                          ] + [str(x) + "%" for x in np.linspace(0, 100, 11)] + [round(to / 2, 0), to]


            else:
                ticks = [0, bin_nb_ups / 2] + list(np.linspace(bin_nb_ups, bin_nb_total, 11))
github dputhier / pygtftk / pygtftk / plugins / ologram.py View on Github external
for t, f in zip(text.tolist(), fit_qual_text.tolist()):
                text_with_fit += [t + "\n" + 'fit={0:.2g}'.format(f)]
            text = pd.Series(text_with_fit)

        aes_plot = aes(x='Feature', y=text_pos, label=text)
        p += geom_label(mapping=aes_plot, stat='identity',
                        size=5, boxstyle='round', label_size=0.2,
                        color='white', fill=signif_color)

        # Theme
        p += theme(legend_title=element_blank(),
                   legend_position="top",
                   legend_box_spacing=0.65,
                   legend_key_size=8,
                   legend_text=element_text(size=8),
                   legend_key=element_blank(),
                   axis_title_x=element_blank(),
                   axis_title_y=element_text(colour='#333333',
                                             size=8,
                                             hjust=4,
                                             angle=90,
                                             face="plain"),
                   axis_text_y=element_text(size=5,
                                            margin={'r': 0},
                                            angle=0),
                   axis_text_x=element_text(size=5,
                                            angle=45)
                   )

        # Add a nicer set of colors.
        p += scale_fill_manual(values={'Shuffled': '#757575', 'True': '#0288d1'})
github TyberiusPrime / pyggplot / pyggplot / plot_nine.py View on Github external
def hide_axis_ticks_y(self):
        return self._change_theme('axis_ticks_major_y', p9.element_blank())
github dputhier / pygtftk / pygtftk / plugins / heatmap.py View on Github external
# -------------------------------------------------------------------------
    #
    # Preparing diagram
    #
    # -------------------------------------------------------------------------

    message("Preparing diagram")

    p = ggplot(data=dm, mapping=aes('pos',
                                    'gene')) + geom_tile(aes(fill='exprs'))

    p += theme_bw()
    p += theme(legend_text=element_text(size=6),
               panel_grid_major=element_blank(),
               panel_grid_minor=element_blank(),
               panel_border=element_rect(colour="black", size=1),
               legend_key_size=2,
               legend_position="top",
               legend_key=element_rect(colour="white"),
               axis_text_y=element_text(colour="#333333",
                                        size=4),
               axis_line=element_line(size=0.1, colour=""),
               axis_text_x=element_text(colour="#333333",
                                        size=6, angle=65,
                                        face="plain"),
               axis_title_x=element_text(colour="#333333",
                                         size=8, angle=0,
                                         face="plain"),
               axis_title_y=element_text(colour="#333333",
                                         size=8, angle=90,
                                         face="plain"),