Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
CodeDelphiRAD Studio

Data Visualization: 5 Ways To Be An Enterprise-Grade Master!

python4delphi data visualization

In this article, you’ll learn what data visualization is, how to start learning data visualization in windows, using Python Windows GUI Builder with data visualization, How to use Matplotlib, Seaborn, Bokeh, NetworkX, and Plotly Python libraries for Data Visualization Tasks, Python GUI data visualization results, and many more.

What is data visualization?

Data Visualization is an interdisciplinary field that deals with the graphic representation of data. It is a particularly efficient way of communication when the data is diverse and potentially complex.

Visualizing data, whether in charts, graphs, or some other form, is important because it can give meaning to the data for a broader audience. “Visualization gives us a way to parse and understand data so that we can add it to our stories, we can incorporate it into our thinking,” says Ellie Fields, Senior Vice President of product development at Tableau.

How do I start learning data visualization in Windows?

With a plethora of online tools and software packages for Data Visualization available, online classes, and resources to help you hone your skills, the entry barrier for creating compelling Data Visualization is lower than ever before. That means you can become proficient in presenting data visually “without a real background” in computer science, data science, or programming.

But with so many options, finding a place to start can be overwhelming. In this tutorial, we’ll introduce you to how to integrate any Python’s Data Visualization libraries with Embarcadero’s Delphi, using Python4Delphi (P4D) to get you started in creating Windows GUI apps.

How does Python4Delphi help with data visualization?

P4D empowers Python users with Delphi’s award-winning VCL functionalities for Windows which enables us to build native Windows apps 5x faster. This integration enables us to create a modern GUI with Windows 10 looks and responsive controls for our Python Data Visualization applications. Python4Delphi also comes with an extensive range of demos, use cases, and tutorials.

How to use Matplotlib, Seaborn, Bokeh, NetworkX, and Plotly Python libraries to perform data visualization tasks

All of the libraries we show in this demo can be integrated with Python4Delphi for you to easily create Windows Apps with data visualization capabilities.

Prerequisites: Before we begin to work, download and install the latest Python for your platform. Follow the Python4Delphi installation instructions mentioned here. Alternatively, you can check out the easy instructions found in the Getting Started With Python4Delphi video by Jim McKeeth.

Time to get started!

First, open and run our Python GUI using project Demo1 from Python4Delphi with RAD Studio. Then insert the script into the lower Memo, click the Execute button, and get the result in the upper Memo. You can find the Demo1 source on GitHub. The behind the scene details of how Delphi manages to run your Python code in this amazing Python GUI can be found at this link.

data visualization python4delphi demo01
Open Demo01dproj

1. How do I Visualize Data with Matplotlib in Windows? 

Matplotlib is one of the most popular and oldest data visualization libraries in Python which is commonly used in exploratory data analysis and machine learning. In data science and machine learning, Matplotlib helps us to gain insights from a huge amount of data through different data visualization techniques.

With the growing demand for data science and analytics skill sets, visualizing data programmatically is one of the most crucial tasks these days. You can easily solve these tasks by combining the Matplotlib library with Python4Delphi (P4D). Matplotlib can be used in Python scripts, in the Python and IPython shell, on web application servers, and various graphical user interface toolkits (in this post, Python GUI by Delphi’s VCL using P4D)!

After installing Python4Delphi properly, you can get Matplotlib using pip or easy install to your command prompt:

and don’t forget to put the path where your Matplotlib installed, to the System Environment Variables, shown in this example:

The following is a code example of Matplotlib to create an annotated heatmap (run this inside the lower Memo of Python4Delphi Demo01 GUI):

Here is the result in Python GUI

Data Visualization Matplotlib Demo with Python4Delphi in Windows
Matplotlib Demo with Python4Delphi in Windows

Matplotlib is a comprehensive Python library for creating static, animated, and interactive visualizations. Matplotlib produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms.

Read more: https://pythongui.org/learn-to-work-with-real-world-graphics-using-the-python-matplotlib-library-in-a-delphi-windows-app/

2. How do I visualize data with Seaborn in Windows?

Seaborn is a library for making statistical graphics in Python. It is built on top of Matplotlib and closely integrated with pandas data structures. Seaborn will enhance the Matplotlib plotting functionalities.

Here is some of the functionality offered by Seaborn:

  • A dataset-oriented API for examining relationships between multiple variables
  • Specialized support for using categorical variables to show observations or aggregate statistics
  • Options for visualizing univariate or bivariate distributions and for comparing them between subsets of data
  • Automatic estimation and plotting of linear regression models for different kinds of dependent variables
  • Convenient views onto the overall structure of complex datasets
  • High-level abstractions for structuring multi-plot grids that let you easily build complex visualizations
  • Concise control over Matplotlib figure styling with several built-in themes
  • Tools for choosing color palettes that faithfully reveal patterns in your data

Do you want to improve Matplotlib plots using Seaborn?

For example, you could create a Scatterplot with varying point sizes and hues in the Windows GUI app?

This section will show you how to get started!

First, here is how you can get Seaborn :

The following is an introductory example of Seaborn to a Scatterplot with varying point sizes and hues (run this inside the lower Memo of Python4Delphi Demo01 GUI):

Here is the Seaborn result in the Python GUI:

Data Visualization Seaborn Demo with Python4Delphi in Windows
Seaborn Demo with Python4Delphi in Windows

Seaborn aims to make visualization a central part of exploring and understanding data. Its dataset-oriented plotting functions operate on data frames and arrays containing whole datasets and internally perform the necessary semantic mapping and statistical aggregation to produce informative plots.

3. How do I visualize data with Bokeh in Windows?

Bokeh is an interactive visualization library to be shown in modern web browsers. It provides elegant, concise construction of versatile graphics, and affords high-performance interactivity over large or streaming datasets. Bokeh can help anyone who would like to quickly and easily make interactive plots, dashboards, and data applications.

At a glance, Bokeh provides us with:

  • Flexibility

Bokeh makes it simple to create common plots but also can handle custom or specialized use-cases.

  • Interactivity

Tools and widgets let you and your audience probe “what if” scenarios or drill-down into the details of your data.

  • It’s shareable

Plots, dashboards, and apps can be published on web pages or Jupyter notebooks.

  • It increases productivity

Work in Python close to all the PyData tools you are already familiar with.

  • Bokeh is powerful

You can always add custom JavaScript to support advanced or specialized cases.

  • Bokeh is Open Source

Everything, including the Bokeh server, is licensed under the BSD license and available on GitHub.

Getting and installing Bokeh

This section will guide you to combine Python4Delphi with the Bokeh library, inside Delphi and C++Builder, from installing Bokeh with pip to how to make an interactive plot of the interactive of an unemployment rate.

First, here is how you can get Bokeh

Using Bokeh for Python data visualization

The following is a code example of Bokeh to produce an interactive plot of the unemployment rate in Texas (run this inside the lower Memo of Python4Delphi Demo01 GUI):

Bokeh Python4Delphi results

Data Visualization Bokeh Demo with Python4Delphi in Windows
Bokeh Demo with Python4Delphi in Windows

4. How do I visualize data with NetworkX in Windows?

NetworkX is a Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks.

Briefly, NetworkX provides us with:

  • Data structures for graphs, digraphs, and multigraphs.
  • Many standard graph algorithms.
  • Network structure and analysis measures.
  • Generators for classic graphs, random graphs, and synthetic networks.
  • Nodes can be “anything” (e.g., text, images, XML records).
  • Edges can hold arbitrary data (e.g., weights, time-series).
  • Open source 3-clause BSD license.
  • Well tested with over 90% code coverage.
  • Additional benefits from Python include fast prototyping, easy to teach, and multi-platform

Here is how you can get NetworkX

The following is a code example of NetworkX to create a Random Geometric Graph (run this inside the lower Memo of Python4Delphi Demo01 GUI):

NetworkX Data Visualization Result

Data Visualization NetworkX Demo with Python4Delphi in Windows
NetworkX Demo with Python4Delphi in Windows

5. How do I visualize data with Plotly in Windows? 

Plotly or plotly.py is an interactive, open-source, and browser-based data visualization library for Python.

Built on top of plotly.js, plotly.py is a high-level, declarative charting library. plotly.js ships with over 30 chart types, including scientific charts, 3D graphs, statistical charts, SVG maps, financial charts, and more. plotly.py is MIT Licensed.

Are you looking for a simple, flexible, and powerful data visualization library, and build a nice GUI for it? You can deliver enterprise-grade and publication-quality graphs easily by combining Plotly and Python4Delphi library, inside Delphi and C++Builder.

Installing Plotly for Data Visualization

A Plotly Python code example

The following is a code example of Plotly to visualize the famous 1962-2006 Walmart Store Openings dataset (run this inside the lower Memo of Python4Delphi Demo01 GUI):

Using Python and Plotly for powerful data visualization

Data Visualization Plotly Demo with Python4Delphi in Windows
Plotly Demo with Python4Delphi in Windows

If you are interested in machine learning, artificial intelligence, or data science, then take a look at a new way to write chief Delphi code against Python libraries in this article.

Want to know some more? Then check out Python4Delphi which easily allows you to build Python GUIs for Windows using Delphi.

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.