print_model_json: Print the JSON of a Bokeh figure

Description Usage Arguments Examples

View source: R/output_json.R

Description

Print the JSON of a Bokeh figure

Usage

1
print_model_json(fig, prepare = TRUE, pretty = TRUE, file = "", pbcopy = FALSE)

Arguments

fig

figure to print

prepare

logical - should the figure be sent through preparations that need to be done prior to plotting (TRUE), or printed as-is (FALSE)

pretty

parameter passed on to toJSON

file

parameter passed on to cat

pbcopy

logical - if on OSX, should the results be passed to the clipboard (TRUE) instead of printed to the screen (FALSE)?

Examples

1
2
3
4
5
6
## Not run: 
p <- figure() %>% ly_points(1:10) %>%
 tool_pan(dimensions = "height")
print_model_json(p)

## End(Not run)

Example output

Warning messages:
1: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
2: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
3: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
4: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
5: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
6: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
7: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
8: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
{
  "d0ccb5f431de98267f8f6bc2def82dc6": {
    "version": "0.12.2",
    "title": "Bokeh Figure",
    "roots": {
      "root_ids": [
        "11c50830f0f64b65d0fab2d34a89fced"
      ],
      "references": [
        {
          "type": "Plot",
          "id": "11c50830f0f64b65d0fab2d34a89fced",
          "attributes": {
            "id": "11c50830f0f64b65d0fab2d34a89fced",
            "sizing_mode": "scale_both",
            "x_range": {
              "type": "Range1d",
              "id": "20b7beb53f2aaa436a86c1dc5ad87c60"
            },
            "y_range": {
              "type": "Range1d",
              "id": "00547803738baf7c2a08e49831d60db1"
            },
            "left": [
              {
                "type": "LinearAxis",
                "id": "cef1a3b7c6a4eb78407f584c313ee65f"
              }
            ],
            "below": [
              {
                "type": "LinearAxis",
                "id": "03be6131f4ae7782e2b8ec5f347f0636"
              }
            ],
            "right": [],
            "above": [],
            "renderers": [
              {
                "type": "BoxAnnotation",
                "id": "f192478f6c2b8b133ca351a07eead238"
              },
              {
                "type": "GlyphRenderer",
                "id": "3f78b9ec1c3ce4717af2cc3d77ed11b2"
              },
              {
                "type": "LinearAxis",
                "id": "03be6131f4ae7782e2b8ec5f347f0636"
              },
              {
                "type": "Grid",
                "id": "a1c5f91014416a3c18a692bd05e40f48"
              },
              {
                "type": "LinearAxis",
                "id": "cef1a3b7c6a4eb78407f584c313ee65f"
              },
              {
                "type": "Grid",
                "id": "347cbdab91a757464d23379632e821b8"
              }
            ],
            "extra_y_ranges": {},
            "extra_x_ranges": {},
            "tags": [],
            "min_border_left": 4,
            "min_border_right": 4,
            "min_border_top": 4,
            "min_border_bottom": 4,
            "lod_threshold": null,
            "toolbar": {
              "type": "Toolbar",
              "id": "c74def62e5ccb762fdcf859e983f3662"
            },
            "tool_events": {
              "type": "ToolEvents",
              "id": "e743d09ff06baaa3070f087b76bf1a9f"
            }
          },
          "subtype": "Figure"
        },
        {
          "type": "Toolbar",
          "id": "c74def62e5ccb762fdcf859e983f3662",
          "attributes": {
            "id": "c74def62e5ccb762fdcf859e983f3662",
            "tags": [],
            "active_drag": "auto",
            "active_scroll": "auto",
            "active_tap": "auto",
            "tools": [
              {
                "type": "PanTool",
                "id": "a52c782dfdee3a911a9d7425184f2f8a"
              },
              {
                "type": "WheelZoomTool",
                "id": "57c6aac4c46e62e26b34809a3f29751a"
              },
              {
                "type": "BoxZoomTool",
                "id": "56fe10a12dab97d40f42c0e899418513"
              },
              {
                "type": "ResetTool",
                "id": "f2a736b7263a1022c43c87545211d073"
              },
              {
                "type": "SaveTool",
                "id": "07a3875688256d1cf2398dfcb3bff1dd"
              },
              {
                "type": "HelpTool",
                "id": "28e7c258a132207172d05b7b687a7024"
              }
            ],
            "logo": null
          }
        },
        {
          "type": "PanTool",
          "id": "a52c782dfdee3a911a9d7425184f2f8a",
          "attributes": {
            "id": "a52c782dfdee3a911a9d7425184f2f8a",
            "tags": [],
            "plot": {
              "type": "Plot",
              "id": "11c50830f0f64b65d0fab2d34a89fced",
              "subtype": "Figure"
            },
            "dimensions": ["height"]
          }
        },
        {
          "type": "ToolEvents",
          "id": "e743d09ff06baaa3070f087b76bf1a9f",
          "attributes": {
            "id": "e743d09ff06baaa3070f087b76bf1a9f",
            "tags": []
          },
          "geometries": []
        },
        {
          "type": "WheelZoomTool",
          "id": "57c6aac4c46e62e26b34809a3f29751a",
          "attributes": {
            "id": "57c6aac4c46e62e26b34809a3f29751a",
            "tags": [],
            "plot": {
              "type": "Plot",
              "id": "11c50830f0f64b65d0fab2d34a89fced",
              "subtype": "Figure"
            },
            "dimensions": ["width", "height"]
          }
        },
        {
          "type": "BoxAnnotation",
          "id": "f192478f6c2b8b133ca351a07eead238",
          "attributes": {
            "id": "f192478f6c2b8b133ca351a07eead238",
            "tags": [],
            "line_color": {
              "units": "data",
              "value": "black"
            },
            "line_alpha": {
              "units": "data",
              "value": 1
            },
            "fill_color": {
              "units": "data",
              "value": "lightgrey"
            },
            "fill_alpha": {
              "units": "data",
              "value": 0.5
            },
            "line_dash": [4, 4],
            "line_width": {
              "units": "data",
              "value": 2
            },
            "level": "overlay",
            "top_units": "screen",
            "bottom_units": "screen",
            "left_units": "screen",
            "right_units": "screen",
            "render_mode": "css"
          }
        },
        {
          "type": "BoxZoomTool",
          "id": "56fe10a12dab97d40f42c0e899418513",
          "attributes": {
            "id": "56fe10a12dab97d40f42c0e899418513",
            "tags": [],
            "plot": {
              "type": "Plot",
              "id": "11c50830f0f64b65d0fab2d34a89fced",
              "subtype": "Figure"
            },
            "overlay": {
              "type": "BoxAnnotation",
              "id": "f192478f6c2b8b133ca351a07eead238"
            }
          }
        },
        {
          "type": "ResetTool",
          "id": "f2a736b7263a1022c43c87545211d073",
          "attributes": {
            "id": "f2a736b7263a1022c43c87545211d073",
            "tags": [],
            "plot": {
              "type": "Plot",
              "id": "11c50830f0f64b65d0fab2d34a89fced",
              "subtype": "Figure"
            }
          }
        },
        {
          "type": "SaveTool",
          "id": "07a3875688256d1cf2398dfcb3bff1dd",
          "attributes": {
            "id": "07a3875688256d1cf2398dfcb3bff1dd",
            "tags": [],
            "plot": {
              "type": "Plot",
              "id": "11c50830f0f64b65d0fab2d34a89fced",
              "subtype": "Figure"
            }
          }
        },
        {
          "type": "HelpTool",
          "id": "28e7c258a132207172d05b7b687a7024",
          "attributes": {
            "id": "28e7c258a132207172d05b7b687a7024",
            "tags": [],
            "plot": {
              "type": "Plot",
              "id": "11c50830f0f64b65d0fab2d34a89fced",
              "subtype": "Figure"
            },
            "redirect": "http://hafen.github.io/rbokeh",
            "help_tooltip": "Click to learn more about rbokeh."
          }
        },
        {
          "type": "ColumnDataSource",
          "id": "9cea888e162b9c2a54919e4635d4532b",
          "attributes": {
            "id": "9cea888e162b9c2a54919e4635d4532b",
            "tags": [],
            "column_names": ["x", "y"],
            "selected": [],
            "data": {
              "x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
              "y": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
            }
          }
        },
        {
          "type": "Circle",
          "id": "b989a327772b1e326ee965a5b6a3c887",
          "attributes": {
            "id": "b989a327772b1e326ee965a5b6a3c887",
            "tags": [],
            "size": {
              "units": "screen",
              "value": 10
            },
            "visible": true,
            "line_color": {
              "units": "data",
              "value": "#1F77B4"
            },
            "fill_color": {
              "units": "data",
              "value": "#1F77B4"
            },
            "line_alpha": {
              "units": "data",
              "value": 1
            },
            "fill_alpha": {
              "units": "data",
              "value": 0.5
            },
            "x": {
              "units": "data",
              "field": "x"
            },
            "y": {
              "units": "data",
              "field": "y"
            }
          }
        },
        {
          "type": "Circle",
          "id": "6b095cbd3088462d5e6267c124d0053b",
          "attributes": {
            "id": "6b095cbd3088462d5e6267c124d0053b",
            "tags": [],
            "size": {
              "units": "screen",
              "value": 10
            },
            "visible": true,
            "line_color": {
              "units": "data",
              "value": "#e1e1e1"
            },
            "fill_color": {
              "units": "data",
              "value": "#e1e1e1"
            },
            "line_alpha": {
              "units": "data",
              "value": 1
            },
            "fill_alpha": {
              "units": "data",
              "value": 0.5
            },
            "x": {
              "units": "data",
              "field": "x"
            },
            "y": {
              "units": "data",
              "field": "y"
            }
          }
        },
        {
          "type": "Circle",
          "id": "6c5cfae482abbe9d8852232ab0c145b9",
          "attributes": {
            "id": "6c5cfae482abbe9d8852232ab0c145b9",
            "tags": [],
            "size": {
              "units": "screen",
              "value": 10
            },
            "visible": true,
            "line_color": {
              "units": "data",
              "value": "#1F77B4"
            },
            "fill_color": {
              "units": "data",
              "value": "#1F77B4"
            },
            "line_alpha": {
              "units": "data",
              "value": 1
            },
            "fill_alpha": {
              "units": "data",
              "value": 1
            },
            "x": {
              "units": "data",
              "field": "x"
            },
            "y": {
              "units": "data",
              "field": "y"
            }
          }
        },
        {
          "type": "GlyphRenderer",
          "id": "3f78b9ec1c3ce4717af2cc3d77ed11b2",
          "attributes": {
            "id": "3f78b9ec1c3ce4717af2cc3d77ed11b2",
            "tags": [],
            "selection_glyph": null,
            "nonselection_glyph": {
              "type": "Circle",
              "id": "6b095cbd3088462d5e6267c124d0053b"
            },
            "hover_glyph": {
              "type": "Circle",
              "id": "6c5cfae482abbe9d8852232ab0c145b9"
            },
            "name": null,
            "data_source": {
              "type": "ColumnDataSource",
              "id": "9cea888e162b9c2a54919e4635d4532b"
            },
            "glyph": {
              "type": "Circle",
              "id": "b989a327772b1e326ee965a5b6a3c887"
            }
          }
        },
        {
          "type": "Range1d",
          "id": "20b7beb53f2aaa436a86c1dc5ad87c60",
          "attributes": {
            "id": "20b7beb53f2aaa436a86c1dc5ad87c60",
            "tags": [],
            "start": 0.37,
            "end": 10.63
          }
        },
        {
          "type": "Range1d",
          "id": "00547803738baf7c2a08e49831d60db1",
          "attributes": {
            "id": "00547803738baf7c2a08e49831d60db1",
            "tags": [],
            "start": 0.37,
            "end": 10.63
          }
        },
        {
          "type": "LinearAxis",
          "id": "03be6131f4ae7782e2b8ec5f347f0636",
          "attributes": {
            "id": "03be6131f4ae7782e2b8ec5f347f0636",
            "tags": [],
            "plot": {
              "type": "Plot",
              "id": "11c50830f0f64b65d0fab2d34a89fced",
              "subtype": "Figure"
            },
            "axis_label": "index",
            "formatter": {
              "type": "BasicTickFormatter",
              "id": "6d59faef60f2758164a293e81f89f463"
            },
            "ticker": {
              "type": "BasicTicker",
              "id": "44f272ac3f45070cfeddd491a358a62e"
            },
            "visible": true,
            "axis_label_text_font_size": "12pt"
          }
        },
        {
          "type": "BasicTickFormatter",
          "id": "6d59faef60f2758164a293e81f89f463",
          "attributes": {
            "id": "6d59faef60f2758164a293e81f89f463",
            "tags": []
          }
        },
        {
          "type": "BasicTicker",
          "id": "44f272ac3f45070cfeddd491a358a62e",
          "attributes": {
            "id": "44f272ac3f45070cfeddd491a358a62e",
            "tags": [],
            "num_minor_ticks": 5
          }
        },
        {
          "type": "Grid",
          "id": "a1c5f91014416a3c18a692bd05e40f48",
          "attributes": {
            "id": "a1c5f91014416a3c18a692bd05e40f48",
            "tags": [],
            "dimension": 0,
            "plot": {
              "type": "Plot",
              "id": "11c50830f0f64b65d0fab2d34a89fced",
              "subtype": "Figure"
            },
            "ticker": {
              "type": "BasicTicker",
              "id": "44f272ac3f45070cfeddd491a358a62e"
            }
          }
        },
        {
          "type": "LinearAxis",
          "id": "cef1a3b7c6a4eb78407f584c313ee65f",
          "attributes": {
            "id": "cef1a3b7c6a4eb78407f584c313ee65f",
            "tags": [],
            "plot": {
              "type": "Plot",
              "id": "11c50830f0f64b65d0fab2d34a89fced",
              "subtype": "Figure"
            },
            "axis_label": "1:10",
            "formatter": {
              "type": "BasicTickFormatter",
              "id": "b736aa10bb744d2443d46d2a563f9b12"
            },
            "ticker": {
              "type": "BasicTicker",
              "id": "74b7d5497f166f5a605b505ada5bf5c3"
            },
            "visible": true,
            "axis_label_text_font_size": "12pt"
          }
        },
        {
          "type": "BasicTickFormatter",
          "id": "b736aa10bb744d2443d46d2a563f9b12",
          "attributes": {
            "id": "b736aa10bb744d2443d46d2a563f9b12",
            "tags": []
          }
        },
        {
          "type": "BasicTicker",
          "id": "74b7d5497f166f5a605b505ada5bf5c3",
          "attributes": {
            "id": "74b7d5497f166f5a605b505ada5bf5c3",
            "tags": [],
            "num_minor_ticks": 5
          }
        },
        {
          "type": "Grid",
          "id": "347cbdab91a757464d23379632e821b8",
          "attributes": {
            "id": "347cbdab91a757464d23379632e821b8",
            "tags": [],
            "dimension": 1,
            "plot": {
              "type": "Plot",
              "id": "11c50830f0f64b65d0fab2d34a89fced",
              "subtype": "Figure"
            },
            "ticker": {
              "type": "BasicTicker",
              "id": "74b7d5497f166f5a605b505ada5bf5c3"
            }
          }
        }
      ]
    }
  }
} 

rbokeh documentation built on Aug. 4, 2021, 1:06 a.m.