Files
HomeLabDataCenter/scripts/graphs/analysis_graphs_py_inst.md

173 lines
5.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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()
```
If `pip` is not recognized as a command, it might be because it is not installed or not added to your system's PATH. Here are steps to address this:
1. **Ensure Python and pip are installed**:
- If you are on Windows, you can download the Python installer from [python.org](https://www.python.org/downloads/). During installation, make sure to check the option to "Add Python to PATH".
- If you are on macOS or Linux, Python might already be installed. You can check by running `python --version` or `python3 --version` in the terminal.
2. **Installing pip**:
- If Python is installed but pip is not, you can install pip manually. Download `get-pip.py` by running:
```bash
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
```
- Then run the following command to install pip:
```bash
python get-pip.py
```
3. **Using pip3**:
- On some systems, especially if both Python 2 and Python 3 are installed, you might need to use `pip3` instead of `pip`. You can install matplotlib using:
```bash
pip3 install matplotlib
```
4. **Verify the installation**:
- After installing pip, you can verify the installation by running:
```bash
pip --version
```
- If you had to use `pip3` to install, verify with:
```bash
pip3 --version
```
5. **Installing matplotlib with pip**:
- Once pip is available, you can install matplotlib by running:
```bash
pip install matplotlib
```
- Or if you used `pip3`:
```bash
pip3 install matplotlib
```
6. **Running the script**:
- After installing matplotlib, create the `generate_charts.py` file as described previously, and run it with:
```bash
python generate_charts.py
```
- Or if you need to use Python 3 explicitly:
```bash
python3 generate_charts.py
```
If you run into any specific issues or errors during these steps, please let me know so I can help troubleshoot further.
### 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
```