Skip to content

Commit

Permalink
update bar chart race to be shorter and limit to 5 vendors
Browse files Browse the repository at this point in the history
  • Loading branch information
cak committed Jan 5, 2025
1 parent 4be78d8 commit 0817806
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions markdown/cve_data_stories/vendor_cve_trends/05_visualizations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

---

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 0817806

Please sign in to comment.