#100DaysOfCode in Python Transcripts
Chapter: Days 82-84: Data visualization with Plotly
Lecture: Creating bar and pie charts with Plotly
0:00 There is some prework necessary to
0:02 get to plotting, but we can now do it.
0:04 Let's start by transposing the
0:06 post by month in X and Y axis.
0:09 Then it becomes pretty easy.
0:13 You can just type data
0:17 equals a list,
0:19 bar, taking, X equals X,
0:22 Y equals Y.
0:28 You can then say plotly offline,
0:32 you have to specify the mode, iplot,
0:36 data, and you can give it a file name.
0:42 Look at that.
0:44 Even has numbers if you hover over the months.
0:48 It also posted when I was preparing to a URL
0:53 so you can access those here.
0:55 That's a nice feature of plotly that
0:57 you can make your work easily accessible.
1:01 Let's move on to the breakdown of the blog categories.
1:04 The code is very similar actually.
1:07 I'm going to use my transpose helper.
1:09 X and Y now make a bit better naming labels and values.
1:14 Again I use the go object but this time I calls with pie
1:20 and I give it labels equals labels and values equals values.
1:25 Then we call plotly again, offline mode, iplot,
1:33 put the pie object in the list and give it a file name.
1:42 Look at that.
1:44 Challenges is our big thing, you probably know by now
1:48 but we do as many articles, relatively.
1:52 We have news and some special and guests.
1:57 Thirdly, the comment tags, similar code
2:01 and to transpose list of tuples,
2:04 and here I have to take the top tags as we find before.
2:13 Tags equals go, again I do a pie chart
2:17 and I could be using other types of graph
2:21 but I find a pie chart being adequate for this type of data.
2:26 I also want to keep it simple.
2:27 So, in the coming days you can
2:29 explore the library further yourself.
2:32 Similarly, has to have labels and values defined.
2:37 Plotly, offline, iplot, and it's important
2:42 to put this in a list, filename,
2:45 just going to say tags for now.
2:51 Cool, right?
2:52 Python learning Twitter Code Challenges.
2:56 Of course similar to the categories
2:58 but here you see also, when we get to a bit
3:01 more granular level you get into Flask and Django.
3:04 It's true that we write quite a bit about those.
3:07 There's even some machine learning, etc.