1
00:00:00,030 --> 00:00:07,109
So as you saw in the previous lecture we
were able to build this graph, and you

2
00:00:07,109 --> 00:00:13,170
also saw that there are various ways to
achieve your results, but what I prefer

3
00:00:13,170 --> 00:00:19,170
is to have intermediate results so in
this case this was the initial data

4
00:00:19,170 --> 00:00:25,080
frame and then I made some operations
here to end up with this 3 additional

5
00:00:25,080 --> 00:00:32,489
columns. Now you could calculate this
columns on the fly here and you don't have to

6
00:00:32,489 --> 00:00:36,870
write all these lines of code, but I
prefer to have control over the

7
00:00:36,870 --> 00:00:41,790
operations, over the script so it's
up to you whether you want to use

8
00:00:41,790 --> 00:00:46,170
intermediate results or not. So that was
a couple of notes about the previous lecture.

9
00:00:46,170 --> 00:00:49,950
Now let's focus on this lecture
and what we will do is we will add the

10
00:00:49,950 --> 00:00:55,079
segments vertically and also we will
give these grid lines a low profile, so

11
00:00:55,079 --> 00:01:00,230
we could either remove them completely
or we could add some transparency there.

12
00:01:00,230 --> 00:01:11,220
So let's work all the grid lines first.
This is what we have so far, so here let

13
00:01:11,220 --> 00:01:21,229
me join these two cells like that. This
is the new data frame, let me do it this

14
00:01:21,229 --> 00:01:28,770
cell, we don't need this, and here is our code.
So once we create the figure then

15
00:01:28,770 --> 00:01:37,200
we have a title, and here we can apply
the grid class which has a property

16
00:01:37,200 --> 00:01:45,990
called grid line alpha so as you can
imagine this is the alpha factor of the

17
00:01:45,990 --> 00:01:51,509
grid lines, so alpha means level of
transparency and you can pass a number

18
00:01:51,509 --> 00:01:56,540
from 0 to 1 so if you pass 0 there,
you will get a chart with 100%

19
00:02:01,380 --> 00:02:09,770
transparent grid a soup,
so a good number would be 0.3.

20
00:02:09,819 --> 00:02:14,890
So this looks better. The gridlines have
a low profile now. I think they are

21
00:02:14,890 --> 00:02:22,540
enough to be able to see where this box
is falling in the X and Y axis. That's good.

22
00:02:22,540 --> 00:02:30,819
Now let's go ahead and add another glyph
for the vertical lines, and the glyph that

23
00:02:30,819 --> 00:02:38,739
you want to go for is the segment glyph.
Now a segment is defined by four

24
00:02:38,739 --> 00:02:45,010
mandatory parameters. The first one is
the x value of its highest point, and the

25
00:02:45,010 --> 00:02:49,060
next one is y value of the highest point,
and then you have the x value of the

26
00:02:49,060 --> 00:02:56,590
lower point, and Y value of the point as
well. And when you have lots of segments

27
00:02:56,590 --> 00:03:04,420
like we do in this case you can pass
lists and data frame columns, so the x

28
00:03:04,420 --> 00:03:11,260
value of the highest point would be
df.index, so we have data timing in

29
00:03:11,260 --> 00:03:18,129
the x axis and yeah, that's it, then
you have df.high. Now we don't have to

30
00:03:18,129 --> 00:03:22,419
filter out anything here because the
segments will be the same for every row.

31
00:03:22,419 --> 00:03:32,290
So X Y and then you know the X will be
the same for the next point because

32
00:03:32,290 --> 00:03:39,669
those are vertical segments so X remains
the same, but this Y value changes to

33
00:03:39,669 --> 00:03:49,620
df.low and maybe as a color there.
Let's say black and execute.

34
00:03:49,620 --> 00:03:56,319
Yeah, we're almost there so I'm sure
you're wondering now how do we get this

35
00:03:56,319 --> 00:04:00,760
segments behind the boxes. Yeah, I can
tell you how to plot these segments

36
00:04:00,760 --> 00:04:05,379
behind the rectangles, but first let me
tell you the reason that this segments

37
00:04:05,379 --> 00:04:12,549
were plotted in front of the rectangles.
So if you look here you see that we

38
00:04:12,549 --> 00:04:18,969
first plotted the rectangles in the
figure object and then the segments.

39
00:04:18,969 --> 00:04:24,040
So this means that you have like several
layers and the first layer is added

40
00:04:24,040 --> 00:04:30,940
there and then every layer after that
goes on top over the first layer, so that

41
00:04:30,940 --> 00:04:37,420
main segments will be on top of the
rectangles. If you own the segments to

42
00:04:37,420 --> 00:04:46,890
be behind you have to add them first, so.
Here we go. So that is looking good and

43
00:04:46,890 --> 00:04:52,960
we can also improve the visual parts a
little bit by changing these colors. They

44
00:04:52,960 --> 00:04:59,740
are a bit intense, so in the next lecture
we'll work a little bit on the plot area

45
00:04:59,740 --> 00:05:02,000
and make it better, so I'll see you
in the next lecture!

