{"id":3496,"date":"2025-11-12T08:06:20","date_gmt":"2025-11-12T13:06:20","guid":{"rendered":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/?p=3496"},"modified":"2025-11-14T14:43:27","modified_gmt":"2025-11-14T19:43:27","slug":"exploratory-data-analysis-using-sparklines-and-summary-statistics-in-live-scripts","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/2025\/11\/12\/exploratory-data-analysis-using-sparklines-and-summary-statistics-in-live-scripts\/","title":{"rendered":"Data Exploration Using Sparklines and Summary Statistics in Live Scripts"},"content":{"rendered":"Did you know you can explore visualizations and basic statistics of tabular data directly within a live script without writing a single line of code? You can also change data types, sort, and filter tabular data using interactive workflows and MATLAB will generate the corresponding code for reproducibility. This guide will help you get started with a new interactive workflow.\r\n<table style=\"background-color: #e2f0ff\">\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 120px;padding: 3px;vertical-align: middle\"><img decoding=\"async\" class=\"aligncenter size-medium\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/RanjaniRajagopalan.jpg\" alt=\"Portrait of Ranjani Rajagopalan\" \/><\/td>\r\n<td style=\"vertical-align: middle;padding: 3px\"><strong>Guest Writer: <a href=\"https:\/\/www.linkedin.com\/in\/ranjani-rajagopalan-4825b623\/\" target=\"_blank\" rel=\"noopener\">Ranjani Rajagopalan<\/a>\r\n<\/strong>Ranjani Rajagopalan is a Senior Software Engineer in the MATLAB App Designer team. She first joined Mathworks as a part of the Engineering Development Group (EDG) in 2014, bringing a strong foundation in Big Data and Web Development. Since then, she has made contributions to enhancing data-centric workflows in core MATLAB, designing and developing capabilities to allow users to visualize and interact with rich displays of MATLAB\u2019s datatypes in the GAAB group. She has worked on bringing interactivity to visually explore and transform data in tools like the Variable Editor, Workspace Browser as well as rich displays of variables in Live Scripts. Currently, she is focused on expanding the capabilities of App Designer to support more robust engineering workflows. Outside of work, she enjoys collaborating on community tech projects and exploring through travel.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n&nbsp;\r\n\r\n<hr \/>\r\n\r\n<div class=\"rtcContent\">\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Many of you might have used live scripts to explore and analyze data in a document format in MATLAB. While you can see table display in various contexts in MATLAB, the live scripts have interactive capabilities available inline within the table display to make data exploration faster and intuitive by also generating code thereby allowing users to re-create workflows. In version 24a, MATLAB introduced new features to live scripts that aim to refine the data analysis process for users.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">When you import table data using functions like <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/readtable.html\" target=\"_blank\" rel=\"noopener\"><span style=\"text-decoration: underline;font-family: monospace\">readtable<\/span><\/a>, you might not know what the data contains or where to start. Live scripts offer a high-level data exploration workflow to display table data as <span style=\"font-weight: bold\">sparklines <\/span>which are a visual representation of data trends and variations over time. The live script also displays <span style=\"font-weight: bold\">summary statistics<\/span> that aim to give a quick metric-based snapshot of the table data. Sparklines appear above each variable, showing trends or frequency distributions, while summary stats like mean, median, and missing values appear just below the header. These features help you quickly spot data types, distributions, and potential issues with no coding required. The new lightweight table design and row striping also improve readability, and these enhancements work across nested tables too.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"978\" height=\"392\" class=\"size-full wp-image-3497 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic1-SparklinesStatsPreview.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">The following sections will provide a closer look at how sparklines and summary statistics can be enabled and utilized for data analysis within MATLAB's live scripts. Live scripts allow you to import data and view the raw table data as well as perform certain interactions like sorting and filtering that aid iterative data analysis. In this post, we are going to walk through an example that demonstrates how these new visualizations can be leveraged to derive insights and analyze data intuitively on the table without having to write any code or launch an external application.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">I have picked the airlines data to uncover insights into flight patterns, delays, and cancellations using these new features. Access the <span style=\"font-family: monospace\">airlinessmall.csv<\/span> file from the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/import_export\/analyze-big-data-in-matlab-using-tall-arrays.html\" target=\"_blank\" rel=\"noopener\">documentation<\/a><\/div>\r\n<div class=\"preformatted-matlab\" style=\"margin: 10px 3px 10px 55px;padding: 10px 10px 10px 5px\">\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">openExample(<span style=\"color: #a020f0\">'matlab\/AnalyzeBigDataInMATLABUsingTallArraysExample'<\/span>)<\/div>\r\n<\/div>\r\n<h2 style=\"margin: 20px 10px 5px 4px;padding: 0px;line-height: 25px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 20px;font-weight: bold;text-align: left\">Step 1: Import airlines data in Live Script<\/h2>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">You can bring data into Live Scripts in several ways. Here, we use <span style=\"font-family: monospace\">readtable<\/span> to load the airlines dataset into the MATLAB workspace. Alternatively, the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/importdatatask.html\" target=\"_blank\" rel=\"noopener\"><span style=\"text-decoration: underline\">Import Live Task<\/span><\/a> offers more control over data selection and transformation. Once loaded, the table appears in the Live Script output, where you can scroll through it to view all the variables and get a quick sense of the variables in the table.<\/div>\r\n<div style=\"background-color: #f5f5f5;margin: 10px 15px 10px 0;min-width: 100%\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-radius: 4px 4px 0px 0px;padding: 6px 45px 0px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace, Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\"><span style=\"color: #339966\">% Import airlines dataset and display the imported table variable<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-radius: 0px 0px 4px 4px;padding: 0px 45px 4px 13px;line-height: 18.004px;min-height: 0px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace, Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 14px\">airlinesData =readtable(<span style=\"color: #a020f0\">'airlinessmall.csv'<\/span>)<\/div>\r\n<\/div>\r\n<\/div>\r\n<div style=\"margin: 10px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"654\" height=\"262\" class=\"size-full wp-image-3498 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic2-ReadtableStep.png\" alt=\"\" \/><\/div>\r\n<h2 style=\"margin: 20px 10px 5px 4px;padding: 0px;line-height: 25px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 20px;font-weight: bold;text-align: left\">Step 2: Explore table by displaying Sparklines and Summary Statistics<\/h2>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">If this is a table that you have not encountered before, you may want to understand certain characteristics of the data to decide if the data needs preparation or cleaning before further in-depth analysis. The output table contains interactive data exploration tools that help in every stage of data analytic workflows. You can right-click on the table and see new context menu options that allow you to turn on \u2018Sparklines\u2019 and \u2018Summary Statistics\u2019.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"1029\" height=\"259\" class=\"size-full wp-image-3499 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic3-ContextMenuOptions.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">The output display will update to show visualizations and summary statistics inline on the headers of the table variables. The visual cues and summaries can help identify the datatypes (e.g., double, categorical, string) without needing to write any additional code. This is a convenient way to decide if the table data needs any datatype conversions. For e.g., flight carriers (<span style=\"font-family: monospace\">UniqueCarrier<\/span>) might be better suited to be a categorical rather than cell for text analytics workflows.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">You can scroll horizontally on the output to see sparklines and statistics on every variable of the table.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"1251\" height=\"388\" class=\"size-full wp-image-3500 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic4-FeatureTurnedOn.png\" alt=\"\" \/><\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px;padding: 0px;line-height: 20.4px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\">Interact with sparklines to derive insights<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">By looking at the sparklines and statistics, we can now gain immediate insights to understand the data distribution and draw preliminary conclusions. For instance, this data has airline information from 1987-2008 (as indicated by the <span style=\"font-weight: bold\">Min <\/span>and <span style=\"font-weight: bold\">Max <\/span>values). The thumbnail sparkline visualizations above each variable are also interactive, you can hover on them to get information on bins of data (for unique integer values like Years) and records of data like <span style=\"font-family: monospace\">ArrTime<\/span>. We understand by hovering on the first bin in year that there were 1311 flight records for the 1986-1987 timeframe.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"367\" height=\"227\" class=\"size-full wp-image-3501 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic5-HoverTipsOnYear.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">I now see a text-based variable like <span style=\"font-family: monospace\">UniqueCarrier <\/span>and would like to explore this further. You can hover to see that the airlines are binned together with two airlines represented in each bin.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"394\" height=\"225\" class=\"size-full wp-image-3502 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic6-HoverTipsOnUniqueCarrier.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">To see the unique airlines and their flight record count, users can interactively resize the table variable. This expands the bins so we can see the number of flight records for each unique airline carrier. By hovering on the longest bar, we see that delta airline (DL) has the greatest number of flight trips in this table. The hover tooltips and histogram representation aid in quick frequency analysis of text based or unique integer-based data.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"594\" height=\"223\" class=\"size-full wp-image-3503 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic7-ExpandBinsOnDL.png\" alt=\"\" \/><\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px;padding: 0px;line-height: 20.4px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\">See live updates to sparklines and statistics as you clean the data.<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">With pre-computed statistics on each variable, we can better understand the data just by looking at the values. Looking at the <span style=\"font-family: monospace\">AirTime<\/span>, we know that the average airtime (<span style=\"font-weight: bold\">Mean value <\/span>on <span style=\"font-family: monospace\">AirTime<\/span>) is 233.5 minutes spanning 29 unique airlines (<span style=\"font-weight: bold\">Unique value <\/span>on <span style=\"font-weight: bold;font-family: monospace\">UniqueCarrier<\/span><span style=\"font-weight: bold\">) <\/span>with a standard deviation of 549.8 miles for the distance covered (<span style=\"font-weight: bold\">Std Dev <\/span>on <span style=\"font-weight: bold;font-family: monospace\">Distance<\/span><span style=\"font-weight: bold\">)<\/span>. As a part of prepping data for analysis, users might be interested in looking at variables that have missing values that might make sense to clean. We\u2019ll clean the data in three steps.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-weight: bold\">1. Modify datatype<\/span> of <span style=\"font-weight: bold;font-family: monospace\">UniqueCarrier<\/span>: We saw in the previous step that <span style=\"font-weight: bold;font-family: monospace\">UniqueCarrier <\/span>was imported as a cell and binned accordingly. To better represent this variable, we would like to convert this to a categorical datatype. Users can right-click by selecting the variable and choose the \u2018Convert from cell to' option.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"529\" height=\"357\" class=\"size-full wp-image-3504 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic8-DataTypeConversion.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">This converts this variable to type \u2018categorical\u2019 and the sparkline immediately updates to show bins in descending order. We can hover on the tallest bin and deduce that Delta airline has the maximum number of flights in these data with count 16,578. Also note that interactively changing the datatype resulted in the appearance of a code section below with buttons to \u201cUpdate Code\u201d and \u201cCopy\u201d the auto-generated code that corresponds to the interactive change. Clicking on \u201cUpdate Code\u201d will move the generated code onto the code section for execution and reproducibility of the interactions.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"741\" height=\"438\" class=\"size-full wp-image-3505 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic9-UniqueCarrierConversion.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-weight: bold\">2. Remove missing<\/span>: An initial scan of the data by looking at the <span style=\"font-weight: bold\">Missing count in <\/span><span style=\"font-weight: bold;font-family: monospace\">DepTime<\/span> and <span style=\"font-weight: bold;font-family: monospace\">ArrTime<\/span> reveals that there are ~2k flights that do not have Arrival or Departure time. We would like to remove these missing values from the data for further analysis. Users can click on the header menu to launch the interactive filtering dialog that also allows removal of missing values from the data. I can now remove any missing records from <span style=\"font-family: monospace\">ArrTime<\/span> and <span style=\"font-family: monospace\">DepTime <\/span>by unchecking the \u2018Include missing\u2019 checkbox within the filtering dialog. With filters applied on the table, the statistics are now automatically re-computed and reflect that there are no missing values (Missing 0).<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"895\" height=\"455\" class=\"size-full wp-image-3506 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic10-RemoveMissing.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-weight: bold\">3. Remove data outside bounds<\/span>: Now that we have a sense of the data, I would like to analyze the delay columns for potential correlations. On closer inspection, I notice that the Departure delay (<span style=\"font-weight: bold;font-family: monospace\">DepDelay<\/span>) and Arrival Delay (<span style=\"font-weight: bold;font-family: monospace\">ArrDelay<\/span>) have negative values which could distort our analysis focused on delays. Since I am only interested in flights that have positive delays, I can use the same filtering dialog to filter these records and eliminate noise such that we only retain entries that have actual delays. After applying the filter, our data is now down to ~37k records that we can accept by clicking on \u201cUpdate Code\u201d and proceed to analyze further.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"809\" height=\"485\" class=\"size-full wp-image-3507 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic11-RemoveDataOutOfBounds.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Accepting the code and re-running the section will now re-run airlines data with the filtered times. The sparklines and stats are automatically displayed for subsequent displays of the same variable. We have demonstrated simple cleaning operations from within the table. For more advanced cleaning operations, you can use <a href=\"https:\/\/www.mathworks.com\/discovery\/data-cleaning.html#data-cleaning-with-matlab\" target=\"_blank\" rel=\"noopener\"><span style=\"text-decoration: underline\">Cleaning Live Tasks or the Data Cleaner App.<\/span><\/a><\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px;padding: 0px;line-height: 20.4px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\">Analyze data using Sorting and Filtering<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-weight: bold\">1. Analyze destinations having a delay for flights starting from Boston<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">With the cleaned airlines data, I would now like to analyze the destinations originating from Boston that were delayed. To begin with, we filter the <span style=\"font-family: monospace\">Origin<\/span> variable to reduce the data to flights departing from Boston. The sparklines of the delay columns automatically update to show arrival and departure delay for these flights originating from Boston.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"845\" height=\"438\" class=\"size-full wp-image-3508 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic12-FilterForBoston.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Sorting the <span style=\"font-family: monospace\">DepDelay<\/span> variable in descending order will now sort the data to list records in order of their decreasing delays (Largest delays first). Since sparklines have live updates with sorting and filtering operations, we can visually evaluate the <span style=\"font-family: monospace\">ArrDelay<\/span> sparkline data to see that the two delays appear correlated. This concludes that flights that had a departure delay also had delayed arrivals at destination.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"784\" height=\"457\" class=\"size-full wp-image-3509 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic13-SortDepartureDelay.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">We see that of all the 646 flights leaving Boston, the flight to JFK has a maximum departure delay of 437 minutes (~7.2 hours). Mind you, we still have not written any code!<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"880\" height=\"457\" class=\"size-full wp-image-3510 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic14-JFKMaxDelay.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">By looking at the Year \/ Month variables, we can see that this flight departed in June 2007. Knowing Boston, weather-related delays are a year-round tradition, Let\u2019s look at the delay columns to further analyze.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"668\" height=\"457\" class=\"size-full wp-image-3511 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic15-YearMonthOfDelay.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Looking at the delay related variables tell us that this was an NAS Delay (Delay attributed to the National Aviation System). This example illustrates how we can uncover patterns and understand records of data with these interactive features.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"934\" height=\"455\" class=\"size-full wp-image-3512 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic16-NASDelay.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-weight: bold\">2. Analyze destinations with most flights and airline carriers from Boston for the years 2000-2008.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">With the same table filtered from the previous analysis, I would now like to analyze the busiest destinations for flights originating from Boston in recent years. Since the data spans from 1987 to 2008, I will filter years from 2000-2008.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"676\" height=\"457\" class=\"size-full wp-image-3513 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic17-FilterByYear.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">I can now look at the <span style=\"font-family: monospace\">destination <\/span>variable to show individual bins and see that <span style=\"font-family: monospace\">JFK <\/span>has the tallest bar, indicating that most flights from Boston flew to New York. Now for a single source (BOS) \u2192 Destination (JFK), we can see that there are 29 unique airline carriers with MQ (From American airlines group) having the most flights.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"917\" height=\"456\" class=\"size-full wp-image-3514 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic18-MostFlightsToJFK.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"679\" height=\"454\" class=\"size-full wp-image-3515 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic19-UniqueCarrierWithMostFlights.png\" alt=\"\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Once done with the analysis, users can save their changes after accepting the code to get a reproducible version of this script and decide to turn off the Sparklines and Summary Statistics using context menu options to hide these visual aids.<\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px;padding: 0px;line-height: 20.4px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\"><span style=\"font-weight: bold\">Explore visually using the Variable Editor<\/span><\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Some of you might be more familiar with the Variable Editor tool for getting quick insights into your data and plotting to visualize your data. You can also take advantage of this feature by double clicking on a workspace variable to launch the \u201c<a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_env\/create-and-edit-variables.html#bvdmac1-1\" target=\"_blank\" rel=\"noopener\"><span style=\"text-decoration: underline\">Variable Editor<\/span><\/a>\u201d and turn Sparklines\/ Summary Statistics on using a similar context menu affordance by right clicking on the headers. This gives you the same quick-glance insights\u2014like data trends, value distributions, and missing counts\u2014directly within the Variable Editor, without needing to write code. For a consistent experience across all tables, you can also turn these features on by default via the MATLAB \u201c<a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/preferences.html\" target=\"_blank\" rel=\"noopener\"><span style=\"text-decoration: underline\">Settings<\/span><\/a>\u201d window from the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_env\/set-workspace-and-variable-preferences.html\" target=\"_blank\" rel=\"noopener\"><span style=\"text-decoration: underline\">Settings -&gt; Variables<\/span><\/a> section.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" width=\"794\" height=\"582\" class=\"size-full wp-image-3516 alignnone\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic20-VariableEditorDisplay.png\" alt=\"\" \/><\/div>\r\n<h2 style=\"margin: 20px 10px 5px 4px;padding: 0px;line-height: 25px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 20px;font-weight: bold;text-align: left\">Discussion<\/h2>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">We have seen how we can perform powerful exploratory analysis with the sparklines, and summary statistics feature along with existing tools like sorting and filtering on tables in live scripts. There are many types of explorations that can now be performed with this widget using a combination of all the features. Users can use insights from this display to inform the next steps in advanced analysis workflows using toolboxes or use the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/add-live-editor-tasks-to-a-live-script.html\" target=\"_blank\" rel=\"noopener\"><span style=\"text-decoration: underline\">'Visualize Live Task<\/span><\/a>' in live scripts to create advanced visualizations using the plots and charts that are supported in Matlab. We'd love to hear your thoughts in the comments section below!<\/div>\r\n<ul style=\"margin: 10px 0px 20px;padding-left: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size: 14px\">\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\">Would you like to see any enhancements to the sparklines feature?<\/li>\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\">Would you like to see additional summary statistics or customize them for your use cases?<\/li>\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\">Would you like to export these graphics and stats to share scripts with a colleague?<\/li>\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\">Would you like to see sparklines and summary statistics in app-building workflows?<\/li>\r\n<\/ul>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Let us know in the comments below or by using the \u201cFeedback\u201d button from the MATLAB desktop (available starting in R2025a).<\/div>\r\n&nbsp;\r\n\r\n<\/div>\r\n<script type=\"text\/javascript\">\r\n{ let css = '';\r\nlet head = document.head || document.getElementsByTagName('head')[0];\r\nlet style = document.createElement('style');\r\nhead.appendChild(style);\r\nstyle.type = 'text\/css';\r\nif (style.styleSheet) {\r\n    style.styleSheet.cssText = css;\r\n} else {\r\n    style.appendChild(document.createTextNode(css));\r\n}\r\n\r\n\r\n}<\/script>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/11\/Sparklines-Pic0-SparklinesStatsPreview.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>Did you know you can explore visualizations and basic statistics of tabular data directly within a live script without writing a single line of code? You can also change data types, sort, and filter... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/graphics-and-apps\/2025\/11\/12\/exploratory-data-analysis-using-sparklines-and-summary-statistics-in-live-scripts\/\">read more >><\/a><\/p>","protected":false},"author":198,"featured_media":3523,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11,2],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/posts\/3496"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/users\/198"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/comments?post=3496"}],"version-history":[{"count":13,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/posts\/3496\/revisions"}],"predecessor-version":[{"id":3532,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/posts\/3496\/revisions\/3532"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/media\/3523"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/media?parent=3496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/categories?post=3496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/tags?post=3496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}