0

私は周りにbig dataプロットして作業し、それらをに埋め込もうとしています。プロファイルで見つかったと を使用して、個々のプロットを非常にうまくプロットできます。20 plotsplotlyweb pageusernameapi_key

問題が発生するのは次の場合です。新しいウィンドウを取得するたびに、間隔を空けてすべて20 plotsを再実行する必要があります。代わりに、同じプロットが必要です。python program15 minsupdate/redraw

どうすればそれを取得できますか? plot.ly ドキュメントと外部のチュートリアルをいくつか読んでみました。それを行う方法が見つかりません。誰かが私に手順を手伝ってくれるか、同時に更新される複数のプロットを操作する方法を知ることができるドキュメントを参照してください。

plotlyチュートリアルで指定された手順に従っていますが、使用する必要があるかどうかわかりませんstream_idsapi_keyまたは、プロットごとに新しいものを作成できますか?混乱!!! 提案をお寄せいただきありがとうございます。

編集: アクセス トークンを作成し、次のチュートリアルから資格情報を開始できます。

以下のコードは完璧に動作します: しかし、アノテーションを使用してコードを最小限に抑え、ストリーミング API アクセス トークンをどこに含めるか、かなりの散布図を作成することで、以下のコードで必要な修正を探しています。

import plotly.plotly as py  
import plotly.tools as tls   
from plotly.graph_objs import *

import csv
import pandas as pd
import numpy as np

df =  pd.read_csv('finally.csv')
df1=df[['NAME','COUNT']]

sizemode='area'

sizeref=df1['COUNT'].max()/1000

def Trace(X,PLACE,sizes):
    return Scatter(
        x=X['NAME'],
        y=X['COUNT'].sum(),
        name=PLACE,
        mode='marker',
        marker=Marker(
            line=Line(width=0.9),   
            size=sizes,
            sizeref=sizeref,
            opacity=0.9,
        )
    )
data=Data()

for PLACE, X in df1.groupby('NAME'):    
    sizes=X['COUNT'].sum()/1000     
    data.append(Trace(X,PLACE,sizes))

title = "Fig 1.1 : All NAMES"
x_title = "Names".format()
y_title = "Count"

# Define a dictionary of axis style options
axis_style = dict(     
    zeroline=False,       # remove thick zero line
    gridcolor='#FFFFFF',  # white grid lines
    ticks='outside',      # draw ticks outside axes 
    ticklen=8,            # tick length
    tickwidth=1.5         #   and width
)

# Make layout object
layout = Layout(
    title=title,             # set plot title
    plot_bgcolor='#EFECEA',  # set plot color to grey
    xaxis=XAxis(
        axis_style,      # add axis style dictionary
        title=x_title,   # x-axis title
    ),
    yaxis=YAxis(
        axis_style,      # add axis style dictionary
        title=y_title,   # y-axis title
    ),
    showlegend=False, 
)
fig = Figure(data=data,layout=layout)

plot_url=py.plot(fig,filename=' plotting')
4

1 に答える 1

1

あなたを助けるはずのオプションがありplot/ iplotます。'fileopt'たとえば、既存のデータに新しいトレースを追加する場合は、次を実行できます。

plot_url = py.plot(fig, filename='my-file', fileopt='append')

そうです、まだ十分に文書化されていません。ただし、実行help(py.plot)すると、次のような小さなドキュメントが表示されます。

plot(figure_or_data, validate=True, **plot_options)
Create a unique url for this plot in Plotly and optionally open url.

plot_options keyword agruments:
filename (string) -- the name that will be associated with this figure
fileopt ('new' | 'overwrite' | 'extend' | 'append') -- 'new' creates a
    'new': create a new, unique url for this plot
    'overwrite': overwrite the file associated with `filename` with this
    'extend': add additional numbers (data) to existing traces
    'append': add additional traces to existing data lists
world_readable (default=True) -- make this figure private/public
auto_open (default=True) -- Toggle browser options
    True: open this plot in a new browser tab
    False: do not open plot in the browser, but do return the unique url
于 2015-07-20T17:29:22.393 に答える