You can create Bokeh plots from Pandas DataFrames by passing column selections to the glyph functions.īokeh can plot floating point numbers, integers, and datetime data types. Using the Africa data ( fertility_africa and female_literacy_africa), add a red circle glyph of size=10 and alpha=0.8 to the figure p.To do this, you will need to specify the color, size and alpha keyword arguments inside p.circle(). Using the Latin America data ( fertility_latinamerica and female_literacy_latinamerica), add a blue circle glyph of size=10 and alpha=0.8 to the figure p.In this exercise, you'll plot female literacy vs fertility for Africa and Latin America as red and blue circle glyphs, respectively. It takes in floating point numbers between 0.0, meaning completely transparent, and 1.0, meaning completely opaque. The alpha parameter controls transparency. Size values are supplied in screen space units with 100 meaning the size of the entire figure. Bokeh accepts colors as hexadecimal strings, tuples of RGB values between 0 and 255, and any of the 147 CSS color names. The three most important arguments to customize scatter glyphs are color, size, and alpha. The code to create, display, and specify the name of the output file has been written for you, so after adding the x glyph, hit 'Submit Answer' to view the figure.Add an x glyph to the figure p using the function p.x() where the inputs are the x and y data from Africa: fertility_africa and female_literacy_africa.Add a circle glyph to the figure p using the function p.circle() where the inputs are the x and y data from Latin America: fertility_latinamerica and female_literacy_latinamerica.It has two parameters: x_axis_label and _axis_label. Create the figure p with the figure() function.Your job is to plot the Latin America data with the circle() glyph, and the Africa data with the x() glyph.įigure has already been imported for you from otting. Each set of x and y data has been loaded separately for you as fertility_africa, female_literacy_africa, fertility_latinamerica, and female_literacy_latinamerica. In this exercise, you will plot female literacy vs fertility for two different regions, Africa and Latin America. Create and display the output file using show() and passing in the figure p.īy calling multiple glyph functions on the same figure object, we can overlay multiple data sets in the same figure.Use the output_file() function to specify the name 'fert_lit.html' for the output file. Add a circle glyph to the figure p using the function p.circle() where the inputs are, in order, the x-axis data and y-axis data. It has two parameters: x_axis_label and y_axis_label.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |