/plot
: interactive points
Plot the points of a graph on an interactive page to interact with the points of the graph.
POST /plot
Create a new graph with your provided configurations and receive the location of the interactive plot.
Example usage
Using configurations for constructing a graph, a POST
request can create a new
graph:
{
"data": [
{
"x": [0, 1, 2, 3, 4, 5, 6],
"y": [0, 1, 4, 9, 16, 25, 36],
"name": "squares",
"type": "scatter"
},
{
"x": [0, 1, 2, 3, 4, 5, 6],
"y": [0, 1, 2, 3, 4, 5, 6],
"name": "dots",
"type": "scatter"
}
],
"layout": {
"title": "A squared curve"
}
}
$ curl https://api.graphing.tools/v1/plot \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d "@graph.json"
{
"ok": "true",
"graph": {
"graph_id": "G0123456789AZ",
"permalink": "https://plots.graphing.tools/x/G0123456789AZ"
}
}
Request parameters
Send a POST
request to the following URL, replacing placeholders and providing
your own values:
POST /v1/plot HTTP/1.1
Host: api.graphing.tools
Authorization: Bearer $token
Content-Type: application/json
{
"data": Object[],
"layout": Object,
}
$token
An authorization token for the graphing grapher. Gathered as an API key from the account page.
data
A collection of graph data as objects in an array. This is used to represent all types of points and numeric values and will determine so much of the final graph.
The format and types of data
available is determined by the APIs of
the Plotly graphing libraries. Check out this guide on
constructing graph data for the nuanced details.
layout
Optional options for the layout of the graph. This decides how the graph is presented in any visual outputs.
Configurations provided here will override any default layouts or stylings. Read about customizing layout configurations and themes for more information and inspiration.
Response parameters
After a successful request the following data will be returned in the response:
{
"ok": boolean,
"graph": {
"graph_id": string,
"permalink": string
}
}
ok
If the request completed successfully. Hopefully true
since false
means
something went wrong. Read about troubleshooting errors or
search the known errors for more information.
graph.graph_id
The graph ID of the newly created graph. This can be used to gather the graph data, chart image, or interactive plot.
graph.permalink
The permanant URL of the interactive plot for a graph. This page can be shared
or downloaded as a standalone html
file.
GET /plot/:graph_id
Retrieve the existing interactive plot with the graph_id
of a previously
uploaded graph.
Example usage
Using the graph ID from a previous POST
, possibly G0123456789AZ
, a GET
request can be made to gather plot details:
$ curl https://api.graphing.tools/v1/plot/G0123456789AZ
{
"ok": "true",
"graph": {
"graph_id": "G0123456789AZ",
"permalink": "https://plots.graphing.tools/x/G0123456789AZ"
}
}
Request parameters
Send a GET
request to the following URL, updating placeholder parameters as
needed:
GET /v1/plot/:graph_id HTTP/1.1
Host: api.graphing.tools
:graph_id
The graph ID of a previously uploaded graph.
Response parameters
After a successful request the following data will be returned in the response:
{
"ok": boolean,
"graph": {
"graph_id": string,
"permalink": string
}
}
ok
If the request completed successfully. Hopefully true
since false
means
something went wrong. Read about troubleshooting errors or
search the known errors for more information.
graph.graph_id
The graph ID of the gathered plot. This will match the provided :graph_id
.
graph.permalink
The permanant URL of the interactive plot for a graph. This page can be shared
or downloaded as a standalone html
file.