From 0817806817b35009a1f635e1338d300ecf2341ac Mon Sep 17 00:00:00 2001 From: cak Date: Sun, 5 Jan 2025 08:41:13 -0500 Subject: [PATCH] update bar chart race to be shorter and limit to 5 vendors --- .../vendor_cve_trends/05_visualizations.md | 12 ++++++------ .../vendor_cve_trends/05_visualizations.ipynb | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/markdown/cve_data_stories/vendor_cve_trends/05_visualizations.md b/markdown/cve_data_stories/vendor_cve_trends/05_visualizations.md index f744b4f..ee84cbb 100644 --- a/markdown/cve_data_stories/vendor_cve_trends/05_visualizations.md +++ b/markdown/cve_data_stories/vendor_cve_trends/05_visualizations.md @@ -18,7 +18,7 @@ jupyter: ## Bar Chart Race: Top 10 Vendors by CVE Count (2002–2024) -This script generates a dynamic bar chart race showcasing the top 10 vendors by CVE count over time (2002–2024). The visualization highlights trends and shifts in vulnerability disclosures across two decades in an engaging video format. +This script generates a dynamic bar chart race showcasing the top 5 vendors by CVE count over time (2002–2024). The visualization highlights trends and shifts in vulnerability disclosures across two decades in an engaging video format. --- @@ -46,7 +46,7 @@ This script generates a dynamic bar chart race showcasing the top 10 vendors by - **Fallback Colors**: Vendors without defined colors are assigned visually distinct fallback colors from a predefined color palette (`tab20`). 5. **Generate the Bar Chart Race**: - - Animates the top 10 vendors dynamically over time: + - Animates the top 5 vendors dynamically over time: - Bars update their values and order based on cumulative CVE counts. - Customizable parameters enhance readability and aesthetics. - Saves the animation as an `.mp4` file for high-quality sharing. @@ -87,7 +87,7 @@ This script generates a dynamic bar chart race showcasing the top 10 vendors by -```python jupyter={"is_executing": true} +```python import os import warnings @@ -257,11 +257,11 @@ bar_chart_race( filename=output_file, # Path to save the output file (e.g., .mp4 or .gif) orientation="h", # Horizontal bar chart orientation sort="desc", # Sort bars in descending order by value - n_bars=10, # Display the top 10 vendors at any given time + n_bars=5, # Display the top 5 vendors at any given time fixed_order=False, # Dynamically adjust the order of bars based on value fixed_max=True, # Keep the maximum value on the y-axis consistent across all frames - steps_per_period=20, # Number of steps (frames) per period for smoother transitions - period_length=600, # Duration of each period in milliseconds (controls animation speed) + steps_per_period=10, # Number of steps (frames) per period for smoother transitions + period_length=400, # Duration of each period in milliseconds (controls animation speed) interpolate_period=True, # Smoothly interpolate values between periods label_bars=True, # Display values as labels inside the bars bar_size=0.85, # Adjust bar thickness (0.85 means bars take up 85% of the space) diff --git a/notebooks/cve_data_stories/vendor_cve_trends/05_visualizations.ipynb b/notebooks/cve_data_stories/vendor_cve_trends/05_visualizations.ipynb index 3ff75b5..ba90ae9 100644 --- a/notebooks/cve_data_stories/vendor_cve_trends/05_visualizations.ipynb +++ b/notebooks/cve_data_stories/vendor_cve_trends/05_visualizations.ipynb @@ -12,7 +12,7 @@ "source": [ "## Bar Chart Race: Top 10 Vendors by CVE Count (2002–2024)\n", "\n", - "This script generates a dynamic bar chart race showcasing the top 10 vendors by CVE count over time (2002–2024). The visualization highlights trends and shifts in vulnerability disclosures across two decades in an engaging video format.\n", + "This script generates a dynamic bar chart race showcasing the top 5 vendors by CVE count over time (2002–2024). The visualization highlights trends and shifts in vulnerability disclosures across two decades in an engaging video format.\n", "\n", "---\n", "\n", @@ -40,7 +40,7 @@ " - **Fallback Colors**: Vendors without defined colors are assigned visually distinct fallback colors from a predefined color palette (`tab20`).\n", "\n", "5. **Generate the Bar Chart Race**:\n", - " - Animates the top 10 vendors dynamically over time:\n", + " - Animates the top 5 vendors dynamically over time:\n", " - Bars update their values and order based on cumulative CVE counts.\n", " - Customizable parameters enhance readability and aesthetics.\n", " - Saves the animation as an `.mp4` file for high-quality sharing.\n", @@ -85,8 +85,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2025-01-05T13:10:58.590215Z", - "start_time": "2025-01-05T13:03:34.083722Z" + "end_time": "2025-01-05T13:39:15.508308Z", + "start_time": "2025-01-05T13:36:46.755819Z" } }, "cell_type": "code", @@ -260,11 +260,11 @@ " filename=output_file, # Path to save the output file (e.g., .mp4 or .gif)\n", " orientation=\"h\", # Horizontal bar chart orientation\n", " sort=\"desc\", # Sort bars in descending order by value\n", - " n_bars=10, # Display the top 10 vendors at any given time\n", + " n_bars=5, # Display the top 5 vendors at any given time\n", " fixed_order=False, # Dynamically adjust the order of bars based on value\n", " fixed_max=True, # Keep the maximum value on the y-axis consistent across all frames\n", - " steps_per_period=20, # Number of steps (frames) per period for smoother transitions\n", - " period_length=600, # Duration of each period in milliseconds (controls animation speed)\n", + " steps_per_period=10, # Number of steps (frames) per period for smoother transitions\n", + " period_length=400, # Duration of each period in milliseconds (controls animation speed)\n", " interpolate_period=True, # Smoothly interpolate values between periods\n", " label_bars=True, # Display values as labels inside the bars\n", " bar_size=0.85, # Adjust bar thickness (0.85 means bars take up 85% of the space)\n",