Add scripts/graphs/analysis_graphs_py_inst.md

This commit is contained in:
2024-06-23 00:52:02 -06:00
parent 002d7d768f
commit 1cfa7f1327

View File

@@ -0,0 +1,118 @@
This script will generate the required charts and save them as `performance_per_dollar_recommended.png` and `combined_scores_recommended.png` in the same directory as the script.
### Updated Python Script:
```python
import matplotlib.pyplot as plt
# Data for Performance per Initial Dollar
systems = [
"Custom Built Server",
"MINISFORUM UM690S",
"MINISFORUM UM790 Pro",
"MINISFORUM UM690 Pro",
"Beelink SER5",
"CyberGeek Mini PC",
"KAMRUI Mini PC"
]
performance_per_dollar = [
19.08, 39.82, 29.08, 36.13, 34.66, 31.25, 32.58
]
# Data for Total Combined Score
combined_scores = [
27_004.6, 62_419.6, 34_209.8, 46_814.7, 57_024.5, 45_619.6, 45_619.6
]
# Recommended system
recommended_system = "MINISFORUM UM690S"
# Plot Performance per Initial Dollar
plt.figure(figsize=(10, 6))
bars = plt.barh(systems, performance_per_dollar, color='skyblue', height=0.5)
plt.xlabel('Performance per Initial Dollar')
plt.title('Performance per Initial Dollar for Each System')
plt.grid(True, axis='x', linestyle='--', alpha=0.7)
plt.gca().invert_yaxis()
plt.tight_layout()
# Add the actual numbers at the end of the bars
for bar, value in zip(bars, performance_per_dollar):
plt.text(value, bar.get_y() + bar.get_height()/2, f'{value:.2f}', va='center')
# Highlight the recommended system
for bar, system in zip(bars, systems):
if system == recommended_system:
bar.set_color('lightgreen')
plt.savefig('performance_per_dollar_recommended.png')
plt.show()
# Plot Total Combined Score
plt.figure(figsize=(10, 6))
bars = plt.barh(systems, combined_scores, color='lightgreen', height=0.5)
plt.xlabel('Total Combined Score')
plt.title('Total Combined Score for Each System')
plt.grid(True, axis='x', linestyle='--', alpha=0.7)
plt.gca().invert_yaxis()
plt.tight_layout()
# Add the actual numbers at the end of the bars
for bar, value in zip(bars, combined_scores):
plt.text(value, bar.get_y() + bar.get_height()/2, f'{value:.1f}', va='center')
# Highlight the recommended system
for bar, system in zip(bars, systems):
if system == recommended_system:
bar.set_color('skyblue')
plt.savefig('combined_scores_recommended.png')
plt.show()
```
### Instructions to run the script:
It looks like `pip` was installed in a directory that is not included in your system's PATH. To resolve this, you can add the directory to your PATH temporarily or permanently.
### Temporary Solution:
1. **Temporarily add the directory to your PATH**:
```bash
export PATH=$PATH:/home/datawarrior/.local/bin
```
2. **Verify pip is now accessible**:
```bash
pip --version
```
### Permanent Solution:
1. **Open your `.bashrc` file** (or `.bash_profile` or `.profile` depending on your system configuration) in a text editor:
```bash
nano ~/.bashrc
```
2. **Add the following line** at the end of the file:
```bash
export PATH=$PATH:/home/datawarrior/.local/bin
```
3. **Save the file and exit the text editor**.
4. **Apply the changes**:
```bash
source ~/.bashrc
```
### Installing matplotlib:
After adding the directory to your PATH, you can proceed with installing matplotlib:
```bash
pip install matplotlib
```
### Running the Python script:
Once matplotlib is installed, you can create the `generate_charts.py` script and run it:
```bash
python3 generate_charts.py
```
Heres a quick summary of commands for the temporary solution:
```bash
export PATH=$PATH:/home/datawarrior/.local/bin
pip install matplotlib
```