Skip to content

Remove set_plot_options #73

@flying-sheep

Description

@flying-sheep

…or deprecate and hide it from the docs.

R has a notion of the “default graphics device”, i.e. getOption('device'), which is either a string containing a function name or a function.

we could leverage this in two ways:

  1. use it with custom options:

    dev <- getOption('device')
    if (!is.function(dev)) {
        dev <- get(dev)
    }
    do.call(dev, as.list(options('jupyter.plot')))
  2. require the user to override the defaults by setting it to a function:

    #our initialization
    options(device = function(file.name, width = 7, height = 7,...) {
        png(file.name, width = width, height = height, ...)
    })
    
    …
    
    dev <- getOption('device')
    if (!is.function(dev)) {
        dev <- get(dev)
    }
    dev()

the only problem: we want to allow different mime types (PNG, JPG, SVG) for plots: if it’s a function, we can’t derive the type from the option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions