Nodes/comfyui_cv/CV Plot 2D (cv2.plot)
ComfyUI Node

CV Plot 2D (cv2.plot)

Renders one series of numbers as a line/point plot IMAGE using cv2.plot.Plot2d - OpenCV's own plotting module. Because the result is an ordinary IMAGE it saves, composites and diffs like any other: this is the node for putting a curve INTO a picture (a report sheet, a video frame, a saved PNG). Feed a 1-D array (plotted against its index) or an (N, 2) array of x, y pairs; x_values overrides the x axis. Plot2d draws ONE series with no labels or legend - for several series, category names, tooltips or a threshold line use 'CV Chart Series' instead. Empty input renders an empty plot rather than failing.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Plot 2D (cv2.plot)
  • values
  • x_values
  • plot
width640
height400
drawline
line_width1
show_gridtrue
grid_lines10
show_texttrue
value_rangeauto (data range)
min_x0.00
max_x1.00
min_y0.00
max_y1.00
line_color(0, 255, 0)
background_color(30, 30, 30)
axis_color(200, 200, 200)
grid_color(70, 70, 70)
text_color(230, 230, 230)
print_point_index-1
y_downfalse
Categoryimage/CV/plots

Inputs (21)

NameTypeDefaultDescription
valuesNPARRAYThe numbers to plot: 1-D (or (N, 1) / (1, N)) is plotted against the sample index; an (N, 2) array is read as x, y pairs. Converted to float64, which is the only dtype Plot2d accepts. Larger values are drawn UPWARDS (see y_down).
widthINT640400–4096Plot width in pixels. cv2.plot CLAMPS anything below 400 up to 400 - that is the module, not this node.
heightINT400300–4096Plot height in pixels; clamped up to 300 minimum by cv2.plot itself.
drawCOMBOline'line' connects consecutive samples; 'points only' marks them without the connecting segments - the honest choice when the samples are independent measurements rather than a signal.
x_valuesoptNPARRAYOptional x coordinate per sample (same length as values). Without it samples are plotted against their index. Ignored when values is (N, 2).
line_widthoptINT11–16Stroke width of the plotted line in pixels.
show_gridoptBOOLEANtrueDraw the background grid.
grid_linesoptINT101–100Number of grid divisions when the grid is shown.
show_textoptBOOLEANtrueDraw the axis value texts (the min/max readouts cv2.plot prints along the axes).
value_rangeoptCOMBOauto (data range)'auto' lets Plot2d fit the axes to the data - which hides how big the values are in absolute terms. 'manual' pins the axes so two plots of different runs are comparable.
min_xoptFLOAT0.00-1000000000–1000000000Left edge of the x axis ('manual' range only).
max_xoptFLOAT1.00-1000000000–1000000000Right edge of the x axis ('manual' range only).
min_yoptFLOAT0.00-1000000000–1000000000Bottom of the y axis ('manual' range only).
max_yoptFLOAT1.00-1000000000–1000000000Top of the y axis ('manual' range only).
line_coloroptSTRING(0, 255, 0)Series color as a BGR tuple, e.g. '(0, 255, 0)'.
background_coloroptSTRING(30, 30, 30)Plot background color, BGR.
axis_coloroptSTRING(200, 200, 200)Axis line color, BGR.
grid_coloroptSTRING(70, 70, 70)Grid line color, BGR.
text_coloroptSTRING(230, 230, 230)Axis text color, BGR.
print_point_indexoptINT-1-1–1000000Prints the value of ONE sample onto the plot: the index to annotate, or -1 for none. Useful to call out the winner of a comparison.
y_downoptBOOLEANfalseFlips the y axis so larger values go DOWN, matching image coordinates (or a cost/error where lower is better). Off - the default - draws larger values UP, like 'CV Chart Series' and every other plot. Note this is the OPPOSITE of raw cv2.plot, whose own default draws downward; the node corrects it.

Outputs (1)

NameTypeDescription
plotIMAGEThe rendered plot as a normal IMAGE (BGR converted to ComfyUI RGB), ready for Save Image, compositing or stacking next to the data it describes.