diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 35eb1dd..a700638 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/README.md b/README.md index e69de29..75fe1e7 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,181 @@ +# 📊 Data Visualization with Matplotlib and Plotly + + +![Last Commit](https://img.shields.io/github/last-commit/DigiFenix777/python-crash-course-data-visualization-project) +![Top Language](https://img.shields.io/github/languages/top/DigiFenix777/python-crash-course-data-visualization-project) +![Repo Size](https://img.shields.io/github/repo-size/DigiFenix777/python-crash-course-data-visualization-project) +![Issues](https://img.shields.io/github/issues/DigiFenix777/python-crash-course-data-visualization-project) +[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) + + +## 🔑 Executive Summary +This project explores **Python-powered data visualization** through Matplotlib and Plotly, focusing on both **static and interactive charts**. While the examples center on mathematics and simulations (cubes, random walks, dice rolls), the same visualization techniques directly apply to **cybersecurity workflows**, such as: + +- Charting **attack frequency trends** over time. +- Mapping **geographic spread of incidents**. +- Creating interactive **dashboards for SOC and compliance reporting**. +- Communicating **risk insights to executives and auditors** with clarity. + +👉 For recruiters and hiring managers: this project demonstrates my ability to transform raw data into **meaningful, visual insights**—a critical competency for cybersecurity analysis, reporting, and decision-making. + +--- + +## 📌 Overview + +This project covers end-to-end **data visualization practices** using Matplotlib (static plots) and Plotly (interactive plots). Key topics include: + +- Plotting simple line and scatter graphs. +- Customizing styles, labels, colors, and tick marks. +- Using **colormaps** for clarity in large datasets. +- Saving plots automatically for portfolio inclusion. +- Simulating and visualizing **random walks**. +- Building **interactive dice roll simulations** with Plotly. + +--- + +## 🧠 Skills & Concepts + +- **Matplotlib basics** (line plots, scatter plots, colormaps). +- **Plotly Express** for interactive charting. +- Styling and scaling plots for readability. +- Object-oriented design with custom classes (`RandomWalk`, `Die`). +- Automating workflows with refactoring and list comprehensions. +- Professional Git/GitHub practices (branching, version control, repo hygiene). + +--- + +## 🗂️ Repository Structure + +```plaintext +data-visualization-project/ +│ +├── data/ # Input datasets or simulation outputs (empty) +│ +├── html/ # Exported Die Roll plots in HTML format +│ ├── dice_visual_2d8.html +│ └── dice_visual_d6d10.html +│ +├── images/portfolio/ # Exported static and interactive plots +│ ├── cubes_plot.png +│ ├── mod_random_walk_inferno.png +│ ├── mod_random_walk_purples.png +│ ├── random_walk_magma.png +│ ├── squares_plot.png +│ └── dice_multiplication.png +│ +├── src/ # Python scripts for lessons & exercises +│ ├── dice_visual.py +│ ├── dice_visual_2d8.py +│ ├── dice_visual_3d6.py +│ ├── dice_visual_d6d10.py +│ ├── dice_visual_multiply_2d6.py +│ ├── die.py +│ ├── die_visual.py +│ ├── main.py +│ ├── mod_rw_visual.py +│ ├── modified_random_walk.py +│ ├── molecular_motion.py +│ ├── molecular_visual.py +│ ├── mpl_squares.py +│ ├── random_walk.py +│ ├── rw_plotly.py +│ ├── rw_visual.py +│ ├── scatter_cubes.py +│ ├── scatter_squares.py +│ └── main.py +│ +├── tests/ +├── .gitattributes +├── .gitignore +├── LICENSE +├── README.md +└── requirements.txt +``` +## 🚀 How to Run + +Clone this repo and move into the folder: +```bash +git clone git@github.com:your-username/project-data-visualization.git +cd project-data-visualization +``` + +(Optional) Create a virtual environment: +```bash +python3 -m venv .venv +source .venv/bin/activate +``` + +Install dependencies: +```bash +pip install -r requirements.txt +``` + +Run any exercise script, for example: +```bash +python src/scatter_cubes.py +``` +## 🔎 Skills Spotlight + + +This project highlights: +- Python scripting for data visualization. +- Matplotlib & Plotly for both static and interactive charts. +- Designing simulations with object-oriented programming. +- Applying clean repo structure and GitHub portfolio practices. +- Building transferable skills for cybersecurity dashboards and incident reports. + + +--- + + +## 📝 Lessons Learned + +- Importance of styling and scaling plots for readability and accuracy. +- How random walks simulate unpredictable patterns (mirroring attacker behavior in networks). +- How dice simulations parallel probability and risk assessment in cybersecurity. +- Why reproducibility (requirements, clear structure, README) matters for collaboration and audits. +- How visualization bridges raw technical data and executive decision-making. + +--- + + +## 📊 Exercises Implemented + +- **15-1: Cubes** → Plotted cubic numbers (5 & 5,000 points). +- **15-2: Colored Cubes** → Applied a colormap to cubes plot. +- **15-3: Molecular Motion** → Simulated pollen grain motion with line plots. +- **15-4: Modified Random Walks** → Adjusted parameters to explore behavior. +- **15-5: Refactoring** → Simplified fill_walk() for readability and maintainability. +- **15-6: Two D8s** → Simulated and plotted results of rolling two 8-sided dice. +- **15-7: Three Dice** → Simulated rolling three D6 dice (min=3, max=18). +- **15-8: Multiplication** → Visualized results of multiplying two dice rolls. +- **15-9: Die Comprehensions** → Used list comprehensions to simplify dice simulations. + +--- + + +## 🌍 Data Sources + +Synthetic datasets generated in exercises (random walks, dice rolls). + +Exercises and examples adapted from Python Crash Course, 3rd Edition by Eric Matthes (No Starch Press). + + +--- + + +## 📚 Attribution + +Based on exercises from: +Matthes, E. (2023). Python Crash Course (3rd ed.). No Starch Press. +Book website + +--- + + +## 🧩 License + +Distributed under the MIT License. +See LICENSE for details. + +--- \ No newline at end of file diff --git a/html/dice_visual_2d8.html b/html/dice_visual_2d8.html new file mode 100644 index 0000000..cfcc91b --- /dev/null +++ b/html/dice_visual_2d8.html @@ -0,0 +1,3885 @@ + + + +
+
+ + \ No newline at end of file diff --git a/images/portfolio/cubes_plot.png b/images/portfolio/cubes_plot.png new file mode 100644 index 0000000..af9b14e Binary files /dev/null and b/images/portfolio/cubes_plot.png differ diff --git a/images/portfolio/mod_random_walk_inferno.png b/images/portfolio/mod_random_walk_inferno.png new file mode 100644 index 0000000..d9f883c Binary files /dev/null and b/images/portfolio/mod_random_walk_inferno.png differ diff --git a/images/portfolio/mod_random_walk_purples.png b/images/portfolio/mod_random_walk_purples.png new file mode 100644 index 0000000..27edd1e Binary files /dev/null and b/images/portfolio/mod_random_walk_purples.png differ diff --git a/images/portfolio/random_walk_magma.png b/images/portfolio/random_walk_magma.png new file mode 100644 index 0000000..324e4e0 Binary files /dev/null and b/images/portfolio/random_walk_magma.png differ diff --git a/images/portfolio/squares_plot.png b/images/portfolio/squares_plot.png new file mode 100644 index 0000000..01f40a4 Binary files /dev/null and b/images/portfolio/squares_plot.png differ diff --git a/src/dice_visual_2d10_list_comp.py b/src/dice_visual_2d10_list_comp.py index 5bc3b31..41246c7 100644 --- a/src/dice_visual_2d10_list_comp.py +++ b/src/dice_visual_2d10_list_comp.py @@ -23,5 +23,5 @@ # Further customize chart. fig.update_layout(xaxis_dtick=1) -fig.show() +# fig.show() # fig.write_html('../html/dice_visual_2d8.html', '') \ No newline at end of file diff --git a/src/mod_rw_visual.py b/src/mod_rw_visual.py index 86e61c9..de33ec3 100644 --- a/src/mod_rw_visual.py +++ b/src/mod_rw_visual.py @@ -1,4 +1,4 @@ -# Exercise 15.4 Modified Random Walks +# Exercise 15-5 Modified Random Walks import matplotlib.pyplot as plt from modified_random_walk import ModRandomWalk diff --git a/src/modified_random_walk.py b/src/modified_random_walk.py index 70a9a8d..c9eec94 100644 --- a/src/modified_random_walk.py +++ b/src/modified_random_walk.py @@ -1,4 +1,4 @@ -# Exercise 15-4 Modified Random Walks +# Exercise 15-4, 15-5 Modified Random Walks from random import choice diff --git a/src/molecular_motion.py b/src/molecular_motion.py index 835f2fd..79baf7d 100644 --- a/src/molecular_motion.py +++ b/src/molecular_motion.py @@ -24,9 +24,9 @@ ax.get_yaxis().set_visible(False) # Print plot to screen - # plt.show() + plt.show() # Save plot to file. - plt.savefig('15-3_molecular_motion.png', bbox_inches='tight') + # plt.savefig('15-3_molecular_motion.png', bbox_inches='tight') keep_running = input("Make another walk? (y/n): ") if keep_running == 'n': diff --git a/src/scatter_cubes.py b/src/scatter_cubes.py index 50341c3..30224fc 100644 --- a/src/scatter_cubes.py +++ b/src/scatter_cubes.py @@ -19,5 +19,5 @@ ax.axis([0, 6_000, 0, 140_000_000_000]) ax.ticklabel_format(style='plain') -# plt.show() -plt.savefig('cubes_plot.png', bbox_inches='tight') \ No newline at end of file +plt.show() +# plt.savefig('cubes_plot.png', bbox_inches='tight') \ No newline at end of file