![]() For the past several months, one of my team members has been working on a technique called wavelet transforms which is used to analyze the frequency components of a time-series. ![]() This point was driven home by a recent experience I had on my research project, where we use data science to improve building energy efficiency. ![]() The most sophisticated statistical analysis can be meaningless without an effective means for communicating the results. There are a lot of formatters but the common ones are for dates, decimals and percentages.Data Visualization with Bokeh in Python, Part I: Getting Started from bokeh.io import curdoc from bokeh.themes import Theme curdoc().theme = Theme(json=, which adds the comma separator at the thousands in the price and square footage. Here’s an example of a Theme from the Jupyter Notebook. If you are lazy and neurotic about your plots like me then this is a Godsend because you don’t need to do much of any styling each time you make a plot and they just come out beautiful by default. Themes basically let you tell Bokeh “I always want my plot to use size 14 font in the title, hide the ugly grid lines, and always make my axis labels size 12 font and bold”. figure=(sizing_mode='stretch_width') 2 - Themes The other thing I like to add is a scaling mode when you instantiate the figure as it will fill up the entire notebook window, so you no longer need to specify a size. It’s fairly simple as well, just add the code above and your plots will render nicely in Jupyter. It’s particularly nice when you want to add some interactivity (zoom in on charts, add filters, add tooltips/hovers, etc), which we discuss later. Luckily, it works great in Jupyter and really makes your visuals standout compared to the standard Matplotlib chart (in my opinion). If Bokeh didn’t work well with Jupyter that be quite a stupid thing to say. Obviously if you’ve been reading, I’ve already told you that you can follow along in the Jupyter Notebook within the repo I linked to. If I spent as much time with my mom as I did in Jupyter Notebooks I’d be son of the year material. 1 - Bokeh Works Great in Jupyter Notebooks from bokeh.io import output_notebook output_notebook() Let’s get to the reasons Bokeh is awesome (first two steps set the stage and then we actually start plotting). We will start with a basic scatter plot and along the way enhance our basic chart using features from Bokeh and mention other useful features. Specifically we will use Bokeh to look at the relationship between price and square footage of the apartment. The data comes from Craigslist apartment listings over the last few weeks in New York City. This Github Repo has a Jupyter Notebook and the raw data we will be using in this article. Sound cool? Read on! Data and Jupyter Notebook for this Article In summary, Bokeh is an easy to use plotting libary that works well with Pandas, and makes things super shareable. There also has clearly been a lot of work to make Bokeh work seamlessly with Pandas to go along with an intuitive API. jpeg, the real power of Bokeh is that because it renders in the browser (with Javascript) you can easily add interactivity and mimic super powerful tools like D3 without having to go through the painful process of learning D3. ![]() Remember the dark ages where all we had was Matplotlib? Bokeh is another visualization library, with the real differentiating factor (for me at least) being that it focuses on visuals for a web browser. Quickly before jumping into it let’s do the obligatory introduction paragraph where I introduce you to the topic. Bokeh is a Browser Based Visualization Library What Is Bokeh and what makes it different?
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |