Esempio n. 1
0
def test_color_legend():
    # from pudb import set_trace; set_trace(paused=True)

    np.random.seed(10)
    gobli = (np.random.random((30, 4)) - 0.5) * 2
    pda = pd.DataFrame(gobli)
    pda.columns = ["V{0}".format(i+1) for i in range(pda.shape[1])]
    pda.index = ["O{0}".format(i+1) for i in range(pda.shape[0])]

    irds = mx.DataSet(mat=pda)
    # Subset for index
    ss1 = mx.SubSet(id='1', name='set1', row_selector=["O{0}".format(i+1) for i in range(10)])
    ss1.gr_style = mx.VisualStyle(fg_color=from_palette())
    ss2 = mx.SubSet(id='2', name='set2', row_selector=["O{0}".format(i+10) for i in range(10)])
    ss2.gr_style = mx.VisualStyle(fg_color=from_palette())
    ss3 = mx.SubSet(id='3', name='set3', row_selector=["O{0}".format(i+20) for i in range(11)])
    ss3.gr_style = mx.VisualStyle(fg_color=from_palette())
    sl = [ss1, ss2, ss3]
    subs = {'GrEn': sl}

    # factor = mx.Factor('TestColorFactor', irds.mat.shape[0])

    irds.subs = subs
    plot = pps.PCScatterPlot(irds, title='Test color plot')
    plot.color_subsets_group('GrEn')

    plot_control = pps.PCPlotControl(plot)
    pw = SinglePlotWindow(plot=plot_control)

    with np.errstate(invalid='ignore'):
        pw.configure_traits()
Esempio n. 2
0
def expvar1ds():
    """Simulated explained variance"""
    ds = mx.DataSet(
        mat=pd.DataFrame(
            [[50.8,20.7,5.1,1.9],
             [30.2,12.4,5.4,2.3]],
            index=['calibrated', 'validated'],
            columns=['V1', 'V2', 'V3', 'V4']),
        display_name='Some values', kind='Descriptive analysis / sensory profiling',
        style=mx.VisualStyle(fg_color='olive')
    )
    return ds
Esempio n. 3
0
def clust3ds():
    """Manual random pick from the Iris datast: virginica"""
    ds = mx.DataSet(
        mat=pd.DataFrame(
            [[5.8,2.7,5.1,1.9],
             [6.5,3.0,5.8,2.2],
             [7.2,3.6,6.1,2.5],
             [6.8,3.0,5.5,2.1],
             [6.2,2.8,4.8,1.8],
             [6.4,3.1,5.5,1.8],
             [6.2,3.4,5.4,2.3]],
            index=['O1', 'O2', 'O3', 'O4', 'O5', 'O6', 'O7'],
            columns=['V1', 'V2', 'V3', 'V4']),
        display_name='Some values', kind='Descriptive analysis / sensory profiling',
        style=mx.VisualStyle(fg_color='olive')
    )
    return ds
Esempio n. 4
0
def clust2ds():
    """Manual random pick from the Iris datast: versicolor"""
    ds = mx.DataSet(
        mat=pd.DataFrame(
            [[6.9,3.1,4.9,1.5],
             [4.9,2.4,3.3,1.0],
             [5.7,3.0,4.2,1.2],
             [5.1,2.5,3.0,1.1],
             [5.7,2.6,3.5,1.0],
             [5.1,2.5,3.0,1.1],
             [6.1,2.9,4.7,1.4]],
            index=['O1', 'O2', 'O3', 'O4', 'O5', 'O6', 'O7'],
            columns=['V1', 'V2', 'V3', 'V4']),
        display_name='Some values', kind='Descriptive analysis / sensory profiling',
        style=mx.VisualStyle(fg_color='saddlebrown')
    )
    return ds
Esempio n. 5
0
def clust1ds():
    """Manual random pick from the Iris datast: setosa"""
    ds = mx.DataSet(
        mat=pd.DataFrame(
            [[5.1,3.5,1.4,0.2],
             [4.6,3.4,1.4,0.3],
             [5.4,3.7,1.5,0.2],
             [5.7,3.8,1.7,0.3],
             [5.4,3.4,1.7,0.2],
             [4.8,3.1,1.6,0.2],
             [4.6,3.6,1.0,0.2]],
            index=['O1', 'O2', 'O3', 'O4', 'O5', 'O6', 'O7'],
            columns=['V1', 'V2', 'V3', 'V4']),
        display_name='Some values', kind='Descriptive analysis / sensory profiling',
        # style=VisualStyle(fg_color=(0.8, 0.2, 0.1, 1.0)),
        style=mx.VisualStyle(fg_color='indigo')
    )
    return ds