How to use the plotnine.ylab 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 Pinafore / qb / jmlr.py View on Github external
+ xlab('Parse Truncation Depth') + ylab('')
        + scale_color_discrete(name='Dataset')
        + scale_y_continuous(labels=label_y)
        + scale_x_continuous(
            breaks=list(range(1, 11)),
            minor_breaks=list(range(1, 11)),
            limits=[1, 10])
        + theme_fs()
    )
    p.save(path.join(output_path, 'syn_div_plot.pdf'))
    p = (
    ggplot(parse_df)
        + aes(x='depth', y='unique_parses', color='dataset')
        + geom_line() + geom_point()
        + xlab('Parse Truncation Depth')
        + ylab('Count of Unique Parses')
        + scale_color_discrete(name='Dataset')
        + scale_x_continuous(
            breaks=list(range(1, 11)),
            minor_breaks=list(range(1, 11)),
            limits=[1, 10])
        + theme_fs()
    )
    p.save(path.join(output_path, 'n_unique_parses.pdf'))
    p = (
        ggplot(parse_df)
        + aes(x='depth', y='parse_ratio', color='dataset')
        + geom_line() + geom_point()
        + xlab('Parse Truncation Depth')
        + ylab('Average Unique Parses per Instance')
        + scale_color_discrete(name='Dataset')
        + scale_x_continuous(breaks=list(range(1, 11)), minor_breaks=list(range(1, 11)), limits=[1, 10])
github dputhier / pygtftk / pygtftk / plugins / ologram.py View on Github external
# Pval set to 0 are changed to  1e-320
        mat_s.loc[mat_s['summed_bp_overlaps_pvalue'] == 0, 'summed_bp_overlaps_pvalue'] = 1e-320
        mat_s = mat_s.assign(minus_log10_pvalue=list(-np.log10(list(mat_s.summed_bp_overlaps_pvalue))))
        mat_s.columns = ['Feature', 'log2_FC', 'pvalue', 'minus_log10_pvalue']
        mat_s = mat_s.assign(Statistic=['S'] * mat_s.shape[0])

        df_volc = mat_n.append(mat_s)

        p = ggplot(data=df_volc, mapping=aes(x='log2_FC', y='minus_log10_pvalue'))
        p += geom_vline(xintercept=0, color='darkgray')
        p += geom_label(aes(label='Feature', fill='Statistic'),
                        size=5,
                        color='black',
                        alpha=.5,
                        label_size=0)
        p += ylab('-log10(pvalue)') + xlab('log2(FC)')
        p += ggtitle('Volcano plot (for both N and S statistics)')
        p += scale_fill_manual(values={'N': '#7570b3', 'S': '#e7298a'})
        p += theme_bw()

        return p
github Pinafore / qb / jmlr.py View on Github external
+ xlab('Parse Truncation Depth')
        + ylab('Count of Unique Parses')
        + scale_color_discrete(name='Dataset')
        + scale_x_continuous(
            breaks=list(range(1, 11)),
            minor_breaks=list(range(1, 11)),
            limits=[1, 10])
        + theme_fs()
    )
    p.save(path.join(output_path, 'n_unique_parses.pdf'))
    p = (
        ggplot(parse_df)
        + aes(x='depth', y='parse_ratio', color='dataset')
        + geom_line() + geom_point()
        + xlab('Parse Truncation Depth')
        + ylab('Average Unique Parses per Instance')
        + scale_color_discrete(name='Dataset')
        + scale_x_continuous(breaks=list(range(1, 11)), minor_breaks=list(range(1, 11)), limits=[1, 10])
        + scale_y_continuous(limits=[0, 1])
        + theme_fs()
    )
    p.save(path.join(output_path, 'parse_ratio.pdf'))
github deepmind / bsuite / bsuite / experiments / deep_sea_stochastic / analysis.py View on Github external
def plot_seeds(df: pd.DataFrame,
               sweep_vars: Sequence[Text] = None,
               num_episodes: int = NUM_EPISODES) -> gg.ggplot:
  """Plot the returns through time individually by run."""
  return deep_sea_analysis.plot_seeds(
      df_in=df,
      sweep_vars=sweep_vars,
      yintercept=np.exp(-1),
      num_episodes=num_episodes,
  ) + gg.ylab('average episodic return (excluding additive noise)')
