Real-Time Visualization in Machine Learning: Evaluating LightningChart Python and Competitor Libraries PDF Free Download

1 / 53
1 views53 pages

Real-Time Visualization in Machine Learning: Evaluating LightningChart Python and Competitor Libraries PDF Free Download

Real-Time Visualization in Machine Learning: Evaluating LightningChart Python and Competitor Libraries PDF free Download. Think more deeply and widely.

Real-Time Visualization in Machine Learning
Evaluating LightningChart Python and Competitor Libraries
Bachelor’s Thesis
Degree Programme in Computer Applications
Spring 2025
Ahmad Omid
DP Degree Programme in Computer Applications Abstract
Author Ahmad Omid Year 2025
Subject Real-Time Visualization in Machine Learning: Evaluating LightningChart Python and
Competitor Libraries
Supervisors Mazhar Mohsin
The thesis evaluates the performance of LightningChart Python (LC PY), Bokeh, and Plotly for real-
time machine learning (ML) visualization across data scales from 1,000 to 1,000,000 points, which
meets a need for scalable and effective visualization tools in machine learning applications. The
study benchmarks these libraries using metrics such as frames per second (FPS), stability (standard
deviation of FPS), CPU and memory usage, and render time, to simulate real-time data streams from
an LSTM model predicting stock prices into the charts to get the metrics’ results.
Results show that LC PY was the best among all scales, supporting an average FPS of ~55 with
excellent stability (std FPS <1), despite higher resource usage (CPU 3556%, memory up to 2.63%
at 1,000,000 points), because of its outstanding scalability. Bokeh delivers very good performance for
small to medium datasets (up to 10,000 points, FPS ~105, CPU <3.5%), but its suitability declines
above 100,000 points (FPS drops to 5). Plotly performs adequately for smaller datasets (FPS 4649,
CPU <5.13%) but becomes unsuitable for real-time visualization after 10,000 points (FPS 1.23 at
1,000,000). Based on these findings, the thesis recommends LC PY for large-scale and very large-
scale ML tasks (100,000+ points), Bokeh or Plotly for small to medium scales (up to 10,000 points),
and LC PY or Bokeh for intermediate scales (10,000100,000 points).
Keywords Machine Learning, LSTM, LightningChart Python, Bokeh, Plotly, Data Visualizations, Real-
Time Data
Pages 45 pages and appendices 1 page
Glossary
ML Machine Learning
LC PY LightningChart Python
RNN Recurrent Neural Networks
FNN Feed-Forward Neural Networks
LSTM Long Short-Term Memory
FPS Frames Per Second
JSON JavaScript Object Notation
WebGL Web Graphics Library
API Application Programming Interface
HTML Hypertext Markup Language
GPU Graphics Processing Unit
CPU Central Processing Unit
CSV Comma-Separated Values
Table of Contents
1 Introduction ..................................................................................................................................... 1
2 Real-Time Visualization in Machine Learning .................................................................................. 2
2.1 Overview and Importance of Data Visualization ..................................................................... 2
2.1.1 Types of Data Visualization Libraries .......................................................................... 3
2.1.2 Libraries Used in the Study ......................................................................................... 4
2.1.2.1 LightningChart Python ................................................................................................ 4
2.1.2.2 Bokeh ......................................................................................................................... 5
2.1.2.3 Plotly .......................................................................................................................... 5
2.2 Overview of Machine Learning ............................................................................................... 6
2.2.1 Deep Learning ............................................................................................................ 8
2.2.2 Long Short-Term Memory (LSTM) .............................................................................. 9
2.2.3 Importance of Real-Time Data in ML .......................................................................... 9
2.2.4 Basics of Stock Price Prediction in ML ...................................................................... 10
2.3 Performance in Data Visualization ....................................................................................... 11
3 Methodology and Research Design .............................................................................................. 11
3.1 Tools and Technologies ....................................................................................................... 11
3.2 Data Collection and Machine Learning Model Development ................................................ 12
3.3 Performance Metrics and Benchmarking Procedure ............................................................ 13
3.4 Data Analysis ....................................................................................................................... 13
4 Implementation and Analytical Comparison of Models .................................................................. 14
4.1 Stock Price Prediction with LSTM Model .............................................................................. 14
4.2 Data Visualization Benchmarking Framework ...................................................................... 19
4.2.1 Common Benchmarking Frameworks ....................................................................... 19
4.2.2 Bokeh WebGL Visualization Benchmark ................................................................... 21
4.2.3 LightningChart Visualization Benchmark ................................................................... 24
4.2.4 Plotly WebGL Visualization Benchmark .................................................................... 25
4.2.5 Comprehensive Benchmarking Execution ................................................................ 27
4.3 Tests’ Consistency between Libraries .................................................................................. 28
4.3.1 Data Points Consistency ........................................................................................... 28
4.3.2 Test Conditions’ Consistency .................................................................................... 28
4.3.3 Consistency Tools Used ........................................................................................... 29
4.3.4 Implementation Differences ...................................................................................... 29
5 Results .......................................................................................................................................... 30
5.1 Model Performance Evaluation ............................................................................................ 30
5.2 Performance Across Data Scales......................................................................................... 31
5.2.1 Small to Medium Datasets (100-10,000 points) ........................................................ 31
5.2.2 Very Large Datasets (100,000 and 1,000,000 Points) ............................................... 34
5.2.3 Extreme Datasets (10,000,000 and 50,000,000 Points) ............................................ 37
5.3 Chart Type Comparison ....................................................................................................... 37
5.4 Effect of Complexity Levels .................................................................................................. 38
5.5 Resource Utilization Analysis ............................................................................................... 38
5.5.1 CPU Usage Patterns ................................................................................................ 39
5.5.2 Memory Consumption Analysis................................................................................. 39
5.5.3 Render Time Analysis ............................................................................................... 40
5.6 Stability and Consistency Analysis ....................................................................................... 40
5.7 Real-Time Machine Learning Suitability ............................................................................... 41
6 Summary ...................................................................................................................................... 43
References .......................................................................................................................................... 44
Figures
Figure 1 Machine Learning Process ..................................................................................................... 7
Figure 2 LC PY, Bokeh and Plotly with 100 points test ....................................................................... 32
Figure 3 LC PY, Bokeh and Plotly with 1,000 points test .................................................................... 33
Figure 4 LC PY, Bokeh and Plotly with 10,000 points test .................................................................. 34
Figure 5 LC PY, Bokeh and Plotly with 100,000 points test ................................................................ 35
Figure 6 LC PY, Bokeh and Plotly with 1,000,000 points test ............................................................. 36
Program Codes
Program Code 1 Libraries Used for Stock Prediction Model ............................................................... 14
Program Code 2 Loading the Datasets .............................................................................................. 15
Program Code 3 Preprocessing of the Datasets ................................................................................ 15
Program Code 4 Splitting the Dataset ................................................................................................ 16
Program Code 5 LSTM Model Setup ................................................................................................. 16
Program Code 6 Data Training Process ............................................................................................. 17
Program Code 7 Generating Predictions ............................................................................................ 17
Program Code 8 Model Evaluation Process ....................................................................................... 18
Program Code 9 Importing the Stock Tickers ..................................................................................... 18
Program Code 10 Applying a Library Results Saver Class ................................................................. 19
Program Code 11 Applying a Class to Record Metrics ....................................................................... 19
Program Code 12 Data Generator Class in Bokeh and Plotly ............................................................ 20
Program Code 13 Benchmark Collector Class in Bokeh and Plotly .................................................... 20
Program Code 14 Equivalent Benchmarking Functions Used in LightningChart ................................ 20
Program Code 15 Essential Libraries Imported for Bokeh .................................................................. 21
Program Code 16 Benchmarking Process for Bokeh ......................................................................... 22
Program Code 17 Creating Charts for Bokeh Benchmarking ............................................................. 22
Program Code 18 Bokeh Real-Time Data Simulation ........................................................................ 23
Program Code 19 LightningChart Configuration and Essential Libraries Imported ............................. 24
Program Code 20 LightningChart Chart Configurations ..................................................................... 24
Program Code 21 LightningChart Dataset Optimization ..................................................................... 25
Program Code 22 Essential Libraries Imported for Plotly ................................................................... 25
Program Code 23 Plotly Benchmarking Configurations ...................................................................... 26
Program Code 24 Plotly HTML Configurations ................................................................................... 26
Program Code 25 A Comprehensive Configuration for All Libraries ................................................... 27
Program Code 26 Example of Complexity Level Setup ...................................................................... 28
Program Code 27 Example of Skipping Complexity Levels for Large Datasets .................................. 28
Tables
Table 1 Model Performance Metrics on Selected Stocks ................................................................... 30
Table 2 Performance Metrics for Line Charts with 100 Data Points .................................................... 31
Table 3 Performance Metrics for Line Charts with 1,000 Data Points ................................................. 32
Table 4 Performance Metrics for Line Charts with 10,000 Data Points ............................................... 33
Table 5 Performance Metrics for Line Charts with 100,000 Data Points ............................................. 35
Table 6 Performance Metrics for Line Charts with 1,000,000 Data Points .......................................... 36
Table 7 Performance Metrics for Line Charts with Extreme Data Sizes .............................................. 37
Table 8 Line vs. Scatter Chart Performance at 10,000 Points ............................................................ 37
Table 9 Impact of Complexity on Performance (Line Charts, 10,000 Data Points) ............................. 38
Table 10 CPU Usage (%) by Data Size .............................................................................................. 39
Table 11 Memory Usage (%) by Data Size ........................................................................................ 39
Table 12 Render Time (ms) by Data Size .......................................................................................... 40
Table 13 FPS Standard Deviation by Data Size ................................................................................. 40
Table 14 Real-Time ML Visualization Suitability Matrix ...................................................................... 41
Table 15 Recommended Library by Visualization Scenario ................................................................ 42
Appendices
Appendix 1. Material management plan
1 (46)
1 Introduction
In the world of data and mass information, understanding and interpreting data is becoming
gradually very important. Whether you are a student, a developer, a researcher, a
businessman, or someone interested in uncovering insights, the power of data visualization
cannot be denied.
Data visualization is one of the important processes involved in data science, which means
that after data gathering, processing, and analyzing, it must be visualized to conclude. Data
visualization is part of the larger topic of data presentation architecture, which aims to
identify, transform, prepare, and communicate data as effectively as possible. To analyze
the big amount of information being gathered by the business sectors through data
analysis, we need a method for visualizing that data in order to interpret it, and data
visualization can help us understand what’s the information mean, by supplying it with a
visual framework through charts or graphs. As a result, identifying trends, patterns, and
outliers in massive datasets becomes easier because the data is more understandable to
the human mind. Charts, graphs, tables, dashboards and maps are examples of basic
kinds of data visualization (Pooja, 2023, pp. 4849).
Real-time data visualization is essential for machine learning workflows as well, it allows
developers and data scientists to monitor and analyze different models’ performance more
efficiently. By benchmarking the performance of different libraries using real-time data
scenarios, it is possible to increase the developers’ awareness and give them
recommendations to improve their performance. While several libraries like Matplotlib and
Seaborn are more popular and common to use between developers, they often counter
with limitations in handling large datasets or real-time scenarios. So, this thesis aims to
evaluate visualization libraries that are more capable and support GPU-acceleration such
as LightningChart Python, by comparing their performance, scalability, and usability with
other powerful alternatives like Plotly and Bokeh. By using a predictive machine learning
model, the thesis will test how these libraries can handle real-time data streaming and
visualization well.
This study is intended to answer the following questions:
How does LightningChart Python perform in real-time data visualization compared to
other GPU-accelerated libraries?
2 (46)
What are the strengths and weaknesses of LightningChart Python in handling predictive
data streams?
How much can LightningChart Python enhance the efficiency and scalability of
visualizing large datasets in real-time?
2 Real-Time Visualization in Machine Learning
This chapter provides the theoretical materials necessary for the thesis by reviewing the
relevant literature. It begins with an overview and importance of data visualization,
discussing its significance and different types of visualization libraries. Next, the chapter
explores the specific libraries used in this study, means LightningChart Python, Plotly, and
Bokeh, highlighting their capabilities and relevance in handling real-time data. The following
section introduces key machine learning concepts, including the definition of deep learning,
the LSTM as the study’s ML model, the importance of real-time data processing and the
fundamentals of stock price prediction using machine learning models. Finally, the chapter
ends in the performance evaluation criteria for visualization tools, focusing on key
benchmarking metrics to have a high-performance data visualization.
2.1 Overview and Importance of Data Visualization
Data visualization is a field in data analysis works with data visual representations. It
depicts data in a graphic way and is a functional way to communicate inferences from data.
Simply put, it is an organized representation of information within data. It is the process of
communicating and translating data and information into a visual context, usually using a
chart, graph, bar chart, or other visual aid. A question that is often asked is what are we
trying to achieve by visualizing data. At its core, the act of data visualization is an exercise
in storytelling, by taking disparate data points and transforming them into diagrams that
convey a message and guide action. Good visuals make a document very interesting.
Data-driven images attract more attention, are easier to understand, and help convey a
message to the audience quickly. With the help of descriptive graphics and dashboards,
even difficult information can be made clear and understandable (Gupta & Bagchi, 2024,
pp. 237238).
A wide range of applications show the importance of data visualization. It is used in
different areas such as business, finance, science, and engineering. Data visualization also
have an important place in data analysis, where it lets us to identify patterns and data
3 (46)
trends very fast, test hypotheses, and make good decisions. It is especially useful in
recognizing outliers, the data points that are outside the normal range which can indicate
errors or mistakes. Moreover, with the data increasing amount produced today, data
visualization has become a necessity for understanding data (Kumar, 2023, p. 248).
According to the complex nature of data visualization, choosing the right tools for effective
impact is very important. This matter leads us to Python, a powerful tool in the area of
visualization. But why Python? While most languages have special packages and libraries
that are created for visualization tasks, Python is positioned to be a special tool for data
visualization. Python, with libraries like numpy and scipy, produces advanced numerical
and scientific calculations that serves a lot of machine learning methods, thanks to the
scikit-learn availability, offers a great environment for big data manipulation because of the
pandas package and its compatibility with Apache Spark, and with libraries such as
seaborn, plotly creates beautiful plots and figures (Belorkar et al., 2020, p. 2).
2.1.1 Types of Data Visualization Libraries
There are different data visualization libraries and packages that are compatible with
Python. Most Python libraries that are special for data visualization can be organized into
one of the four groups, Matplotlib-based libraries, JavaScript libraries, JSON libraries, and
WebGL libraries, which are separated by their origin and focus (Nelson, 2020, p. 2).
The first big group of libraries related to Matplotlib. Matplotlib history goes back to 2003 and
one of the oldest Python libraries special for data visualization, which continuously updated
until now. Matplotlib has many visualization tools, plot and output types. It is used to
produce charts based on static visualizations. This library is more limited than other
libraries like Plotly and VisPy, while it can produce some 3D visualizations, but facing many
problems in comparison with its competitors. Unlike Bokeh, it is also limited in producing an
interactive plot. Matplotlib-based libraries add new capabilities to the library by showing
specific data types or domains, adding new plot types, or creating new high-level APIs for
Matplotlib functions. Matplotlib, Pandas, Seaborn, and GeoPandas are the most important
and widely used visualization libraries in this category (Nelson, 2020, p. 4).
There are some JavaScript-based libraries for Python that make good data visualization.
Thanks to web browsers using HTML5, it is possible to have interactive graphs and charts,
instead of using old static 2D plots. Using CSS to Style HTML pages make these
visualizations really good. These libraries wrap JavaScript/HTML5 functions and tools in
4 (46)
Python, which allow the user to create new interactive plots. These libraries can make APIs
with high-level JavaScript functions and let to be edited to create new types of plots, all
inside Python. Bokeh and Plotly are two examples of libraries that work this way.
JavaScript Object Notation, or JSON, is a way to structure data so that it can be easily
shared and understood, not just by JavaScript but by most programming languages. It's
also easy to read by humans’ eyes without too much trouble. When libraries that work with
JSON are used, all data can also be stored into a JSON file. This method allows to make it
possible to integrate plots with different visualization tools and techniques. One Python
library that's specifically built for visualizing this kind of statistical data is Altair.
WebGL is a graphics standard that makes it possible to interact with 3D plots. Like what is
done by HTML5 in producing 2D plots, which leads to develop plotting libraries, WebGL
has great impact in the creation of libraries for interactive 3D plotting. Many of these 3D
plotting libraries can be easily integrated and shared via Jupyter notebooks, and they also
allow for remote manipulation over the web. VisPy is a widely used library within this group
(Nelson, 2020, pp. 36).
2.1.2 Libraries Used in the Study
In this study, three visualization libraries, LightningChart Python, Plotly, and Bokeh, were
selected for evaluation because of their real-time data visualization and GPU acceleration
support. And most importantly, all these libraries are JavaScript-based which makes the
evaluation more reliable.
2.1.2.1 LightningChart Python
LightningChart Python is a high-performance data visualization library designed for real-
time applications which officially released its first version in November 2024. This library
uses LightningChart JS, a JavaScript-based visualization engine that using WebGL for
charts rendering. This engine lets the GPU to run for faster and smoother rendering. Using
the GPU power lets the LightningChart Python to reduce in CPU load, which make it more
efficient for handling large and real-time datasets. LightningChart Python has different
types of graphs including Line graphs, Scatter plots, Heatmaps, Area plots, and Box plots.
It is also introduced some other plots with 3D features such as 3D Line Graphs, 3D Scatter
plots, 3D Surface plots, 3D Mesh Plots, and 3D Box plots. LightningChart Python also
5 (46)
supports bar plots, spider charts, gauge charts, pie charts, funnel graphs, pyramid graphs,
treemaps, map charts, and dashboards. It can also create Polar plots with different types of
series (LightningChart® Python Charts for Data Visualization, 2025).
2.1.2.2 Bokeh
One of the most Bokeh advantages lies in creating interactive and web-ready plots with the
ability to produce JSON objects outputs, HTML documents, or interactive web applications.
The functions of Bokeh can easily integrate with common Python web frameworks like
Django and Flask. It also supports the real-time data streaming, and the only library whose
interface ranges from low to high, which allows it to produce adaptable and beautiful
graphics. These features, however, come with more codes for Bokeh to write and produce
the plots with a similar quality to other libraries (Gupta & Bagchi, 2024, p. 247).
Bokeh’s Visualizations use objects called “glyphs”, which can be rendered in various
shapes and styles (Nelson, 2020, p. 5). In fact, the lines, rectangles, circles, and other
objects used to create the plots, are all counted as a part of glyph system that empowers
the Bokeh library (Jolly, 2018, p. 18).
2.1.2.3 Plotly
Plotly is a free visualization library designed its python library (plotly.py) on the top of its
JavaScript one (plotly.js) which lets it to create web-based data visualizations to view in
Jupyter notebooks or online services by using Dash or saved as separate HTML files. With
just a few lines of code, Plotly is an excellent tool for producing interactive graphs with
good publishing quality (Gupta & Bagchi, 2024, p. 246).
Similar to Bokeh, Plotly was created with the purpose of making interactive charts. Different
use cases, including statistical, geographic, scientific, and even 3D datasets, are supported
by Plotly. The "trace" is the basic unit of a Plotly plot, which is similar to Bokeh’s “glyphs”,
which multiple of them can be combined and shown on a single figure. More than 40
different kinds of plots and charts are created by Plotly for Python. Plotly enables users to
store their plots as files on their device or on the cloud (Nelson, 2020, p. 5).
6 (46)
2.2 Overview of Machine Learning
The phrase "machine learning" was first used in 1959 by Arthur Samuel, a pioneer in the
field of artificial intelligence. He defined machine learning as “Field of study that gives
computers the capability to learn without being explicitly programmed” (Gupta & Bagchi,
2024, p. 285; Vo. T.H et al., 2017, p. 145). In machine learning (ML), algorithms are used
to parse data, learn from it, and then make decisions or predictions about it. ML systems
create a model by using sample data (training data subset) and validate the test and
validation data outputs instead of static program instructions. They use the universal
analytical code to make their predictions and choices (Zherlitsyn, 2024, pp. 366367).
Supervised learning and Unsupervised learning are kinds of input data that can be used to
organize machine learning. While unsupervised learning uses unlabeled input data, the
supervised learning associates the input data (usually represented by x) with a target label
(y). Also, the supervised learning can be divided into following problems, the classification
problems and the Regression problems. Regression problems involve one or more
continuous output variables, whereas classification problems have a defined set of target
labels, classes, or categories. Both of them are used in the classification process of
determining if an email message is spam or not. While the property prices are continuous,
predicting them needs size, age, and nitric oxide content that is a regression job. On the
other hand, Unlabeled datasets are the focus of unsupervised learning. Automatic
categorization or clustering are common examples, and sorting related objects together is
the aim of this type of learning. The context will decide what kind of similarity implies, and
there are several similarity metrics that may be used in this kind of situation (Vo. T.H et al.,
2017, p. 146).
In conclusion, a machine learning process starts with a large amount of data being fed into
the system, which is then trained to find hidden patterns and aspects. By employing an
algorithm to solve a problem, these aspects are then used to build a ML model. The type of
job decides which algorithm is used. Machine learning algorithms are capable to do a
number of tasks, including regression and classification (Gupta & Bagchi, 2024, pp. 384
385).
The process of generating mathematical equations from historical data is carried out by
algorithms. They change the data into a mathematical equation after analyzing it and
measuring the connection between the variables. These include Naïve Bayes classifiers,
Clustering, Decision Trees, Time-Series Modelling, Linear Regression, Logistic
7 (46)
Regression, Natural Language Processing, and more. Two categories may be used to
group these models:
• Supervised algorithms: These are the algorithms which, in addition to the input variables,
create an output variable for the historical data. In addition to the input variables, the model
uses the output variables from previous data. Decision trees, logistic regression and linear
regression are considered as Supervised algorithms.
• Un-supervised algorithms: The historical data does not have an output variable for these
kind of algorithms to function. Clustering is considered as Unsupervised algorithm.
The algorithm model's choice is determined by the type of available data (Vo. T.H et al.,
2017, p. 170).
Figure 1 Machine Learning Process
Creating a Machine Learning (ML) model includes different steps (Figure 1):
• Problem Definition: After analyzing the process to choose the appropriate ML model and
algorithm, it is needed to recognize and define the problem.
• Data Collection/Data Extraction: To ensure effective learning, it is needed to collect and
prepare relevant data with the importance of focusing on quality and relevance.
8 (46)
• Prepare the Data: To get better model training, it is needed to format and clean the data.
This process helps to address quality issues and to explore data challenges.
• Train the Algorithm: Selecting a right algorithm, training the cleaned data, and split them
into training and test sets is the next step.
• Test the Algorithm: Using the test dataset to examine its reliability on the new data in
order to evaluate the model’s accuracy and performance.
• Improving the Performance: Testing more data in order to refine the model, and if
necessary, choosing different models or adjusting the tests’ variables.
• Deployment: Deploying the model for the planned use, and utilize the gathered aspects to
refine more or develop new models.
Steps 2-7 are used repeatedly during different algorithms (Gupta & Bagchi, 2024, pp. 288
290).
2.2.1 Deep Learning
Deep learning, because of the big success in artificial intelligence, specially in the areas of
computer vision, natural language processing, machine translation and speech recognition,
is gained to be one of the popular research domains in machine learning. Deep learning is
used in many everyday applications, such as voice assistants, and computer vision-based
search engines. This success is possible because of the large amount of data availability,
known as big data, as well as the ability to compute data faster than before. Nowadays, it is
possible to transfer the computation from the computer’s CPU to its GPU. Transferring
calculations to computer clusters in local networks or the cloud is another strategy. The
process of training deep neural networks is known as deep learning. These models trained
by using a wide variety of architectures and techniques. The most common network is the
feed-forward neural network (FNN) used for independent and identical distributed data
(i.i.d.). In contrast, RNNs work better with sequential data, including time series, speech
data, natural language data and other types of data where the i.i.d. is not used. Time series
models in finance can handle non-Gaussianity, autocorrelation, volatility clustering, and
perhaps cycles and regimes. These stylized facts may be modeled with the use of deep
learning, and RNNs in particular. Accordingly, an RNN is more flexible where it can capture
the time-varying dynamics of the underlying system by encoding the temporal context in its
9 (46)
feedback connections. RNNs are a unique type of neural networks that, in theory, can
represent or approximate any nonlinear dynamical system to a certain level of accuracy
because of their internal self-connections (Guida, 2018, pp. 251277)
2.2.2 Long Short-Term Memory (LSTM)
Long short-term memory (LSTM), first introduced by Hochreiter and Schmidhuber in 1997,
is kind of RNN that solves the vanishing gradient problem and enables the network to
identify long-term relationships in sequential data. In case of handling long data sequences,
LSTMs are designed to hide the disadvantages of usual RNNs. They can do this by storing
the data in huge capacity memory cells. The primary function of LSTMs is to regulate the
information flow through the memory cells by means of a gating mechanism. Memory cells,
input gates, forget gates, and output gates are the main parts of LSTM architecture. While
the gates control the information flow, the memory cells store and update the data at any
time. LSTMs are highly suited for problems requiring long-term dependencies because of
their gating mechanisms, which enable them to selectively recall or forget information over
long-term periods. LSTMs are a popular option for the data processing based on a
sequence because they solve the vanishing gradient problem and capture dependencies
over time. They have also played an important role in deep learning advancement (Kaabar,
2024, pp. 235236).
2.2.3 Importance of Real-Time Data in ML
The development of real-time data processing can be connected with the increasing need
for fast access to data across a range of industries. In the beginning, financial markets
mostly used real-time technologies to make decisions quickly. But after that time, the need
for real-time capacities has grown in many different kinds of industries, such as
cybersecurity, manufacturing, healthcare, and telecommunications. Although real-time
processing has unparalleled benefits, there are negative aspects as well. The main issues
include scalability, latency, and the requirement for effective algorithms that can manage
data streams in real-time (Sasmal, 2023).
The algorithms of Machine learning play an important role in increasing the power of real-
time data processing systems. Real-time applications benefit a lot from online learning
techniques like the progressive learning, which update models many times because of a
new data existence. Algorithms for streaming, such as clustering and anomaly detection,
10 (46)
provide ways to handle data in real time without saving the complete dataset. The potential
for transformative results has been explained many times by researchers' growing
awareness of the harmony between machine learning and real-time data processing.
Organizations can move beyond reactive analytics to predictive and prescriptive analytics
by using machine learning algorithms into real-time processing pipelines. This integration
has been explained in different applications such as dynamic pricing in e-commerce, fraud
detection in financial transactions, and industrial predictive maintenance (Sasmal, 2023).
2.2.4 Basics of Stock Price Prediction in ML
Forecasting the direction of stock movement often influences a financial trader's choice to
purchase or sell an item, making it crucial for creating successful market trading methods.
Although a wide range of stock prediction methods have been created over time, it is still
subject to question if the majority of these methods consistently produce accurate
predictions or not. These stock prediction methods may be divided into the following few
categories:
Predictions are produced using fundamental analysis, which examines the underlying
businesses financial statements and macroeconomic variables. On the other hand,
technical analysis, in which only past prices and volumes are examined to make
predictions. Technical analysts believe that a stock's price already represents all publicly
accessible information, in contrast to fundamental analysts who try to determine a stock's
intrinsic worth using information that is readily available to the public. Technical analysis
relies on three foundations, everything is discounted by market action, trends drive price
changes, and history repeating itself. Sentiment analysis is the next process of prediction
by examining published reports, articles, and commentary on certain stocks. Sentiment
analysis is used widely in many fields, like in the stock market to determine how investors
feel generally about a given stock or the market as a whole. Among the three main groups
of stock prediction methods, sentiment analysis and technical analysis are used most often
for short-term predictions of a few days or less. In contrast, fundamental analysis is applied
for both short- and long-term prediction on yearly and quarterly schedules (Huang et al.,
2021).
11 (46)
2.3 Performance in Data Visualization
High performance is the first word comes to mind when talk about performance. In addition,
a high-performance data visualization indicating those better, quicker, and more efficient
charts than other solutions. High-performance charting libraries are divided into 6
characteristics based on their influence, and their usage in real world as Streaming live
charts with high data rates, High Refresh Rate, Minimal Lag, Full Accuracy Data, Resource
Efficiency, and Enhanced User Experience (Performance in Data Visualization: Why It
Matters?, 2024).
But, in order to test visualization libraries, focus must be set on a few essential metrics
gained from different analyses of high-performance charting libraries, like Rendering
Technology, GPU Acceleration, Library Collection, Algorithms, CPU and Resource
Consumption, Frames Per Second (FPS) or Refresh Rate, Load-Up Speed, and Data
Visualization Capacity. In general, These metrics enable to evaluate the scalability and
performance of visualization tools across various applications and platforms (Performance
in Data Visualization: Why It Matters?, 2024).
3 Methodology and Research Design
The following thesis uses a quantitative and experimental research methodology to test
and compare the performance of three GPU-accelerated data visualization libraries:
LightningChart Python, Plotly, and Bokeh. Testing the effectiveness of these libraries in
handling real-time data visualization in machine learning is the main goal of the study. This
study aims to measure the differences of performance metrics such as frame rates (FPS),
latency, scalability, and GPU utilization between the libraries. All of the libraries are tested
using the same methodology to ensure the benchmark objectives.
3.1 Tools and Technologies
Python is selected as the main programming language in this study, because of its
convenient ecosystem for machine learning and data visualization. Also, jupyter Notebooks
and Visual Studio Code are examples of development environments that make it easier to
code, run tests, and record findings have been used in this research.
12 (46)
The visualization libraries under study are LightningChart Python, a high-performance
GPU-accelerated rendering library using WebGL; Plotly, a JavaScript-based library with
strong support for interactive visualizations and GPU acceleration; and Bokeh, a Python
library that enables large dataset visualization and integrates with Datashader for GPU
acceleration.
PyTorch is the machine learning framework used in this study. This deep learning library
supports Metal Performance Shaders (MPS) backend which offers great support for Apple
Silicon GPUs and macOS systems. PyTorch provides a suitable environment for building,
training, and deploying deep learning models with GPU acceleration, that is essential for
the computation of complex tasks like time series prediction.
The hardware used for this study is a MacBook Pro, equipped with Apple M4 Max chip, 14-
Core CPU, 36GB of RAM, the SSD storge, and 32-Core of Apple Silicon GPU for
accelerated performance. Also, the software environment used in this study was as below:
• Operating System: Sequoia 15.3.1
• Python Version: 3.11.11
• Browser: Chrome 133.0.6943.142
• LightningChart Python: 1.1.0
• Bokeh: 3.6.3
• Plotly: 6.0.0
3.2 Data Collection and Machine Learning Model Development
Data was collected from Yahoo Finance using ticker symbols to make API calls or run web
scraping scripts, which gathered historical stock prices for training machine learning
models. When the data got trained, models generate predictions for future stock prices,
which are saved into CSV file to use for simulating the real-time data streaming. The saved
CSV prediction file is read in a loop, simulating a real-time data feed, which allows for
controlled benchmarking across all libraries.
A Long Short-Term Memory (LSTM) model using Pytorch has been used in this study. The
LSTM is a type of recurrent neural network (RNN) that particularly good in capturing
13 (46)
temporal dependencies in sequential data. This model is trained on time-series stock data
and validated for its prediction accuracy.
3.3 Performance Metrics and Benchmarking Procedure
In this study, all of the visualization libraries were compared using the following
performance metrics: Frame Rate (FPS), which counts the number of frames rendered per
second and shows smoother real-time visualization; Latency, which is the amount of time
that goes between receiving new data and rendering it on the visualization; Scalability,
which tests the libraries’ ability and show how they manage the growing amounts of data
without experiencing performance loss; and GPU Utilization, which shows how much each
library uses GPU for rendering.
The benchmarking procedure starts by preparing the environment for coding and installing
all the necessary Python libraries and tools for the project. Moreover, data preparation
includes training the machine learning models on the stock datasets and saving the
predictions for real-time simulation.
About the visualization implementation, the process starts by simulating the real-time data
using the predictions from the CSV file into the visualization libraries and continues by
showing those data into the charts of LightningChart Python, Plotly, and Bokeh. This
process ends by running some tests to measure the performance metrics such as FPS,
latency, and so on.
The benchmarking system measures the performance similarity using time module and
psutil between the libraries. The time module keeps an eye on rendering durations with
high precision to calculate the frame rate accurately, while psutil monitors other metrics like
CPU and memory usage. These measures are collected through identical custom classes
that calculate statistical aggregates (mean, min, max, standard deviation) to ensure a fair
comparison between the libraries performance in different scenarios.
3.4 Data Analysis
Data analysis contains a comparative analysis to analyze the collected data to compare
FPS, latency, scalability, and GPU usage between the three libraries. The results are
presented in charts and graphs to visualize the performance differences.
14 (46)
4 Implementation and Analytical Comparison of Models
In this section, a comprehensive review of the implementation code is discussed, which
focusing on different parts: how to use the LSTM model to predict the stocks’ prices, how to
implement the benchmarking metrics between the visualization frameworks to evaluate
different charting libraries and ends by the tests’ consistency factors between the libraries.
The code implementation details, data processing methods, and performance
measurement techniques are examined for each component.
4.1 Stock Price Prediction with LSTM Model
In this study, the Program Code 1 shows Pytorch used by a stock prediction model to
create a Long Short-Term Memory (LSTM) that is specially designed for time series
prediction. The code below also shows the essential library and device configuration import
that let the GPU acceleration to be enabled when available.
Program Code 1 Libraries Used for Stock Prediction Model
The model begins by fetching historical stock data from Yahoo Finance. As shown in
Program Code 2, this process includes not just price data but also the calculation of
technical indicators such as 5-day and 20-day moving averages, which gives additional
features for the prediction model.
15 (46)
Program Code 2 Loading the Datasets
def fetch_stock_data(tickers, start_date, end_date):
data = {}
for ticker in tickers:
try:
stock = yf.Ticker(ticker)
hist = stock.history(start=start_date, end=end_date, inter-
val="1d")
if hist.empty or len(hist) < 100:
print(f" {ticker}: Insufficient data")
continue
# Calculate Simple Moving Averages
hist['MA5'] = hist['Close'].rolling(window=5, min_peri-
ods=1).mean()
hist['MA20'] = hist['Close'].rolling(window=20, min_peri-
ods=1).mean()
# Basic Imports
data[ticker] = df
The data preprocessing pipeline showed in Program Code 3 is used to convert the raw
financial data into a format suitable for sequence-based models. This includes scaling the
data to the range [0, 1] using MinMaxScaler and creating sequences of fixed length for
training. The function also contains a complete error checking system to ensure the data
quality, including validation for NaN values at multiple stages.
Program Code 3 Preprocessing of the Datasets
16 (46)
The model continues by splitting the stock price sequences into three partitions: 70% for
training the LSTM model, 15% for validation during training to prevent overfitting, and 15%
for final performance testing as it shown in the Program Code 4. In order to keep the
statistical stability throughout the development process, this common machine learning
technique allows the model to learn from a good amount of data while being assessed on
unseen samples.
Program Code 4 Splitting the Dataset
Program Code 5 shows the neural network design that includes a fully connected layer and
an LSTM layer with 50 hidden units. Sequence-to-one prediction tasks, such as stock price
forecasting, are suitable for this approach.
Program Code 5 LSTM Model Setup
17 (46)
Program Code 6 shows the training process. In this procedure, some numbers of advanced
methods are used to improve the model stability and avoid overfitting. These methods
include Batch training with random shuffling, Mean Squared Error (MSE) loss function,
Adam optimizer with a learning rate of 0.001, Early stopping with a patience of 10 epochs,
and Best model checkpointing based on validation loss.
Program Code 6 Data Training Process
After training, the model can generate future price predictions shown in Program Code 7.
To make prediction, the last known sequence is taken, and the next value is predicted, then
incorporates that prediction into the sequence before predicting the next step. This method
allows for generating extended predictions ahead.
Program Code 7 Generating Predictions
18 (46)
The model evaluation process includes three key metrics: Mean Absolute Error (MAE),
Root Mean Squared Error (RMSE), and R² score. These metrics provide a comprehensive
assessment of prediction accuracy, as shown in Program Code 8.
Program Code 8 Model Evaluation Process
A comprehensive list of stock tickers (100 tickers) from a wide range of industries, including
healthcare, energy, automotive, technology and so on, are added in the program structure.
The algorithm is configured to predict the tickers’ stock prices by analyzing data from 2015
to 2025 as shown in Program Code 9.
Program Code 9 Importing the Stock Tickers
19 (46)
4.2 Data Visualization Benchmarking Framework
The second major category is an advanced benchmarking methodology for evaluating the
functionality of three data visualization libraries: Plotly, LightningChart, and Bokeh.
4.2.1 Common Benchmarking Frameworks
Program Code 10 shows the LibraryResultsSaver class, that provides consistent results
storage across all benchmarks.
Program Code 10 Applying a Library Results Saver Class
class LibraryResultsSaver:
def __init__(self, output_file="benchmark_results.json",
csv_file="benchmark_results.csv"):
self.output_file = output_file
self.csv_file = csv_file
self.results = []
# Load existing results if file exists
if os.path.exists(self.output_file):
try:
with open(self.output_file, 'r') as f:
self.results = json.load(f)
print(f"Loaded {len(self.results)} existing results")
except Exception as e:
print(f"Error loading existing results: {e}")
self.results = []
Program Code 11 shows the PerformanceMonitor class used by both Bokeh and Plotly to
record real-time metrics such as frames per second (FPS), CPU and memory use, and
render times.
Program Code 11 Applying a Class to Record Metrics
20 (46)
In addition, Bokeh and Plotly use shared DataGenerator and BenchmarkCollector classes
as shown in Program Code 12 and Program Code 13, keeping the data through a single
process.
Program Code 12 Data Generator Class in Bokeh and Plotly
class DataGenerator:
def __init__(self, csv_filename='future_stock_predictions.csv'):
self.csv_filename = csv_filename
self.raw_data = None
self.current_position = 0
self.data_loaded = False
self.numeric_columns = []
Program Code 13 Benchmark Collector Class in Bokeh and Plotly
class BenchmarkCollector:
def __init__(self, library_name):
self.library_name = library_name
self.results = []
self.has_saved_results = False
While LightningChart takes a different approach in these parts, it generates a separate
Python code for each benchmark configuration, that including both data generation and
performance monitoring into each script (Program Code 14).
Program Code 14 Equivalent Benchmarking Functions Used in LightningChart
21 (46)
Program Code 14 explains how the library arranges and effectively collects and analyzes
performance data by running each test as a separate subprocess. The results of these
subprocesses are then systematically sent into the file system using JSON format. Despite
these minor structural changes, the methodology used by all three frameworks to measure
performance metrics is the same.
4.2.2 Bokeh WebGL Visualization Benchmark
Program Code 15 shows the essential libraries imported for Bokeh. Bokeh needs the
tornado.ioloop module to run the charts on a Tornado server to create interactive
visualizations. It also uses special features such as ColumnDataSource for data
management and the Application class to create server-based applications. The building of
function-based applications is made possible by the FunctionHandler, which is important
for the benchmark's dynamic updates.
Program Code 15 Essential Libraries Imported for Bokeh
import pandas as pd
import numpy as np
import time
import psutil
import signal
import sys
import os
from datetime import datetime
import json
import threading
import atexit
import gc
# Bokeh-specific imports with WebGL backend
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource
from bokeh.server.server import Server
from bokeh.application import Application
from bokeh.application.handlers.function import FunctionHandler
from tornado.ioloop import IOLoop
import webbrowser
Bokeh uses WebGL backend for the GPU-acceleration rendering to do the benchmark.
Program Code 16 shows the benchmarking function, starts by creating a visualization
server which collects the performance metrics in the process of rendering data at a
specified frequency.
22 (46)
Program Code 16 Benchmarking Process for Bokeh
Program Code 17 shown the Bokeh application function, that creates line or scatter charts
with WebGL-accelerated rendering and sets up a periodic callback to update the data at
the specified frequency.
Program Code 17 Creating Charts for Bokeh Benchmarking
23 (46)
The data update callback, shown in Program Code 18, simulates real-time data streaming
by updating the visualization with new data chunks while recording performance metrics.
Program Code 18 Bokeh Real-Time Data Simulation
def update():
nonlocal update_count, last_metrics_time, callback_id, stop_benchmark
# Check if benchmark should stop
current_time = time.time()
if stop_benchmark or (current_time - start_time) > duration:
# Remove callback to ensure it doesn't run again
if callback_id is not None:
doc.remove_periodic_callback(callback_id)
# Save results once
try:
benchmark_collector.save_results()
except Exception as e:
print(f"Error saving results: {e}")
print("\nBenchmark completed!")
return False # Stop periodic callback
# Record start time for this frame
frame_start = time.time()
# Get data update
new_y = data_generator.get_next_data_chunk(source.data['y'],
chunk_size, complexity)
# Update source based on chart type
if chart_type == 'line':
# For line, shift data and add new points
updated_y = np.concatenate([source.data['y'][chunk_size:], new_y])
source.data.update({'y': updated_y})
else:
# For scatter, update random points
y_data = np.array(source.data['y'])
indices = np.random.choice(len(y_data), size=chunk_size,
replace=False)
for i, idx in enumerate(indices):
y_data[idx] = new_y[i]
source.data.update({'y': y_data})
# Calculate render time
render_time = time.time() - frame_start
# Record performance
performance_monitor.record_frame(render_time)
update_count += 1
24 (46)
4.2.3 LightningChart Visualization Benchmark
The LightningChart benchmark evaluates the LightningChart JS library, a visualization
solution designed for high-performance rendering. Program Code 19 show how test codes
are generated for each benchmark configuration.
Program Code 19 LightningChart Configuration and Essential Libraries Imported
def create_test_script(chart_type, data_points, complexity, duration,
csv_filename='future_stock_predictions.csv'):
"""Create a Python script for a single test configuration"""
script_name = f"lc_test_{chart_type}_{data_points}_{complexity}.py"
with open(script_name, 'w') as f:
f.write(f"""
import pandas as pd
import numpy as np
import time
import psutil
import os
import json
import gc
from datetime import datetime
import lightningchart as lc
# Set LightningChart license key
lc.set_license('my-license-key')
The LightningChart chart configuration, shown in Program Code 20, indicates several
performance optimizations specific to this library, including the disabling of animations and
the use of specialized chart types for large datasets.
Program Code 20 LightningChart Chart Configurations
25 (46)
The LightningChart benchmark includes specialized data handling for scatter plots with
large datasets, as shown in Program Code 21. It uses an optimized PointCloudSeries for
datasets with more than 10,000 points.
Program Code 21 LightningChart Dataset Optimization
# For large datasets, try to use optimized series if available
if data_points > 10000:
try:
series = chart.add_point_cloud_series()
print("Using optimized PointCloudSeries for large dataset")
except:
series = chart.add_point_series()
print("Using standard PointSeries")
else:
series = chart.add_point_series()
4.2.4 Plotly WebGL Visualization Benchmark
Program Code 22 shows the essential library imported for Plotly. The implementation of
this library focuses on plotly.graph_objects module, that provides the GPU-accelerated
Scattergl object used in the benchmarks. While Plotly doesn't require a dedicated server
like Bokeh, but it imports webbrowser module to automatically open the HTML files that is
generated. The make_subplots function is imported to support layouts with many plots,
though it's not actively used in the basic benchmark configurations.
Program Code 22 Essential Libraries Imported for Plotly
import pandas as pd
import numpy as np
import time
import psutil
import signal
import sys
import os
from datetime import datetime
import json
import threading
import gc
import plotly.graph_objects as go
import webbrowser
from plotly.subplots import make_subplots
26 (46)
The Plotly benchmark evaluates Plotly's WebGL acceleration capabilities. Program Code
23 shows the benchmark function, that configures and renders WebGL-accelerated Plotly
charts.
Program Code 23 Plotly Benchmarking Configurations
Unlike Bokeh, Plotly's benchmark uses data updates by creating new HTML files that are
refreshed in the browser automatically. Program Code 24 shows how HTML content is
modified to include a meta refresh tag.
Program Code 24 Plotly HTML Configurations
27 (46)
4.2.5 Comprehensive Benchmarking Execution
All three visualization libraries are tested with a comprehensive set of configurations to
evaluate their performance under different conditions. Program Code 25 shows the code
used in all of the benchmarks.
Program Code 25 A Comprehensive Configuration for All Libraries
28 (46)
4.3 Tests’ Consistency between Libraries
After examining the benchmarking code for all three visualization libraries, It is confirmed
that the data points and test conditions were designed to be equal between all of the
libraries. This method allows for fair comparisons between the libraries.
4.3.1 Data Points Consistency
All three libraries (Bokeh, LightningChart, and Plotly) use the same data point
configurations. About the data sizes, all libraries test with [100, 1000, 10000, 100000,
1000000] data points; and complexity levels, all use the same three complexity levels
(1=simple, 2=medium, 3=complex). The data source shows that all libraries use the same
DataGenerator method that loads data from the same CSV file. And finally, when creating
data with different complexity levels, the same weighting algorithm is used across all
libraries, shown in Program Code 26:
Program Code 26 Example of Complexity Level Setup
# For complexity level 3 (or if higher complexity needed)
for i, col in enumerate(self.numeric_columns[:3]): # Use up to 3 columns
weight = 0.7**i # First column has highest weight
numeric_col = pd.to_numeric(self.raw_data[col],
errors='coerce').fillna(0)
y_values += weight * numeric_col.values
4.3.2 Test Conditions Consistency
The test conditions are also kept consistent; all libraries use 30 seconds for each test; all
libraries test line and scatter charts; and all libraries skip higher complexity levels for very
large datasets, shown in Program Code 27:
Program Code 27 Example of Skipping Complexity Levels for Large Datasets
# Skip extremely large datasets for higher complexity
# to prevent excessive runtime
if size in [100000, 1000000] and complexity > 1:
continue
29 (46)
Also, all libraries collect the same metrics (FPS, CPU usage, memory usage, render times);
all of them target 60 FPS (frames per second); and finally, the libraries all run tests in the
same order (chart type → data size → complexity).
4.3.3 Consistency Tools Used
The Python time module, used in all three benchmarks for precise timing measurements,
tracks frame render times with frame_start = time.time() and render_time = time.time() -
frame_start, measures FPS calculation through self.current_fps = self.frame_count /
time_diff, and controls benchmark duration with if (current_time - start_time) > duration; the
psutil library, used across all benchmarks for system resource monitoring, measures CPU
usage with self.cpu_samples.append(psutil.cpu_percent(interval=0.1)), tracks memory
consumption with self.memory_samples.append(psutil.Process().memory_percent()), and
is incorporated in the PerformanceMonitor class shared by all benchmarks; the custom
metrics collection framework employs PerformanceMonitor and BenchmarkCollector
classes, make metrics like FPS, CPU usage, memory usage, and render times more
standard, and enables statistical aggregation including mean, min, max, standard
deviation, with JSON and CSV output for consistent cross-library analysis.
4.3.4 Implementation Differences
While the test parameters are the same, there are some differences in how the tests are
done. Bokeh uses a Bokeh server with periodic callbacks for data updates, while,
LightningChart uses generated Python codes executed as separate processes. In the other
hand, Plotly uses HTML files with meta refresh tags to simulate the real-time updates.
These differences are appeared because of the way each library handles data updates, but
the benchmark design tries to minimize their influence by using standard data, metrics
collection, and reporting methods. Moreover, the LibraryResultsSaver class guarantees all
results are saved in the same format with the same metrics, that allows for a performance
comparison between the three libraries despite their different technical implementations.
30 (46)
5 Results
This chapter presents a comprehensive benchmark results for LightningChart Python,
Bokeh, and Plotly between different data sizes, complexity levels, and chart types. The
analysis provides detailed performance comparisons and shows the optimal visualization
library for real-time machine learning applications. Due to the similarity of results across
complexity levels in the provided data, this chapter primarily focuses on complexity level 1
for consistency with the thesis approach. Moreover, the complexity effects discussed
separately in one part to show how different scenarios affected the result between the
libraries performance. Additional data points (e.g., 10,000,000 and 50,000,000 for LC PY)
are included where available to extend the scalability analysis.
5.1 Model Performance Evaluation
After training the LSTM model on historical stock data from 2015 - 2025, predictions were
created for 100 stocks over 2000 days to be sure about the amount of the data created for
real-time simulation. Predictions stored in CSV format with timestamps with different data
complexities. The model performance varies between different stocks as shown in Table 1,
which explains a range of predictive accuracy that reflects different real-world machine
learning scenarios.
Table 1 Model Performance Metrics on Selected Stocks
Ticker
R² Score
RMSE
MAE
AAPL
0.957
5.317
4.394
MSFT
0.965
7.554
6.206
GOOGL
0.962
4.048
3.089
NVDA
0.943
8.767
6.745
TSLA
0.973
11.471
7.946
Average
0.965
6.772
5.148
This dataset provides an ideal benchmark for visualization libraries, combining both the
scale and complexity of real-time machine learning results.
31 (46)
5.2 Performance Across Data Scales
The libraries were benchmarked across data sizes ranging from 100 to 1,000,000 points
(and up to 50,000,000 for LC PY), which reveal the scalability differences between the
libraries.
5.2.1 Small to Medium Datasets (100-10,000 points)
For datasets between 100 - 10,000 data points, all three libraries provided acceptable
performance suitable for real-time visualization:
Table 2 Performance Metrics for Line Charts with 100 Data Points
Library
Average
FPS
Min
FPS
Std
FPS
CPU
Usage
(%)
Memory
Usage
(%)
Render
Time
(ms)
LC PY
52.32
49.50
0.72
20.45
0.38
4.28
Bokeh
105.71
85.38
3.90
3.47
0.31
0.66
Plotly
45.16
26.68
3.57
4.31
0.36
1.83
Table 2 shows Bokeh achieving the highest average FPS (105.71), which more than LC PY
(52.32) and Plotly (45.16) significantly. However, Bokeh and Plotly showed higher FPS
irregularity (std FPS of 3.90 and 3.57, respectively) compared to LC PY (0.72), indicating
less consistent performance. LC PY consumed more CPU (20.45%) than Bokeh (3.47%)
and Plotly (4.31%), but its render time (4.28 ms) was higher than Bokeh (0.66 ms) and
Plotly (1.83 ms). Memory usage remained low across all libraries (<0.4%). Figure 2 shows
the test results of LightningChart, Bokeh and Plotly visualization libraries in line and scatter
charts.
32 (46)
Figure 2 LC PY, Bokeh and Plotly with 100 points test
Table 3 Performance Metrics for Line Charts with 1,000 Data Points
Library
Average
FPS
Min
FPS
Std
FPS
CPU
Usage
(%)
Memory
Usage
(%)
Render
Time
(ms)
LC PY
53.38
52.63
0.30
35.48
0.40
7.39
Bokeh
105.19
79.44
4.94
2.74
0.40
1.55
Plotly
46.40
43.81
0.53
5.13
0.46
1.95
Table 3 indicates Bokeh hold a high FPS (105.19), while LC PY (53.38) and Plotly (46.40)
remained lower. LC PY’s stability improved (std FPS 0.30), in contrast with Bokeh’s higher
inconstancy (4.94). CPU usage for LC PY increased sharply to 35.48%, compared to
Bokeh (2.74%) and Plotly (5.13%). Render times raised among all libraries, with LC PY at
33 (46)
7.39 ms, still higher than Bokeh (1.55 ms) and Plotly (1.95 ms). Figure 3 shows the test
results of LightningChart, Bokeh and Plotly visualization libraries in line and scatter charts.
Figure 3 LC PY, Bokeh and Plotly with 1,000 points test
Table 4 Performance Metrics for Line Charts with 10,000 Data Points
Library
Average
FPS
Min
FPS
Std
FPS
CPU
Usage
(%)
Memory
Usage
(%)
Render
Time
(ms)
LC PY
55.88
54.37
0.47
55.19
0.43
11.38
Bokeh
105.02
78.96
4.98
2.20
0.50
2.88
Plotly
49.19
46.32
0.56
2.93
0.54
3.29
And Table 4 shows Bokeh kept its FPS lead (105.02), followed by LC PY (55.88) and Plotly
(49.19). LC PY’s CPU usage jumped to 55.19%, beating Bokeh (2.20%) and Plotly (2.93%)
34 (46)
so far. Render times for LC PY (11.38 ms) were noticeably higher than Bokeh (2.88 ms)
and Plotly (3.29 ms), indicating that it was compensating for its steady frame rate. Figure 4
shows the test results of LightningChart, Bokeh and Plotly visualization libraries in line and
scatter charts.
Figure 4 LC PY, Bokeh and Plotly with 10,000 points test
5.2.2 Very Large Datasets (100,000 and 1,000,000 Points)
Table 5 and Table 6 show LightningChart Python kept a consistent FPS (55.91 at 100,000;
55.83 at 1,000,000), while Bokeh dropped to 43.37 and 5.00, and Plotly fell to 11.95 and
1.23.
35 (46)
Table 5 Performance Metrics for Line Charts with 100,000 Data Points
Library
Average
FPS
Min
FPS
Max
FPS
Std
FPS
CPU
Usage
(%)
Memory
Usage
(%)
Render
Time
(ms)
LC PY
55.91
54.89
56.84
0.39
55.11
0.64
11.34
Bokeh
43.37
29.13
47.77
4.17
19.00
0.65
13.72
Plotly
11.95
10.39
12.22
0.33
1.83
0.82
25.54
The tables also show LC PY’s render times remained stable (11.34–11.52 ms), in contrast
with Bokeh (13.72132.45 ms) and Plotly (25.54251.26 ms). CPU usage for LC PY stayed
high (55–56%), but Bokeh and Plotly’s efficiency declined by the rise of memory use (up to
2.63% for LC PY). Figure 5 below shows the test results of LightningChart, Bokeh and
Plotly visualization libraries in line and scatter charts.
Figure 5 LC PY, Bokeh and Plotly with 100,000 points test
36 (46)
Table 6 Performance Metrics for Line Charts with 1,000,000 Data Points
Library
Average
FPS
Min
FPS
Max
FPS
Std
FPS
CPU
Usage
(%)
Memory
Usage
(%)
Render
Time
(ms)
LC PY
55.83
51.89
56.80
0.94
56.56
2.63
11.52
Bokeh
5.00
1.85
5.36
0.80
18.04
1.60
132.45
Plotly
1.23
0.53
1.28
0.17
4.53
1.91
251.26
And finally, Figure 6 shows the test results of LightningChart, Bokeh and Plotly visualization
libraries in line and scatter charts.
Figure 6 LC PY, Bokeh and Plotly with 1,000,000 points test
37 (46)
5.2.3 Extreme Datasets (10,000,000 and 50,000,000 Points)
This part was done as an optional and additional work to evaluate how LightningChart
Python performs with extreme datasets. While its competitors struggled with datasets as
large as 1,000,000 data points, the results obtained below could be even more interesting.
Table 7 Performance Metrics for Line Charts with Extreme Data Sizes
Data
Points
Average
FPS
Min
FPS
Max
FPS
Std
FPS
CPU
Usage
(%)
Memory
Usage
(%)
Render
Time
(ms)
10,000,000
55.81
53.53
56.44
0.64
56.18
22.82
11.23
50,000,000
55.27
50.25
56.37
1.86
55.41
13.92
11.48
Table 7 shows LC PY experienced FPS above 55, although the variability increased at
50,000,000 points (std FPS 1.86). Memory usage raised at 22.82% for 10,000,000 points,
then dropped to 13.92% at 50,000,000, possibly because of optimization or data handling
differences not detailed in the provided data.
5.3 Chart Type Comparison
The benchmark tested line charts and scatter plots, showing performance differences
between the visualization types. Table 8 shows nearly the same LC PY performance
between chart types (55.88 vs. 55.89 FPS), with little differences in resource use. Bokeh’s
FPS decreased slightly for scatter plots (105.02 to 99.68), with increased CPU (2.20% to
7.75%) and memory usage (0.50% to 2.14%). Plotly remained consistent (49.19 vs. 49.32
FPS), but scatter plots used more memory (0.54% to 2.03%).
Table 8 Line vs. Scatter Chart Performance at 10,000 Points
Library
Chart
Type
Average
FPS
Min
FPS
Max
FPS
Std
FPS
CPU
Usage
(%)
Memory
Usage
(%)
Render
Time
(ms)
LC PY
Line
55.88
54.37
56.87
0.47
55.19
0.43
11.38
LC PY
Scatter
55.89
54.76
56.28
0.35
54.94
0.44
11.18
Bokeh
Line
105.02
78.96
106.76
4.98
2.20
0.50
2.88
Bokeh
Scatter
99.68
71.45
101.88
5.41
7.75
2.14
3.06
38 (46)
Plotly
Line
49.19
46.32
49.50
0.56
2.93
0.54
3.29
Plotly
Scatter
49.32
46.71
49.64
0.52
2.64
2.03
3.30
5.4 Effect of Complexity Levels
The benchmark evaluated three complexity levels to test how additional visual elements
and data transformations affect the performance of each library in different scenarios.
Table 9 Impact of Complexity on Performance (Line Charts, 10,000 Data Points)
Library
Complexity
Average
FPS
Min
FPS
Max
FPS
Std
FPS
CPU
Usage
(%)
Memory
Usage
(%)
Render
Time
(ms)
LC PY
1
55.88
54.37
56.87
0.47
55.19
0.43
11.38
LC PY
2
55.99
54.93
57.08
0.43
55.59
0.44
11.43
LC PY
3
56.22
55.11
56.67
0.38
58.92
0.44
11.91
Bokeh
1
105.02
78.96
106.76
4.98
2.20
0.50
2.88
Bokeh
2
105.05
77.33
107.83
5.30
2.95
0.52
2.73
Bokeh
3
104.86
77.78
106.42
5.17
3.18
0.54
3.66
Plotly
1
49.19
46.32
49.50
0.56
2.93
0.54
3.29
Plotly
2
49.19
45.73
49.59
0.67
3.78
0.56
3.31
Plotly
3
49.48
47.59
49.71
0.37
2.20
0.57
3.22
Table 9 shows LightningChart’s FPS little increase with complexity rise (55.88 to 56.22),
and also a moderate CPU growth (55.19% to 58.92%). Bokeh’s FPS remained stable
(105.02104.86), with minor rise in resource use. Plotly also showing small FPS change
(49.1949.48), with small changes in CPU and memory use.
5.5 Resource Utilization Analysis
Understanding resource utilization provides important insights into the efficiency and
optimization of visualization libraries. The results have been broken into three parts: CPU
Usage Patter, Memory Consumption Analysis and Render Time Analysis as discussed
separately in the next parts.
39 (46)
5.5.1 CPU Usage Patterns
Table 10 shows LC PY’s CPU usage jumped with data size (20.45% to 56.56%), stands
above 55% for large datasets. Bokeh remained efficient at smaller scales (23%) but rose
to 1819% for larger datasets. Plotly also indicated low CPU usage (1.835.13%).
Table 10 CPU Usage (%) by Data Size
Data Points
LC PY
Bokeh
Plotly
100
20.45
3.47
4.31
1,000
35.48
2.74
5.13
10,000
55.19
2.20
2.93
100,000
55.11
19.00
1.83
1,000,000
56.56
18.04
4.53
5.5.2 Memory Consumption Analysis
Memory usage patterns revealed different internal architecture approaches, as it shown in
Table 11, memory usage increased with data size, which showing LC PY reaching 2.63%
for 1,000,000 points, compared to Bokeh (1.60%) and Plotly (1.91%). In general, scatter
plots used more memory (e.g., 2.14% for Bokeh at 10,000 points as it shown in table 8).
Table 11 Memory Usage (%) by Data Size
Data Points
LC PY
Bokeh
Plotly
100
0.38
0.31
0.36
1,000
0.40
0.40
0.46
10,000
0.43
0.50
0.54
100,000
0.64
0.65
0.82
1,000,000
2.63
1.60
1.91
40 (46)
5.5.3 Render Time Analysis
Render time is a critical metric for real-time visualization performance. As it shown in Table
12, LC PY’s render times were stable (4.28–11.52 ms), while Bokeh and Plotly saw
growing increases at larger scales (132.45 ms and 251.26 ms at 1,000,000 points).
Table 12 Render Time (ms) by Data Size
Data Points
LC PY
Bokeh
Plotly
100
4.28
0.66
1.83
1,000
7.39
1.55
1.95
10,000
11.38
2.88
3.29
100,000
11.34
13.72
25.54
1,000,000
11.52
132.45
251.26
5.6 Stability and Consistency Analysis
Frame rate stability is a critical factor for real-time visualization, because poor performance
may affect user experience and result in significant lagging. The standard deviation of
frame rates provides insight into the consistency of visualization performance.
Table 13 FPS Standard Deviation by Data Size
Data Points
LC PY
Bokeh
Plotly
100
0.72
3.90
3.57
1,000
0.30
4.94
0.53
10,000
0.47
4.98
0.56
100,000
0.39
4.17
0.33
1,000,000
0.94
0.80
0.17
Table 13shows LightningChart having the most stable frame rates across all data sizes,
with standard deviations below 1.0 FPS. Bokeh showed higher inconstancy (standard
deviations of 4-5 FPS) for datasets up to 100,000 points, indicating fewer consistent
rendering cycles. Plotly, in the other hand, showed average stability for datasets up to
41 (46)
10,000 points, with better stability in larger datasets (however, at very lower frame rates).
This stability difference is important for real-time machine learning visualization, where
consistent updates are necessary for monitoring model performance without interruption.
5.7 Real-Time Machine Learning Suitability
Based on the comprehensive benchmark results, we can evaluate the suitability of each
library for real-time machine learning visualization scenarios briefly as shown in Table 14:
Table 14 Real-Time ML Visualization Suitability Matrix
Requirement
Data Size
LC PY
Bokeh
Plotly
Real-time Performance
1,000
✓✓✓
✓✓✓
✓✓
10,000
✓✓✓
✓✓✓
✓✓
100,000
✓✓✓
✓✓
1,000,000
✓✓✓
Consistency (FPS Stability)
1,000
✓✓✓
✓✓
10,000
✓✓✓
✓✓
100,000
✓✓✓
✓✓
1,000,000
✓✓
Resource Efficiency
1,000
✓✓
✓✓✓
✓✓
10,000
✓✓✓
✓✓
100,000
✓✓
✓✓
1,000,000
✓✓
✓✓
✓✓
Overall ML Suitability
1,000
✓✓✓
✓✓✓
✓✓✓
10,000
✓✓✓
✓✓✓
✓✓✓
100,000
✓✓✓
✓✓
1,000,000
✓✓✓
Legend: ✓✓✓ Excellent, ✓✓ Good, Adequate, Poor
42 (46)
LightningChart Python (LC PY) showed excellent suitability across all tested data scales
(1,000 to 1,000,000 points), with a significant strength in handling large datasets and
keeping consistent frame rates (average FPS ~55 across scales, with standard deviation
<1). Its higher CPU usage (3556%) and memory usage (up to 2.63% at 1,000,000 points)
are justified by consistent performance and excellent scalability, making it the most reliable
choice for large-scale ML visualization.
In the other hand, Bokeh indicated excellent performance for small to medium datasets (up
to 10,000 points) and achieved high frame rates (105.02105.19 FPS) with exceptional
resource efficiency (CPU 2.203.47%, memory 0.310.50%). However, its suitability
reduced a lot for datasets above 100,000 points, with FPS dropping to 43.37 at 100,000
and 5.00 at 1,000,000, showing that it’s not good enough for large-scale ML visualization.
And Plotly performed good enough for smaller datasets (up to 10,000 points), with frame
rates of 46.4049.19 FPS and excellent resource efficiency (CPU 2.935.13%, memory
0.360.54%). However, it became unsuitable for real-time visualization above 10,000
points, with FPS dropping to 11.95 at 100,000 and 1.23 at 1,000,000. However, for smaller-
scale applications, its simplicity of use and compatibility with data science methods
continue to be advantages. The recommended library is suggested based on the
visualization scenario as shown below in Table 15:
Table 15 Recommended Library by Visualization Scenario
ML Visualization Scenario
Data Scale
Recommended
Library
Model training progress
monitoring
Small (100-1,000)
Any library
Real-time prediction visualization
Medium (1,000-
10,000)
Any library
Time-series forecasting
visualization
Large (10,000-
100,000)
LC PY or Bokeh
Large-scale clustering
visualization
Very Large
(100,000+)
LC PY
Multi-dimensional data
exploration
Medium (1,000-
10,000)
Any library
High-frequency trading
visualization
Very Large
(100,000+)
LC PY
43 (46)
6 Summary
This study investigated the suitability of LightningChart Python (LC PY), Bokeh, and Plotly
for real-time machine learning (ML) visualization across datasets ranging from 1,000 to
1,000,000 points, and addressing the research questions of performance, consistency,
resource efficiency, and scalability for ML applications. The findings show unique strengths
for each library, according to their benchmark metrics and results that include frames per
second (FPS), stability (standard deviation of FPS), CPU and memory usage, and render
times.
LightningChart Python (LC PY) appeared as the best solution, showing an average FPS of
approximately 55 with excellent stability (standard deviation <1) across all tested metrics.
Its higher resource utilization (CPU 3556%, memory up to 2.63% at 1,000,000 points) is
justified by its consistent performance and ability to handle very large datasets (up to
50,000,000 points), making it the preferred choice for large-scale ML tasks such as time-
series predictions, clustering, and high-frequency trading visualization.
Bokeh shined in small to medium datasets (up to 10,000 points), delivering high FPS (105)
and exceptional resource efficiency (CPU <3.5%, memory <0.5%), ideal for model training
progress monitoring and real-time predictions at these scales. However, its performance
greatly destroyed above 100,000 points (FPS dropping to 5 at 1,000,000), that shows it’s
limitation for large-scale applications.
Plotly performed well enough for smaller datasets (up to 10,000 points) with moderate FPS
(4649) and excellent resource efficiency (CPU <5.13%, memory <0.54%), make it a good
choice for exploring multi-dimensional data. However, its FPS dropped below real-time
limits (11.95 at 100,000, 1.23 at 1,000,000), indicating it unsuitable for large-scale real-time
visualization. However, for smaller-scale applications, its usability and integration with data
science procedures continue to be beneficial.
Based on these findings, the study recommends LightningChart Python for large-scale and
very large-scale ML visualization scenarios (100,000+ points), Bokeh or Plotly for small to
medium scales (up to 10,000 points), and LC PY or Bokeh for intermediate large ones
(10,000100,000 points). These results meet the goals of the study by offering a complete
report for choosing visualization libraries that are appropriate to different data sizes and ML
visualization needs.
44 (46)
References
Belorkar, A., Guntuku, S. C., Hora, S., & Kumar, A. (2020). Interactive data visualization with python:
Present your data as an effective and compelling story, 2nd Edition (2nd ed). Packt Publishing.
Guida, T. (2018). Big Data and Machine Learning in Quantitative Investment (1st ed.). Wiley.
https://doi.org/10.1002/9781119522225
Gupta, P., & Bagchi, A. (2024). Essentials of Python for Artificial Intelligence and Machine Learning.
Springer Nature Switzerland. https://doi.org/10.1007/978-3-031-43725-0
Huang, Y., Capretz, L. F., & Ho, D. (2021). Machine Learning for Stock Prediction Based on
Fundamental Analysis. 2021 IEEE Symposium Series on Computational Intelligence (SSCI), 01
10. https://doi.org/10.1109/SSCI50451.2021.9660134
Jolly, K. (2018). Hands-on data visualization with Bokeh: Interactive web plotting for Python using Bokeh
(1st ed). Packt Publishing.
Kaabar, S. (2024). Deep learning for finance: Creating machine and deep learning models for trading in
Python (First edition). O’Reilly Media, Inc.
Kumar, R. (2023). Mastering Data Analysis with Python: A Comprehensive Guide to NumPy, Pandas,
and Matplotlib.
LightningChart® Python charts for data visualization. (2025). https://lightningchart.com/python-charts
Nelson, D. (2020). Data Visualization in Python. StackAbuse.
Performance in Data Visualization: Why it matters? (2024). https://lightningchart.com/blog/high-
performance-in-data-visualization
Pooja. (2023). Data Visualization with Python: Exploring Matplotlib, Seaborn, and Bokeh for Interactive
Visualizations. BPB Publications.
Sasmal, S. (2023). Real-time Data Processing with Machine Learning Algorithms. INTERNATIONAL
RESEARCH JOURNAL OF ENGINEERING & APPLIED SCIENCES, 11(4), 9196.
https://doi.org/10.55083/irjeas.2023.v11i04012
Vo. T.H, P., Czygan, M., Kumar, A., & Raman, K. (2017). Python: Data analytics and visualization:
understand, evaluate, visualize data: a course in three modules. Packt Publishing.
45 (46)
Zherlitsyn, D. (2024). Python for Finance: Data analysis, financial modeling, and portfolio management
(English Edition). BPB Publications.
46 (46)
Appendix 1: Material management plan
I will save my research materials in a secure location with many backups. I will repeatedly
store all of my papers, code, and data on my laptop and One Drive account. Strong
passwords and encryption will be used to protect sensitive data, including personal
information. Only those who are permitted will be able to access the data. To prevent
abuse in the study, copyrights are carefully evaluated many times. After the thesis is
approved, all research materials will be kept for a minimum of a year to allow for any
required follow-up verification. Appropriate disposal methods will be ensured after a year.