1 00:00:00,066 --> 00:00:00,832 2 00:00:00,833 --> 00:00:07,166 Hello and welcome to another video on histograms. This video will provide you with more options for customizing a histogram 3 00:00:07,166 --> 00:00:07,199 4 00:00:07,200 --> 00:00:13,033 and discuss further details of transformation. First, let's load the packages we'll need and import our data. 5 00:00:13,033 --> 00:00:13,499 6 00:00:13,500 --> 00:00:19,533 We'll be importing directly from the web so the code will look a little different than usual. First we'll import pandas 7 00:00:19,533 --> 00:00:19,566 8 00:00:19,566 --> 00:00:25,366 as PD and matplotlib.pyplot as PLT because we'll be creating a plot below. 9 00:00:25,366 --> 00:00:27,466 10 00:00:27,466 --> 00:00:33,199 Next, we'll set our URL to the location where a data is located. Then we'll 11 00:00:33,200 --> 00:00:33,700 12 00:00:33,700 --> 00:00:39,500 use PD.Read_table and use the URL as the argument for where to get the data from. 13 00:00:39,500 --> 00:00:40,133 14 00:00:40,133 --> 00:00:43,899 Read table is being used because we have a dot-dat file. 15 00:00:43,900 --> 00:00:46,166 16 00:00:46,166 --> 00:00:51,499 Okay, let's go ahead and run that line and you can see now we've got some data here below. 17 00:00:51,500 --> 00:00:54,533 18 00:00:54,533 --> 00:01:01,266 Next, let's make two variables. One for RTSec and one for a newly transformed variable, TranRTSec. 19 00:01:01,266 --> 00:01:02,099 20 00:01:02,100 --> 00:01:08,266 In this case, we want to multiply every value of RTSec by 1.5. So to make RTSec, we'll 21 00:01:08,266 --> 00:01:08,432 22 00:01:08,433 --> 00:01:14,666 just set RTSec equal to figure 3-1 brackets RT-sec. This will 23 00:01:14,666 --> 00:01:20,799 just give us a little shortcut to refer to it as later, so we don't have to keep typing out 24 00:01:20,800 --> 00:01:20,833 25 00:01:20,833 --> 00:01:27,333 this very long name of that variable. TranRTSec or transformed RTSec 26 00:01:27,333 --> 00:01:27,533 27 00:01:27,533 --> 00:01:30,233 will be the same as RTSec times 1.5. 28 00:01:30,233 --> 00:01:33,866 29 00:01:33,866 --> 00:01:39,899 Okay, now we're setting up the plot. Because we're making two histograms, we're setting our figure 30 00:01:39,900 --> 00:01:45,133 size equal to 10,6. If you're just making one histogram, you don't need to worry about this step here. 31 00:01:45,133 --> 00:01:48,133 32 00:01:48,133 --> 00:01:54,133 Then we'll plot the first histogram using PLT.Hist, the same as we did before, 33 00:01:54,133 --> 00:01:54,466 34 00:01:54,466 --> 00:02:00,499 setting X labels and titles. Then we'll be plotting our second histogram. So 35 00:02:00,500 --> 00:02:00,533 36 00:02:00,533 --> 00:02:04,566 this lets it know that this is in the first spot. This is in the second spot. 37 00:02:04,566 --> 00:02:07,532 38 00:02:07,533 --> 00:02:13,099 And then we'll show our plots. Now the reason we're doing two plots is so that you can see, 39 00:02:13,100 --> 00:02:14,333 40 00:02:14,333 --> 00:02:20,433 even though we've transformed RT-SEC, our distributions look the same. And the reason for this 41 00:02:20,433 --> 00:02:20,466 42 00:02:20,466 --> 00:02:27,366 is that we've transformed RT-SEC using a linear transformation. Anytime you apply a linear transformation 43 00:02:27,366 --> 00:02:31,432 to a variable, your distribution will remain the same. 44 00:02:31,433 --> 00:02:33,733 45 00:02:33,733 --> 00:02:37,933 All right, that's it for figure 3.1. Good luck with your homework and have fun coding!