github deepmind / bsuite / bsuite / experiments / deep_sea / analysis.py View on Github external
def plot_scaling_log(plt_df: pd.DataFrame,
                     sweep_vars: Sequence[Text] = None,
                     with_baseline=True) -> gg.ggplot:
  """Plot scaling of learning time against exponential baseline."""
  p = _base_scaling(plt_df, sweep_vars, with_baseline)
  p += gg.scale_x_log10(breaks=[5, 10, 20, 50])
  p += gg.scale_y_log10(breaks=[100, 300, 1000, 3000, 10000, 30000])
  p += gg.xlab('deep sea problem size (log scale)')
  p += gg.ylab('#episodes until < 90% bad episodes (log scale)')
  return plotting.facet_sweep_plot(p, sweep_vars)
github deepmind / bsuite / bsuite / experiments / deep_sea / analysis.py View on Github external
def plot_scaling(plt_df: pd.DataFrame,
                 sweep_vars: Sequence[Text] = None,
                 with_baseline: bool = True,
                 num_episodes: int = NUM_EPISODES) -> gg.ggplot:
  """Plot scaling of learning time against exponential baseline."""
  p = _base_scaling(plt_df, sweep_vars, with_baseline)
  p += gg.xlab('deep sea problem size')
  p += gg.ylab('#episodes until < 90% bad episodes')
  if with_baseline:
    max_steps = np.minimum(num_episodes, plt_df.episode.max())
    p += gg.coord_cartesian(ylim=(0, max_steps))
  return plotting.facet_sweep_plot(p, sweep_vars)
github dputhier / pygtftk / pygtftk / plugins / ologram.py View on Github external
p += ylab('-log10(pvalue)') + xlab('log2(FC)')
        p += ggtitle('Volcano plot (for both N and S statistics)')
        p += scale_fill_manual(values={'N': '#7570b3', 'S': '#e7298a'})
        p += theme_bw()

        return p

    # -------------------------------------------------------------------------
    # call plotting functions
    # -------------------------------------------------------------------------

    # Compute the plots for both statistics
    p1 = plot_this('summed_bp_overlaps', display_fit_quality=display_fit_quality) + ylab(
        "Nb. of overlapping base pairs") + ggtitle(
        'Total overlap length per region type')
    p2 = plot_this('nb_intersections', display_fit_quality=display_fit_quality) + ylab(
        "Number of intersections") + ggtitle(
        'Total nb. of intersections per region type')
    p3 = plot_volcano()

    # -------------------------------------------------------------------------
    # Computing page size
    # -------------------------------------------------------------------------

    nb_ft = len(list(d['feature_type'].unique()))

    if pdf_width is None:
        panel_width = 0.6
        pdf_width = panel_width * nb_ft

        if pdf_width > 100:
            pdf_width = 100
github deepmind / bsuite / bsuite / experiments / deep_sea / analysis.py View on Github external
def plot_regret(df_in: pd.DataFrame,
                sweep_vars: Sequence[Text] = None,
                num_episodes: int = NUM_EPISODES) -> gg.ggplot:
  """Plot average regret of deep_sea through time by size."""
  df = df_in.copy()
  df = df[df['size'].isin([10, 20, 30, 40, 50])]
  df['avg_bad'] = df.total_bad_episodes / df.episode
  df['size'] = df['size'].astype('category')
  p = (gg.ggplot(df[df.episode <= num_episodes])
       + gg.aes('episode', 'avg_bad', group='size', colour='size')
       + gg.geom_line(size=2, alpha=0.75)
       + gg.geom_hline(
           gg.aes(yintercept=0.99), linetype='dashed', alpha=0.4, size=1.75)
       + gg.geom_hline(gg.aes(yintercept=0.0), alpha=0)  # axis hack
       + gg.ylab('average bad episodes')
       + gg.scale_colour_manual(values=plotting.FIVE_COLOURS)
      )
  return plotting.facet_sweep_plot(p, sweep_vars)