Plot Signal
POST /api/plot
Plots a signal in the active tab. It goes into the last plot of the tab, in a new row if the plot already shows signals. If the tab has no plot yet, one is created.
Request
POST /api/plot HTTP/1.1Host: localhost:5678Content-Type: application/jsonBody Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
signal_id | string | Yes | Signal ID from POST /api/signals/send or /api/signals/upload |
{ "signal_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7"}Response
Status Code: 200 OK
{ "status": "ok", "result": { "signals": [ { "working_signal_id": "0b0d4c1e-6f0a-4c56-9d0e-5a4e5c1f2a77", "name": "Sine 5Hz", "source_cntr": 1, "row_id": "row_1" } ], "target": "plot", "plot_name": "Plot 1", "plot_id": "c2a9d5b0-3a43-4b6e-8b0a-1f6a7d0e9c11", "computed": true }}| Field | Type | Description |
|---|---|---|
result.signals[].working_signal_id | string | ID of the plotted signal. It differs from signal_id, which names the channel in the data source |
result.signals[].name | string | Name of the signal in the plot |
result.signals[].source_cntr | integer | Number of the data source it comes from |
result.signals[].row_id | string | Row of the plot the signal was placed in |
result.plot_name, result.plot_id | string | The plot that received the signal |
result.computed | boolean or "pending" | Whether the signal was drawn before the response was sent |
Errors
| Status | Meaning |
|---|---|
400 | signal_id field missing |
404 | Signal not found |
Example
# Send a signal, capture the signal_idSIGNAL_ID=$(curl -s -X POST http://localhost:5678/api/signals/send \ -H "Content-Type: application/json" \ -d '{"name":"Sine 5Hz","y":[0,1,0,-1,0],"target_source_id":"<source_id>"}' \ | jq -r '.result.signal_id')
# Plot itcurl -s -X POST http://localhost:5678/api/plot \ -H "Content-Type: application/json" \ -d "{\"signal_id\":\"$SIGNAL_ID\"}"Tip
The Python and MATLAB clients send the signal with scry.plot() and call this endpoint automatically. See scrylab (Python) and scrylab-matlab (MATLAB).