Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"


0 (0 Likes / 0 Dislikes)
Section 24 of Stephen Wolfram's book <i>Elementary Introduction to the Wolfram Language</i> covers a few of the many functions in the Wolfram Language for making plots of data. This video covers a few of the things you can do with the ListLinePlot function, the Histogram function and a few functions like ListPlot3D and ListContourPlot for making three-dimensional plots. Starting with the ListLinePlot function, here is a line plot of a simple data set. If the first argument in ListLinePlot is a list of data sets, then the ListLinePlot function will draw a line for each data set. For example, this adds a second data set to the plot. The ListLinePlot function automatically chooses a different style for each line by running through its own default list of possible styles. If you want to specify the styles yourself, you can do that using the PlotStyle option. For example, this input uses the PlotStyle option to specify that the first data set should be shown as a red line and the second data set as a dotted line. Another popular option of the ListLinePlot function is the Mesh option, which adds dots for the data points… and you can use the MeshStyle option to specify the style that will be used to draw those dots. This input uses the MeshStyle option to specify that the data points should be drawn as red dots. Here is a ListLinePlot function with a few more options to add a frame and a legend and grid lines. So there are lots of other options for controlling features of ListLinePlot and other plotting functions that you can learn about by looking in the documentation for those functions. Another common plot is a histogram, which is a plot with bars to show how many times numbers appear in a list. For example, here is a simple histogram where the heights of the bars show that the number 1 occurs two times in the list, and the number 3 occurs fives times in the list and the number 4 occurs once in the list. Here is a perhaps more interesting data set. Start with the first 200 words in the result from the WordList function, and use StringLength to get a list showing the lengths of those words. So that's the data set, and here is a histogram of that list of numbers, which shows, I think, that the most common word length in this list is eight. You can also make three-dimensional plots of data. One function for doing that is the ListPlot3D function, which takes an array of numbers and draws a surface with those numbers giving the height of the surface. For example, here is the ListPlot3D function for a 5-by-5 array of numbers. Another way of displaying this sort of data is with a contour plot. Here is a contour plot of that same array of numbers generated using the ListContourPlot function. These functions can also work with more interesting data. Start with a map of Mount Everest. This input uses the GeoListPlot and GeoDisk functions from Section 18. The GeoDisk function is mostly used here just to set the size of the map. Now instead of GeoListPlot, use a function called GeoElevationData to get the elevation data for this map, and change the radius of the disk to zoom in on a twenty-kilometer radius around Mount Everest. The result is a thing called a QuantityArray, which is kind of like an ordinary array except that it has units. You can see from the display that this particular QuantityArray is a 66-by-74 array with units of feet. In any case, that array can be used just like any other array as the first argument in the ListPlot3D function, so here is a surface generated by the ListPlot3D function using the elevation data around Mount Everest. That array can also be used in the ListContourPlot function to get a contour plot of that elevation data. Another common way of displaying geographical data is with a relief plot, which is kind of like a contour plot except with shading and with different coloring. Here is a relief plot generated using the ReliefPlot function for the elevation data in a one hundred-mile radius around Mount Everest. That's the end of the examples for Section 24. To summarize, here is the programming vocabulary from this section. The examples included using ListLinePlot to plot more than one data set; the Histogram function, the ListPlot3D, ListContourPlot, and ReliefPlot functions for making plots of height or elevation data; the GeoElevationData function for getting geographical elevation data; and various options of the ListLinePlot function. You can find more information about these and other Wolfram Language functions for data visualization by selecting Wolfram Documentation under the Help menu, clicking on the Visualization & Graphics button and then selecting Data Visualization from the menu, which brings up this page, which includes links to all of the functions from this section. Here are the exercises from the end of Section 24 in case you would like some practice. I decided to try one of the more difficult exercises, exercise 24.10, "Make a list of histograms of 10000 instances of totals of <i>n</i> random reals up to 100, with <i>n</i> going from 1 to 5 (illustrating the central limit theorem)." I chose that exercise partly because I think the central limit theorem is a really elegant piece of mathematics, but I skipped the part of the exercise about <i>n</i> going from 1 to 5, and decided to just use <i>n</i> equal to 5. Making ten thousand instances of anything is kind of intimidating, so I started by seeing if I could get one instance of the total of 5 random real numbers. I used the RandomReal function to get a list of five random real numbers between 0 and 100, and I used the Total function, which came up all the way back in Section 5, to get the total of that list of numbers. Eventually I'll need a table of ten thousand of those totals, but before making a list of ten thousand things, I decided to start by using the Table function to get just fifty of those totals, so I could more easily see that this input would actually give me what I wanted. Finally, make a histogram of the numbers in that list using the Histogram function. Getting back to the exercise, the exercise asked for ten thousand instances of the totals, so change 50 to 10000 to get the result, which gives a normal-distribution-like-looking curve, which is the point of the central limit theorem. Maybe you can finish the exercise by making a list of histograms for <i>n</i> going from 1 to 5. There are many, many of ways of visualizing data, and at some point it becomes a real art figuring out how to display data in a way that shows the things that you want to show, and there are lots of tools in the Wolfram Language for helping you do that. This section is just a brief introduction to those tools, but I hope it is enough to get you started!

Video Details

Duration: 6 minutes and 41 seconds
Country: Andorra
Language: English
License: Dotsub - Standard License
Genre: None
Views: 37
Posted by: wolfram on Sep 1, 2016


Caption and Translate

    Sign In/Register for Dotsub to translate this video.