Robin De Schepper
Robin De Schepper

Reputation: 51

julia plotly set plot figure size

When I call the plot() function the resulting plot always has a fixed size when it opens in my browser. I have tried to pass a layout argument to the function in many forms but it always throws an "unhandled layout type" error.

Example code:

using Plots
plotly()
data = rand(10)
plot(data, layout = [:autosize=false, :width = 500, :height = 500])
plot(data, layout = [autosize=false, width = 500, height = 500])
plot(data, layout = ["autosize"=>false, "width" => 500, "height" => 500])

Is there anyone that knows how to pass this layout argument correctly?

Upvotes: 5

Views: 15974

Answers (1)

Robin De Schepper
Robin De Schepper

Reputation: 6364

This can be done be specifying not a layout argument but the argument size:

plot(data, size = (width, height))

The layout argument I was referring to is used in the Plotly documentation but only applies when calling Plotly.plot, and not when you call Plots.plot with the Plotly backend selected. The Plots.plot call translates its own set of arguments to the selected backend.

For reference on the different usages:

Upvotes: 9

Related Questions