-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotting.py
44 lines (31 loc) · 918 Bytes
/
plotting.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os, random, csv, random
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame
from pygame.locals import *
from datetime import datetime
from twython import Twython
import pymongo
import plotly.graph_objects as go
from auth import (
consumer_key,
consumer_secret,
access_token,
access_token_secret,
dbpw
)
client = pymongo.MongoClient("mongodb+srv://dbUser:" + dbpw + "@cluster0-xap7m.gcp.mongodb.net/test?retryWrites=true&w=majority")
db = client.test
collection = db['PetDataCollection']
num_cats = 0
num_dogs = 0
# document = {"Family":"Dog","Message":message2,"Path":img_path}
for doc in collection.find({"Family":"Dog"}):
num_dogs += 1
print("dog")
for doc in collection.find({"Family":"Cat"}):
num_cats += 1
print("cat")
labels = ['Cats','Dogs']
values = [num_cats, num_dogs]
fig = go.Figure(data=[go.Pie(labels=labels, values=values)])
fig.show()