Question

You will use this file in Part II: names.txtDownload names.txt Part I: Summary of Bokeh's Main Components Bokeh is a python visualization library. In this part you will research the main components of Bokeh. Among the most important packages of Bokeh are: . io • plotting palettes 1. The bokeh.io package contains the functions show and output_file. Describe each function. Specify the function input and output. Show an example for invoking (calling) each function. 2. The bokeh.plotting package contains the function figure. Describe this function listing its input, output, and an example on how to invoke it. Notice that the show and output_file functions are accessible through both, the bokeh.io and bokeh.plotting packages. 3. The bokeh.palettes contains many color pallets. Research the different color pallets at https://docs.bokeh.org/en/latest/docs/reference/palettes.htmlLinks to an external site./n1. 1. List three color pallets, showing their color sequences. 2. Show a figure for the D3 Category 10 color pallet. If this palette is used to draw a bar chart that contains 3 bars, what will the color of the three bars be? What about the colors of 5 bars? 3. How can a color palette be evaluated in terms of CVD-friendliness? Which color combinations are not CVD-friendly? Part II: Run Simple Bokeh Code In this part you will copy some code from Bokeh's documentation, run it, make some modifications then rerun it. The purpose of this exercise is to learn how to use the/nexamples from the documentation and to practice code reuse. The code that we will use is from the Bohek library's gallery: https://docs.bokeh.org/en/latest/docs/gallery.html#galleryLinks to an external site. - Creating a simple bar chart 1. Go to the simple bar chart page: https://docs.bokeh.org/en/latest/docs/gallery/bar_basic.htmlLinks to an external site. 2. Open the Anaconda Navigator. Then open Spyder, and create a new python script. 3. Copy the code from the bar chart page to the new python script. 4. Save the python script as "simple_bar_chart.py". 5. Run the script. The script should open an HTML page in the browser and show the bar chart. from bokeh.io import show, output_file from bokeh.plotting import figure output_file("bar_basic.html") fruits ['Apples', 'Pears', 'Nectarines', 'Plums', 'Grapes', 'Strawberries'] counts [5, 3, 4, 2, 4, 6] P = figure(x_range-fruits, plot_height-350, title="Fruit Counts", toolbar_location-None, tools="") p.vbar(x-fruits, top-counts, width-0.9) p.xgrid.grid_line_color None p.y_range.start - e show(p) Code from Bokeh Documentation: https://docs.bokeh.org/en/latest/docs/gallery/bar_basic.html Links to an external site./n- Modifying the bar chart script to read data from file 1. Copy the names.txt file in the directory/folder that contains your python script. 2. Modify the python script by adding code that reads in the names and ages file into two arrays: names, ages. 3. Erase the fruits and counts arrays from the original script. 4. Pass the names and ages arrays to the figure() and vbar() functions instead of the fruits and counts arrays. 5. In the figure() function, change the title of the chart from "Fruit Counts" to "Person Ages". 6. Rerun the script. This should generate another HTML file with the names and ages stored in the text file. Notice that modifying the python script to read the names and ages is by adding lines of code to perform these steps: Open the names.txt file in reading mode. Call the readline() function to read the header line and ignore it./nNotice that modifying the python script to read the names and ages is by adding lines of code to perform these steps: Open the names.txt file in reading mode. • Call the readline() function to read the header line and ignore it. Create an empty array names=[] and another array ages = 0 Create a "for loop" that scans the file line by line. For each line: 1. Split it into name and age using the split() function and the "\t" tab delimiter. 2. Add the name to the names array and the age to the ages array using the append() function. Close the names.txt file. Lab Submission: Insert your code and screenshots of the obtained visualizations for parts I & II into ONE word file.

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5