Plots


Jump to API response

This endpoint handles manipulation of Plotly plot files.

Reference

Authorization


Any user with or without a Plotly account may view public plots. For private plots, see authentication.

Actions


list

Listing all public plots can be done via a GET request to this endpoint. By default, plots will be listed in order of date created. The order_by query parameter is accepted at this endpoint. Currently, only ordering by views is supported. It is possible to filter the plots by quality with min_quality or max_quality as query parameter.

Example:

// GET https://api.plotly.com/v2/plots/ ---> 200

// GET https://api.plotly.com/v2/plots/?order_by=-views ---> 200

// GET https://api.plotly.com/v2/plots/?min_quality=5 ---> 200

// GET https://api.plotly.com/v2/plots/?max_quality=5 ---> 200

feed

Listing all handpicked feed plots can be done via a GET request to this endpoint. By default, plots will be listed in a random order.

Example:

// GET https://api.plotly.com/v2/plots/feed ---> 200

create

You can create new plot resources here. The only required field is 'figure'. Currently, the figure is restricted to only contain references to grid data. That is, this will fail if raw data arrays are passed in. To create and manipulate underlying grids for plots, see the grids endpoint.

Example:

// This fails because a figure field is required.
// POST https://api.plotly.com/v2/plots ---> 400 Bad Request
{}

// This fails because the figure has raw data
//POST https://api.plotly.com/v2/plots ---> 400 Bad Request
{
    "figure": {"data": [{"y": ['this', 'is', 'raw', 'data']}]}
}

// This succeeds because the figure has src keys, not raw data.
//POST https://api.plotly.com/v2/plots ---> 200 OK
{
    "figure": {"data": [{"ysrc": "sven:88:u8nd62"}]}
}

When creating a grid, you can optionally specify a source_fid to specify where a plot has come from:

  • source_fid: the fid of a plot that was copied (and presumably edited) to produce this one

detail

There is a lot of meta information stored about plot files including filename, title, share_url, and content_url to name a few.

This information can only be reached with a GET to this endpoint.

Example:

// GET https://api.plotly.com/v2/plots/iheartgraphs:90

content

The contents of a plot can be downloaded via the content resource. The plot content contains referenced grid/column data by default. If you wish to return the raw grid/column data, the inline_data=true query must be included in the request url. The Content-Type header will be appropriately set for the response body.

Alternatively, you can set ?map_data=unreadable to append a mapping of sources to data that belongs to grids which are unreadable for the requestor. This is useful when you have read access to another users plot, but that plot contains grid references which you don't have access to.

Examples:

// Returns referenced grid/column data
// GET https://api.plotly.com/v2/plots/iheartgraphs:90/content ---> 200 OK

// Returns full grid/column data
// GET https://api.plotly.com/v2/plots/iheartgraphs:90/content?inline_data=true ---> 200 OK

// Returns full grid/column data when requestor doesn't have permission
// to read the referenced grid.
// GET https://api.plotly.com/v2/plots/iheartgraphs:90/content?map_data=unreadable ---> 200 OK

GET /v2/plots/Trahaearn:0?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "creation_time": "2019-03-21T03:13:50.213901Z",
    "comments": {
        "results": [],
        "count": 0
    },
    "parented": true,
    "embed_url": "https://plotly.com/~Trahaearn/0.embed",
    "fid": "Trahaearn:0",
    "filename": "Japan Hostel Mapbox",
    "filetype": "plot",
    "img_url": "https://storage.googleapis.com/plotly-prod-images/Trahaearn/0/9_NSYI6TEJCRTRFNZAP7GVB5ZGM89E72.png",
    "image_urls": {
        "default": "https://storage.googleapis.com/plotly-prod-images/Trahaearn/0/2_Z8CWXJEXOP50G9UZ1RR4TL70CW5OUP.png",
        "block-thumb": "https://storage.googleapis.com/plotly-prod-images/Trahaearn/0/8_OYB6L5HMJXPXLY9P11LEO31Y3ULW3O.png",
        "list-thumb": "https://storage.googleapis.com/plotly-prod-images/Trahaearn/0/9_NSYI6TEJCRTRFNZAP7GVB5ZGM89E72.png"
    },
    "api_urls": {
        "files": "https://api.plotly.com/v2/files/Trahaearn:0",
        "plots": "https://api.plotly.com/v2/plots/Trahaearn:0",
        "parent": "https://api.plotly.com/v2/folders/home?user=Trahaearn"
    },
    "owner": "Trahaearn",
    "parent": -1,
    "preview": "",
    "referencers": [],
    "references": [],
    "title": "Hostels in Japan",
    "views": 23,
    "web_url": "https://plotly.com/~Trahaearn/0/hostels-in-japan/",
    "world_readable": true,
    "date_modified": "2019-05-12T03:55:32.599Z",
    "stars": {
        "results": [],
        "count": 0
    },
    "collaborators": {
        "results": [],
        "count": 0
    },
    "subfolder_count": null,
    "refresh_interval": null,
    "organize_view_url": "https://plotly.com/~Trahaearn/0/",
    "current_user_permission": "read",
    "is_theme": null,
    "is_template": null,
    "autosize": true,
    "caption": "",
    "figure": {
        "data": [
            {
                "uid": "6abeaac7-5a0c-417a-b9d4-fa41f1ac1ada",
                "mode": "markers",
                "type": "scattermapbox",
                "latsrc": "Trahaearn:1:cda6c5",
                "lonsrc": "Trahaearn:1:151a86",
                "marker": {
                    "sizesrc": "Trahaearn:1:bb7c8d"
                },
                "textsrc": "Trahaearn:1:825ef2"
            }
        ],
        "layout": {
            "title": {
                "text": "Hostels in Japan"
            },
            "mapbox": {
                "zoom": 5,
                "pitch": 0,
                "center": {
                    "lat": 35,
                    "lon": 139
                },
                "bearing": 0,
                "accesstoken": "pk.eyJ1IjoidHJhaGFlYXJuIiwiYSI6ImNqdGkxM2E5cDBtb2szeXFzb3k1Z3llMHgifQ.kx3H-uzlQdYlQ2T89_2lnA"
            },
            "autosize": true,
            "hovermode": "closest"
        }
    },
    "height": null,
    "width": null,
    "user": {
        "profile_url": "https://plotly.com/~Trahaearn",
        "avatar_url": "https://storage.googleapis.com/plotly-prod-profiles/36.jpg",
        "background_url": "https://storage.googleapis.com/plotly-prod-profiles/bg-10.jpg",
        "bio": "",
        "nickname": "",
        "website": "",
        "stream_tokens": null,
        "feature_set_id": null,
        "csrf_token": null,
        "date_joined": "2019-03-21 03:03:33",
        "mapbox_access_tokens": null,
        "has_password": null,
        "username": "Trahaearn",
        "email": null,
        "is_active": null,
        "readonly": null,
        "is_dash_creator": null,
        "dash_created_count": null,
        "is_chart_creator": null,
        "charts_created_count": null
    }
}