Beispiel #1
0
def test_scatter():
    x = np.random.rand(5)
    y = np.random.rand(5)
    
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.scatter(x,y, s=80)
    set_fig_to_bw(fig)
    
    plt.draw()
Beispiel #2
0
def test_scatter():
    x = np.random.rand(5)
    y = np.random.rand(5)

    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.scatter(x, y, s=80, c='r')
    set_fig_to_bw(fig)

    plt.draw()
Beispiel #3
0
def test_fill_between():
    x = np.linspace(0, 1)
    y1 = np.sin(4 * np.pi * x) * np.exp(-5 * x)
    y2 = np.cos(4 * np.pi * x) * np.exp(-5 * x)

    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.fill_between(x, y1, y2)
    set_fig_to_bw(fig, style=HATCHING)

    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.fill_between(x, y1, y2, label='test')
    set_fig_to_bw(fig, style=GREYSCALE)

    plt.draw()
Beispiel #4
0
def test_fill_between():
    x = np.linspace(0, 1)
    y1 = np.sin(4 * np.pi * x) * np.exp(-5 * x)
    y2 = np.cos(4 * np.pi * x) * np.exp(-5 * x)
    
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.fill_between(x, y1, y2)
    set_fig_to_bw(fig, style=HATCHING)

    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.fill_between(x, y1, y2,label='test')
    set_fig_to_bw(fig, style=GREYSCALE)
    
    plt.draw()
Beispiel #5
0
def test_fig_legend():
    fig = plt.figure()
    ax = fig.add_subplot(111)
    
    x = np.random.rand(5)
    y = np.random.rand(5)
    ax.scatter(x,y, label='a', c='b')
    
    x = np.random.rand(5)
    y = np.random.rand(5)
    ax.scatter(x,y, label='b', c='r')
    
    x = np.random.rand(5)
    y = np.random.rand(5)
    ax.scatter(x,y, label='c', c='k')
    ax.legend()
    
    set_fig_to_bw(fig, style=GREYSCALE)
    plt.draw()
Beispiel #6
0
def test_fig_legend():
    fig = plt.figure()
    ax = fig.add_subplot(111)

    x = np.random.rand(5)
    y = np.random.rand(5)
    ax.scatter(x, y, label='a', c='b')

    x = np.random.rand(5)
    y = np.random.rand(5)
    ax.scatter(x, y, label='b', c='r')

    x = np.random.rand(5)
    y = np.random.rand(5)
    ax.scatter(x, y, label='c', c='k')
    ax.legend()

    set_fig_to_bw(fig, style=GREYSCALE)
    plt.draw()
Beispiel #7
0
def test_lines():
    x = np.linspace(0, 1)
    y = np.sin(4 * np.pi * x) * np.exp(-5 * x)

    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(x, y, c='k')
    set_fig_to_bw(fig, style=GREYSCALE)

    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(x, y, '-', c='k')
    set_fig_to_bw(fig, style=GREYSCALE, line_style='black')

    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(x, y, '-', c='k')
    set_fig_to_bw(fig, style=GREYSCALE, line_style=None)

    plt.draw()
Beispiel #8
0
def test_fig_legend():
    fig = plt.figure()
    ax = fig.add_subplot(111)

    x = np.random.rand(5)
    y = np.random.rand(5)
    ax.scatter(x, y, label='a', c='b')

    x = np.random.rand(5)
    y = np.random.rand(5)
    ax.scatter(x, y, label='b', c='r')

    x = np.random.rand(5)
    y = np.random.rand(5)
    ax.scatter(x, y, label='c', c='k')
    ax.legend()

    set_fig_to_bw(fig, style=GREYSCALE)

    x = np.linspace(0, 1)
    y = np.sin(4 * np.pi * x) * np.exp(-5 * x)

    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(x, y, '-', c='k', label='test')
    ax.legend()
    set_fig_to_bw(fig, line_style='black')

    y1 = np.sin(4 * np.pi * x) * np.exp(-5 * x)
    y2 = np.cos(4 * np.pi * x) * np.exp(-5 * x)

    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.fill_between(x, y1, y2, label='test')
    ax.legend()
    set_fig_to_bw(fig, style=GREYSCALE)

    plt.draw()
Beispiel #9
0
def test_envelopes():
    experiments, outcomes = utilities.load_eng_trans_data()

    #testing titles
    envelopes(experiments, outcomes, density=None, titles=None)
    envelopes(experiments, outcomes, density=None, titles={})
    envelopes(experiments,
              outcomes,
              density=None,
              titles={'total fraction new technologies': 'a'})

    plt.draw()
    plt.close('all')

    #testing ylabels
    envelopes(experiments, outcomes, density=None, ylabels=None)
    envelopes(experiments, outcomes, density=None, ylabels={})
    envelopes(experiments,
              outcomes,
              density=None,
              ylabels={'total fraction new technologies': 'a'})

    plt.draw()
    plt.close('all')

    #no grouping no density
    envelopes(experiments, outcomes, titles=None)
    set_fig_to_bw(envelopes(experiments, outcomes, density=None)[0])

    plt.draw()
    plt.close('all')

    #no grouping, with density
    envelopes(experiments, outcomes, density=KDE)
    envelopes(experiments, outcomes, density=HIST)
    envelopes(experiments, outcomes, density=BOXPLOT)
    envelopes(experiments, outcomes, density=VIOLIN)
    set_fig_to_bw(envelopes(experiments, outcomes, density=VIOLIN)[0])

    plt.draw()
    plt.close('all')

    # grouping and density kde
    envelopes(experiments, outcomes, group_by='policy', density=VIOLIN)
    envelopes(experiments, outcomes, group_by='policy', density=BOXPLOT)
    envelopes(experiments,
              outcomes,
              group_by='policy',
              density=KDE,
              grouping_specifiers=['no policy', 'adaptive policy'])
    envelopes(experiments,
              outcomes,
              group_by='policy',
              density=BOXPLOT,
              grouping_specifiers=['no policy', 'adaptive policy'])
    envelopes(experiments, outcomes, group_by='policy', density=KDE)

    plt.draw()
    plt.close('all')

    envelopes(experiments, outcomes, group_by='policy', density=VIOLIN)
    envelopes(experiments, outcomes, group_by='policy', density=BOXPLOT)
    envelopes(experiments, outcomes, group_by='policy', density=KDE)
    envelopes(experiments, outcomes, group_by='policy', density=HIST)

    plt.draw()
    plt.close('all')

    envelopes(experiments,
              outcomes,
              group_by='policy',
              density=VIOLIN,
              log=True)
    envelopes(experiments,
              outcomes,
              group_by='policy',
              density=BOXPLOT,
              log=True)
    envelopes(experiments, outcomes, group_by='policy', density=KDE, log=True)
    envelopes(experiments, outcomes, group_by='policy', density=HIST, log=True)

    plt.draw()
    plt.close('all')

    # grouping and density hist
    envelopes(experiments, outcomes, group_by='policy', density=HIST)
    envelopes(experiments, outcomes, group_by='policy', density=HIST)

    set_fig_to_bw(
        envelopes(experiments, outcomes, group_by='policy', density=KDE)[0])

    # grouping and density
    envelopes(experiments, outcomes, group_by='policy', density=KDE, fill=True)
    set_fig_to_bw(
        envelopes(experiments,
                  outcomes,
                  group_by='policy',
                  density=KDE,
                  fill=True)[0])

    plt.draw()
    plt.close('all')
Beispiel #10
0
def test_lines():
    experiments, outcomes = utilities.load_eng_trans_data()

    lines(experiments,
          outcomes,
          outcomes_to_show="total fraction new technologies",
          experiments_to_show=np.arange(0, 600, 20),
          group_by='policy',
          grouping_specifiers='basic policy')
    lines(experiments,
          outcomes,
          experiments_to_show=np.arange(0, 600, 2),
          group_by='policy',
          density=HIST)
    lines(experiments,
          outcomes,
          experiments_to_show=np.arange(0, 600, 2),
          group_by='policy',
          density=KDE)
    lines(experiments,
          outcomes,
          experiments_to_show=np.arange(0, 600, 2),
          group_by='policy',
          density=BOXPLOT)
    lines(experiments,
          outcomes,
          experiments_to_show=np.arange(0, 600, 2),
          group_by='policy',
          density=VIOLIN)
    lines(
        experiments,
        outcomes,
        group_by='index',
        grouping_specifiers={"blaat": np.arange(1, 100, 2)},
        density=KDE,
    )

    lines(experiments,
          outcomes,
          experiments_to_show=np.arange(0, 600, 30),
          group_by='policy',
          density=KDE,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy'])
    lines(experiments,
          outcomes,
          experiments_to_show=np.arange(0, 600, 30),
          group_by='policy',
          density=HIST,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy'])
    lines(experiments,
          outcomes,
          experiments_to_show=np.arange(0, 600, 30),
          group_by='policy',
          density=BOXPLOT,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy'])
    lines(experiments,
          outcomes,
          experiments_to_show=np.arange(0, 600, 30),
          group_by='policy',
          density=VIOLIN,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy'])

    plt.draw()
    plt.close('all')

    lines(experiments,
          outcomes,
          experiments_to_show=np.arange(0, 600, 30),
          group_by='policy',
          density=KDE,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy'],
          log=True)
    lines(experiments,
          outcomes,
          experiments_to_show=np.arange(0, 600, 30),
          group_by='policy',
          density=HIST,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy'],
          log=True)
    lines(experiments,
          outcomes,
          experiments_to_show=np.arange(0, 600, 30),
          group_by='policy',
          density=BOXPLOT,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy'],
          log=True)
    lines(experiments,
          outcomes,
          experiments_to_show=np.arange(0, 600, 30),
          group_by='policy',
          density=VIOLIN,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy'],
          log=True)

    plt.draw()
    plt.close('all')

    set_fig_to_bw(
        lines(experiments,
              outcomes,
              experiments_to_show=np.arange(0, 600, 20),
              group_by='policy',
              density=KDE)[0])

    new_outcomes = {}
    for key, value in outcomes.items():
        new_outcomes[key] = value[0:20, :]
    experiments = experiments[0:20]

    #no grouping, with density
    set_fig_to_bw(lines(experiments, new_outcomes, density=KDE)[0])
    set_fig_to_bw(lines(experiments, new_outcomes, density=HIST)[0])
    set_fig_to_bw(lines(experiments, new_outcomes, density=BOXPLOT)[0])
    set_fig_to_bw(lines(experiments, new_outcomes, density=VIOLIN)[0])

    # grouping and density
    set_fig_to_bw(
        lines(experiments, new_outcomes, group_by='policy', density='kde')[0])

    # grouping, density as histograms
    # grouping and density
    set_fig_to_bw(
        lines(experiments,
              new_outcomes,
              group_by='policy',
              density='hist',
              legend=False)[0])

    plt.draw()
    plt.close('all')
def test_lines():
    results = test_utilities.load_eng_trans_data()

    lines(results, 
          outcomes_to_show="total fraction new technologies",
          experiments_to_show=np.arange(0,600, 20),
          group_by='policy',
          grouping_specifiers = 'basic policy'
          )
    lines(results, 
          experiments_to_show=np.arange(0,600, 2),
          group_by='policy',
          density=HIST
          )
    lines(results, 
          experiments_to_show=np.arange(0,600, 2),
          group_by='policy',
          density=KDE
          )
    lines(results, 
          experiments_to_show=np.arange(0,600, 2),
          group_by='policy',
          density=BOXPLOT
          )
    lines(results, 
          experiments_to_show=np.arange(0,600, 2),
          group_by='policy',
          density=VIOLIN
          )
    lines(results, 
          group_by='index',
          grouping_specifiers = {"blaat": np.arange(1, 100, 2)},
          density=KDE,
          )
      
    lines(results, 
          experiments_to_show=np.arange(0,600, 30),
          group_by='policy',
          density=KDE,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy']
          )
    lines(results, 
          experiments_to_show=np.arange(0,600, 30),
          group_by='policy',
          density=HIST,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy']
          )
    lines(results, 
          experiments_to_show=np.arange(0,600, 30),
          group_by='policy',
          density=BOXPLOT,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy']
          )
    lines(results, 
          experiments_to_show=np.arange(0,600, 30),
          group_by='policy',
          density=VIOLIN,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy']
          )

    plt.draw()
    plt.close('all')

    lines(results, 
          experiments_to_show=np.arange(0,600, 30),
          group_by='policy',
          density=KDE,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy'],
          log=True
          )
    lines(results, 
          experiments_to_show=np.arange(0,600, 30),
          group_by='policy',
          density=HIST,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy'],
          log=True
          )
    lines(results, 
          experiments_to_show=np.arange(0,600, 30),
          group_by='policy',
          density=BOXPLOT,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy'],
          log=True
          )
    lines(results, 
          experiments_to_show=np.arange(0,600, 30),
          group_by='policy',
          density=VIOLIN,
          show_envelope=True,
          grouping_specifiers=['no policy', 'adaptive policy'],
          log=True
          )    
  
    plt.draw()
    plt.close('all')
  
    set_fig_to_bw(lines(results, 
             experiments_to_show=np.arange(0,600, 20),
             group_by='policy',
             density=KDE
             )[0])      
     
    experiments, outcomes = results
    new_outcomes = {}
    for key, value in outcomes.items():
        new_outcomes[key] = value[0:20, :]
    experiments = experiments[0:20]
    results = experiments, new_outcomes
       
    #no grouping, with density
    set_fig_to_bw(lines(results, density=KDE)[0])
    set_fig_to_bw(lines(results, density=HIST)[0])
    set_fig_to_bw(lines(results, density=BOXPLOT)[0])
    set_fig_to_bw(lines(results, density=VIOLIN)[0])
       
    # grouping and density
    set_fig_to_bw(lines(results, 
          group_by='policy',
          density='kde')[0])
       
    # grouping, density as histograms
    # grouping and density
    set_fig_to_bw(lines(results, 
          group_by='policy',
          density='hist',
          legend=False)[0])

    plt.draw()
    plt.close('all')
def test_envelopes():
    results = test_utilities.load_eng_trans_data()
    
    #testing titles
    envelopes(results, 
              density=None,
              titles=None)
    envelopes(results, 
          density=None,
          titles={})
    envelopes(results, 
          density=None,
          titles={'total fraction new technologies': 'a',
                  'total fraction new technologies': 'b'})
  
    plt.draw()
    plt.close('all')
    
    #testing ylabels
    envelopes(results, 
              density=None,
              ylabels=None)
    envelopes(results, 
          density=None,
          ylabels={})
    envelopes(results, 
          density=None,
          ylabels={'total fraction new technologies': 'a'})

    plt.draw()
    plt.close('all')


    #no grouping no density
    envelopes(results, 
              titles=None)
    set_fig_to_bw(envelopes(results, density=None)[0])
    
    plt.draw()
    plt.close('all')
       
    #no grouping, with density
    envelopes(results, density=KDE)
    envelopes(results, density=HIST)
    envelopes(results, density=BOXPLOT)
    envelopes(results, density=VIOLIN)
    set_fig_to_bw(envelopes(results, density=VIOLIN)[0])

    plt.draw()
    plt.close('all')
     
    # grouping and density kde
    envelopes(results, 
              group_by='policy',
              density=VIOLIN)
    envelopes(results, 
              group_by='policy',
              density=BOXPLOT)
    envelopes(results, 
              group_by='policy',
              density=KDE,
              grouping_specifiers=['no policy', 'adaptive policy'])
    envelopes(results, 
              group_by='policy',
              density=BOXPLOT,
              grouping_specifiers=['no policy', 'adaptive policy'])
    envelopes(results, 
              group_by='policy',
              density=KDE)

    plt.draw()
    plt.close('all')

    envelopes(results, 
              group_by='policy',
              density=VIOLIN)
    envelopes(results, 
              group_by='policy',
              density=BOXPLOT)
    envelopes(results, 
              group_by='policy',
              density=KDE)          
    envelopes(results, 
              group_by='policy',
              density=HIST)

    plt.draw()
    plt.close('all')

    envelopes(results, 
              group_by='policy',
              density=VIOLIN,
              log=True)
    envelopes(results, 
              group_by='policy',
              density=BOXPLOT,
              log=True)
    envelopes(results, 
              group_by='policy',
              density=KDE,
              log=True)          
    envelopes(results, 
              group_by='policy',
              density=HIST,
              log=True)

    plt.draw()
    plt.close('all')
       
    # grouping and density hist
    envelopes(results, 
              group_by='policy',
              density=HIST)
    envelopes(results, 
              group_by='policy',
              density=HIST)
      
    set_fig_to_bw(envelopes(results, 
              group_by='policy',    
              density=KDE)[0])
      
    # grouping and density
    envelopes(results, 
              group_by='policy',
              density=KDE,
              fill=True)
    set_fig_to_bw(envelopes(results, 
              group_by='policy',
              density=KDE,
              fill=True)[0])

    plt.draw()
    plt.close('all')