コード例 #1
0
def get_plot(df):
    #Make plot and customize
    p = Scatter(df, x='sepal_length', y='sepal_width', xlabel='Sepal Length [cm]', ylabel='Sepal Width [cm]', title='Sepal width vs. length')
    p.xaxis.axis_label_text_font_size = "14pt"
    p.xaxis.major_label_text_font_size = '10pt'
    p.yaxis.axis_label_text_font_size = "14pt"
    p.yaxis.major_label_text_font_size = '10pt'
    p.title.text_font_size = '16pt'
    p.add_tools(HoverTool()) #Need to configure tooltips

    #Return the plot
    return(p)
コード例 #2
0
ファイル: app_bk.py プロジェクト: georgehx/flask-framework
def plot():
    ticker = request.form['name_ticker']
    apicall = 'https://www.quandl.com/api/v3/datasets/WIKI/' + ticker + '/data.csv?column_index=4&start_date=2012-11-01&end_date=2013-11-30'
    apikey = '&api_key=yRdMoLRR-tk-oNmDdQpd'
    strcall = apicall + apikey

    response = requests.get(strcall)
    df = pd.read_csv(io.BytesIO(response.content), delimiter=',', sep="\n")
    #prices = (df.columns, df.shape)

    p = Scatter(df,
                x='sepal_length',
                y='sepal_width',
                title='Sepal width vs. length')
    p.title.text_font_size = '16pt'
    p.add_tools(HoverTool())  #Need to configure tooltips for a good HoverTool
    script, div = components(p)

    return render_template('home.html', script=script, div=div)