![]() 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. Import the figure function from otting, and the output_file and show functions from bokeh.io.Note: You may have to scroll down to view the lower portion of the figure. You can click on the question mark sign for more details on any of these tools. Your job is to create a figure, assign x-axis and y-axis labels, and plot female_literacy vs fertility using the circle glyph.Īfter you have created the figure, in this exercise and the ones to follow, play around with it! Explore the different options available to you on the tab to the right, such as "Pan", "Box Zoom", and "Wheel Zoom". The x-axis data has been loaded for you as fertility and the y-axis data has been loaded as female_literacy. ![]() This dataset highlights that countries with low female literacy have high birthrates. In this example, you're going to make a scatter plot of female literacy vs fertility using data from the European Environmental Agency. # color for metal # letter symbol for adsorbate colors = #+END_HTML '''.# AAPL Stock aapl_url = '' # Automobile miles per gallon auto_url = '' # Gapminder gap_url = '' # Blood glucose levels glucose_url = '' # Female literacy and birth rate female_url = '' # Olympic medals (100m sprint) sprint_url = '' # State coordinates state_url = '' With open( '/users/jkitchin/Desktop/energies.json', 'r') as f: You can see a full HTML version here: bokeh-plot.html. To get around that, I show the plot in a frame here. Bokeh needs some javascript injected into the header to work. Using Bokeh does not integrate real smoothly with my blog workflow, which only generates the body of HTML posts. Briefly, this data shows trends (or lack of) in the adsorption energies of some atoms on the atop and fcc sites of several transition metals as a function of adsorbate coverage xu-2014-probin-cover. We get straight to the image here so you can see what this is all about. So, today we look at Bokeh which allows you to embed some json data in your HTML, which is made interactive by your browser with more javascript magic. While the static images we usually use have limited utility, at least they stick around. One potential issue with plotly is the need for an account and API-key, some limitations on how many times a graph can be viewed per day (although I should aspire to have my graphs viewed 1000+ times a day!), and who knows what happens to the graphs if plotly ever goes out of business. ![]() In our last post we examined the use of plotly to generate interactive plots in HTML. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |