Create interactive presentations within the Python notebook with ipyVizzu
Storytelling is one of the most important skills of an Analyst because the analysis has to be communicated to the stakeholders. The best way to communicate the analysis obtained from the data is by telling the story of the data. Using animations as a result of communication methods can assist the audience in rapidly grasping the point and absorbing the message delivered by the teller. This article will introduce a python framework called ipyVizzu which will help to create animated analysis within the notebook itself for presentation. Following are the topics to be covered. Table of contents Introduction to the ipyVizzuCreating presentations with ipyVizzu Introduction to the ipyVizzu The “ipyvizzu” is an animated graphing tool for notebooks like Jupyter, Google Colab, Databricks, Kaggle, and Deepnote, among others. It enables data scientists and analysts to use Python animation for data storytelling. It is based on Vizzu, an open-source Javascript/C++ charting toolkit. There is a new “ipyvizzu” extension,” ipyvizzu-story”, that allows animated charts to be shown directly from notebooks. Because the syntax of ipyvizzu-story differs from that of “ipyvizzu”, we recommend starting with the” ipyvizzu-story” repo if you want to use animated charts to show your findings live or as an HTML file. It makes use of a generic DataViz engine to produce several types of charts and easily transition between them. It is intended for creating animated data tales since it allows viewers to quickly follow multiple viewpoints of the data. Main characteristics: Designed with animation in mind.Defaults based on data visualisation best practices.Works with Pandas dataframes, as well as JSON and inline data input.The auto-scrolling function keeps the real chart in place while running many cells. Are you looking for a complete repository of Python libraries used in data science, check out here. Creating stories with ipyVizzu The article will use data related to sales, it is a time series data for multiple products and sub-products. To use the ipyVizzu needed to be installed, so let’s start with installing dependency. !pip install ipyvizzu-story Importing dependencies required for this article import numpy as np import pandas as pd from ipyvizzu import Data, Config, Style from ipyvizzustory import Story, Slide, Step Since the ipyvizzu module is completely compatible with Pandas dataframes, creating graphs straight from data is a breeze. To include a dataframe in an ipyvizzu chart, first, create a Data() object and then add the dataframe to it. data = Data() df=pd.read_csv(file_loc) data.add_data_frame(data_utils) We are all set to create stories with ipyVizzu story, for creating stories it must be in the form of slides. It’s similar to a video which is a set of different frames. stories = Story(data=data,style=chart_designs) The plots could be designed according to the need, one change the labels, colours, font size of the texts, orientation of the labels, etc. To customize the plots use the below code. chart_designs = Style( { "plot": { "paddingLeft": "0em", "yAxis": { "label": { "fontSize": "1em", "paddingRight": "1.2em", }, "title": {"color": "#ffffff00"}, }, "xAxis": { "label": { "angle": "2.5", "fontSize": "1.1em", "paddingRight": "0em", "paddingTop": "1em", }, "title": {"fontSize": "1em", "paddingTop": "2.5em"}, }, } } ) To create a slide the components like x-axis, y-axis, hue and title need to be configured by using “channels”. As shown in the below code. s_1 = Slide( Step( Config( { "channels": { "y": { "set": ["Sales", "Category"], "range": {"min": "0%", "max": "100%"}, }, "x": {"set": ["order_Year"]}, "color": "Category", }, "title": "Sales for all the caetgories", "geometry": "area", } ), ) ) Then after these slides are built, you need to add them to the story built above so that it can be aggregated in one place and be in a sequence. To display the story, use the play() function. stories.add_slide(s_1) stories.play() (Note: Loading of GIF might take some time. Please hold on here) Conclusion The ipyVizzu is really simple and easy to use once its property is properly understood and one can create animated stories. With this article, we have understood the use of the ipyVizzu package. References Link to the above codeGithub repository of VIzzu
The “ipyvizzu” is an animated graphing tool for notebooks
Storytelling is one of the most important skills of an Analyst, you can create animated and interactive stories with ipyVizzu story.
["HTML", "interactive plots", "Javascript", "Visualization"]
["data science", "NumPy", "AI", "Javascript", "ML", "HTML", "interactive plots", "Colab", "Databricks", "Python", "Visualization", "Jupyter", "R", "Pandas"]
["AI", "ML", "data science", "Jupyter", "Colab", "Pandas", "NumPy", "Databricks", "Python", "R"]
Sourabh has worked as a full-time data scientist for an ISP organisation, experienced in analysing patterns and their implementation in product development. He has a keen interest in developing solutions for real-time problems with the help of data both in this universe and metaverse.