Basic Plotting Using Bokeh Python Pandas Library – Scatter, Line Visualizations

 

Bokeh is a powerful framework for data visualization in Python. Here I take a look at straightforward plotting and visualization using this powerful library.

Credit to PythonHow. You can check him out on Youtube

bokeh.models #It is a low level interface which involves a lot of work

bokeh.plotting # It is a middle level interface

bokeh.chart # It is a  high level interface

Lets try to create scatter plot

In [130]:

 

lets create a dataframe and add some values to it for our plot

In [131]:

 

lets add some values to the X and Y axis

In [132]:

 

lets store the scatterplot in a variable

In [133]:

 

we can save our file as html using the output_file method and we can also show our plot using the show method

In [134]:

 

In [135]:

 

In [ ]:

lets now plot using the bokeh.plotting interface

lets import the figure object from the plotting interface as that is the main object we will be using to plot. the idea is that you make an empty figure and you add objects to it

In [136]:

 

lets store the figure object in a variable. we can set the with and height of the figure or we can leave it blank to use defaut with
and height

In [137]:

 

you can also customise the plot

In [138]:

 

let’s use the circle method to plot our scatter plots. the circle method takes array of X and Y values. You can also set the size of the scatter circles

In [139]:

 

Out[139]:

You can use a list to determine the size each X,Y pair of plot

In [140]:

 

you can get a full HELP with the p variable by typing help(p)

In [141]:

 

lets plot some time series data

In [142]:

 

In [143]:

 

responsive = True enlarges the whole graph to cover the screen

In [ ]:

lets plot with a line graph

In [128]:

 

Out[128]:

lets save the file and also show it

In [129]:

 

 

Want more information like this?

Similar Posts

  • Array Transposition – Numpy Python Data Analysis

    Welcome Guys, We will be looking at Array transposition in this quick notes. This is part of lectures on Learning Python for Data Analysis and Visualization by Jose Portilla on Udemy.   In [1]:

      In [2]:

      Out[2]:

    In [17]:

      Out[17]:

    In [10]:

      Out[10]:

    In [11]:

      Out[11]:

    In [23]:

     

  • Aggregation – Pandas Numpy Python Series DataFrame

      In this quick notes, we will go through aggregation in Python. This is part of lectures on Learning Python for Data Analysis and Visualization by Jose Portilla on Udemy.

      url = “http://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/” In [2]:

      In [4]:

      Out[4]: fixed acidity volatile acidity citric acid residual sugar chlorides free sulfur dioxide total sulfur dioxide density…

  • |

    Quick Example and Walk-Through JSON with Python

    This is a quick to create a dictionary object , write it to a JSON file and then read back the file and convert it to a dictionary and access the items in the dictionary. Credit to : codebasics.  You can check him out on Youtube In [3]:

      In [6]:

      Out[6]:

    In [14]:…

  • Getting Stock Prices from Yahoo and plotting Python 3 Matplolib Urllib

    This is  some quick notes about getting stock data from Yahoo and plotting it using Matplotlib . The Python version used is Python 3.5 Credits to sentdex.  You can check him out on Youtube. In [11]:

      In [12]:

      In [13]:

      In [14]:

        Want more information like this?

  • | |

    Coursera Capstone Project – Data Analysis and Interpretation

    What is it This week, I started the Data Analysis and Interpretation Capstone by Wesleyan University on Coursera. This is the final of 5 course specialisation. The capstone project is expected to take 4 weeks. With each week tackling and doing a major component of the Project work.   What is the objective The objective of…

  • | |

    Test a Logistic Regression Model – Data Analysis and Intrepretation

    OVERVIEW My research work deals with Ghana, a country from the Gapminder dataset.     What I found in my logistic regression analysis. Discussion of the results for the associations between all of my explanatory variables and my response variable   The primary quantitative explanatory variable in my regression analysis is the Income Per Person…

Leave a Reply

Your email address will not be published. Required fields are marked *