from e6g_connection import DataRetriever import plotly.plotly as py from sets import Set import numpy as np import pprint import networkx as nx from plotly.graph_objs import * import matplotlib.pyplot as plt dr = DataRetriever() # posts = dr.getFirstPage() posts = dr.getFirstN(5) py.sign_in("humun", "9aq7qo7ayd") # [post,{tags}] # [tag,{posts}]] tagToPosts = {} postToTags = {} def scatter_nodes(pos, labels=None, color=None, size=20, opacity=1): # pos is the dict of node positions # labels is a list of labels of len(pos), to be displayed when hovering the mouse over the nodes # color is the color for nodes. When it is set as None the Plotly default color is used # size is the size of the dots representing the nodes # opacity is a value between [0,1] defining the node color opacity
date_range = OrderedDict() for post in reversed(jsonPosts[tag]): timestamp = post["created_at"]["s"] date = datetime.datetime.fromtimestamp(timestamp).date() date_str = str(date) total = total + 1 date_range[date_str] = total plot(date_range, tag) def plot(data, tag): global plot_data plot_data += [ go.Scatter( x = list(data.keys()), y = list(data.values()), name = tag )] dr = DataRetriever() dr.downloadInParallel(['darkgem', 'sindoll', 'narse', 'the_weaver', 'kihu', 'slugbox', 'daigaijin', 'aogami']) total(dr.jsonData) plot_url = py.plot(plot_data, filename='hit')