Overview
This node, named "Draw Matrix," generates a visual matrix plot from input data. It is useful for data visualization tasks where users want to create graphical representations such as bar charts, box plots, heatmaps, line charts, pie charts, or scatter plots based on a specific column of their dataset. Typical scenarios include exploratory data analysis, feature importance visualization, or presenting data insights in reports.
For example, if you have a dataset with various features and a target column, this node can produce a heatmap or bar chart illustrating relationships or distributions related to that target column, saving the resulting image to a specified file path.
Properties
| Name | Meaning |
|---|---|
| Target Column | The name of the column in the input data to focus on for drawing the matrix plot. |
| Title | The title text to display on the generated matrix plot. |
| Type Of Matrix | The type of matrix plot to draw. Options: Bar, Box, Heatmap, Line, Pie, Scatter. |
| Output Image Path | The file system path where the generated matrix plot image will be saved. |
Output
The node outputs JSON containing the path to the generated image file:
{
"imagePath": "/path/to/generated/matrix_plot.png"
}
This path points to the saved image of the matrix plot created by the node. There is no binary data output; instead, the image is saved directly to the filesystem at the specified location.
In case of errors during execution (e.g., issues running the Python script), the node outputs an error message in JSON format:
{
"error": "Error executing draw script"
}
Dependencies
- This node depends on a Python script (
draw_matrix_script.py) located relative to the node's source code. - Python must be installed and accessible in the environment where n8n runs.
- The node executes the Python script via a child process, passing the input data and parameters as command-line arguments.
- The node requires write access to the directory specified in the "Output Image Path" property to save the generated image.
- No external API keys or online services are required.
Troubleshooting
Common Issues:
- Python not installed or not in system PATH: The node will fail to execute the Python script.
- Invalid or missing target column in input data: The Python script may error out or produce incorrect plots.
- Insufficient permissions to write to the output directory: The image file cannot be saved.
- Malformed input data JSON causing script failure.
Error Messages:
- Errors from the Python script are captured and returned as node errors with messages like
"Error executing draw script". - To resolve, verify Python installation, check the correctness of input data and parameters, and ensure the output directory exists and is writable.
- Errors from the Python script are captured and returned as node errors with messages like
Links and References
- n8n Documentation
- Node.js Child Process Module
- Python Installation Guide
- Visualization libraries commonly used in Python (likely dependencies of the Python script):