![]() For example, to access the color column, you can use df, and then pass it in as an argument to the color parameter of p.circle(). You will need to use Pandas DataFrame indexing to pass in the columns. Note that the x-axis should be specified before the y-axis inside p.circle(). Plot mpg (on the y-axis) vs hp (on the x-axis) by color using p.circle().Use the figure() function to create a figure p with the x-axis labeled 'HP' and the y-axis labeled 'MPG'. ![]() Use the read_csv() function of pandas to read in 'auto.csv' and store it in the DataFrame df.Additionally, each glyph will be colored according to values in the color column. Your job is to plot miles-per-gallon ( mpg) vs horsepower ( hp) by passing Pandas column selections into the p.circle() function. The CSV file is provided for you as 'auto.csv'. In this example, you will read a CSV file containing information on 392 automobiles manufactured in the US, Europe and Asia from 1970 to 1982. 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. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |