DelphiLearn PythonPythonPython GUIRAD StudioWindows

How To Build A Python GUI For Stunning Data Visualizations

How To Build A Python GUI For Stunning Data Visualizations

With the growing demand for Data Science and Analytics skill sets, drawing graphics programmatically is a very popular task these days. Especially the need for high quality, real-time, and interactive graphics. You can easily create a GUI app for that purpose by combining the power of the Plotly library with Python4Delphi (P4D). P4D is a free set of powerful tools that allows you to work with Python scripts, modules, and types in Delphi and easily create Windows GUI with it.

What is Plotly?

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.

This post will guide you on how to run the Plotly library using Python for Delphi to display it in the Delphi Windows GUI app.

How do I enable Plotly for data Visualization inside Python4Delphi on Windows?

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.

Open Demo01.dproj
Open Demo01.dproj

How do I install Plotly in Python?

Here is how you can get Plotly using the pip command:

To test the installation, let’s run this script to visualize the Iris dataset using a basic scatterplot:

Let’s see the result:

5_1-1436919
Plotly Demo with Python4Delphi in Windows.

 

How can I visualize real-world data using Plotly inside a Windows GUI app?

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):

What does Plotly look like when it is running?

Let’s see the result:

5_2-1970604
Plotly Demo with Python4Delphi in Windows.

Check out the full source code here!

Congratulations, now you have learned how to run the Plotly library using Python for Delphi to display it in the Delphi Windows GUI app! Now you can solve various real-world problems using plots created by the Plotly library and Python4Delphi.

 

Do you have more examples of using Plotly and other types of data visualizations in Windows GUI apps?

Check out the Plotly data visualization library for Python and use it in your projects: https://pypi.org/project/plotly/ and

Check out Python4Delphi which easily allows you to build Python GUIs for Windows using Delphi: https://github.com/pyscripter/python4delphi

Or read our collections of Data Visualization articles:

Matplotlib: 

Bokeh:

Seaborn:


NetworkX:

close
Related posts
Learn PythonPythonPython GUIWindows

What Are The Differences Between C++ and Python?

DelphiDelphiVCLPythonPython GUIWindows

What Is The Deallocates Method And What Does It Do?

DelphiDelphiVCLPythonPython GUIWindows

What You Need To Know About The Observers Property

DelphiLearn PythonPythonPython GUIRAD StudioWindows

What You Need To Automatically Scrape Millions Of Tweets

Leave a Reply

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

en_USEnglish