示例#1
0
def myCorrelationPlot(df, pw=300, ph=300, tt="correlations"):
    colNames = df.columns.tolist()
    rownames = df.index.tolist()
    x = [c for r in rownames for c in colNames]
    y = [r for r in rownames for c in colNames]
    corarr = [df[c][r] for r in rownames for c in colNames]
    colors = [
        RGB(255 * (1 - x) / 2, 255 * (1 + x) / 2, 0, 0.7) for x in corarr
    ]
    p = figure(title=tt,
               x_range=colNames,
               y_range=rownames,
               plot_width=pw,
               plot_height=ph,
               toolbar_location="right")
    p.rect(x, y, color=colors, width=1, height=1)
    p.xaxis.major_label_orientation = 3.14159 / 2
    c = myColorBar(75, ph)
    output_file("correlation.html")
    show((row(p, c)))
    out.reset_output()
def test_reset_output(mock_reset):
    # might create a new one, which also calls reset
    original_call_count = curstate().reset.call_count
    bio.reset_output()
    assert curstate().reset.call_count == original_call_count + 1
def clean_show(item):
    reset_output()
    show(item)
示例#4
0
def test_reset_output(mock_reset):
    # might create a new one, which also calls reset
    original_call_count = curstate().reset.call_count
    bio.reset_output()
    assert curstate().reset.call_count == original_call_count+1
示例#5
0
# Scatter Plot
scatterList = []
tools = "pan,box_zoom,reset,save"
for i in df.columns:
    for j in df.columns:
        p = figure(title="SactterPlot : " + i + " Vs " + j, tools=tools)
        p.grid.grid_line_color = None
        p.background_fill_color = "#eeeeee"
        mscatter(p, df[i], df[j], "asterisk")
        p.xaxis.axis_label = i
        p.yaxis.axis_label = j
        scatterList.append(p)
output_file("scatterPlot.html")
show(gridplot(scatterList, ncols=9, plot_width=250, plot_height=250))
out.reset_output()


# Histogram Function
def histPlot(data, edge, title, tools, xlab, ylab):
    p = figure(title=title, tools=tools)
    p.quad(top=his, bottom=0, left=edge[:-1], right=edge[1:])
    p.xaxis.axis_label = xlab
    p.yaxis.axis_label = ylab
    return p


# Histogram Plot
histList = []
for i in df.columns:
    his, edg = np.histogram(df[i], density=True, bins=50)