René
René

Reputation: 4827

How to set figure size or plot size in a Gadfly plot (using Julia)?

I would like to set the width (and height) of my Gadfly plot to adjust the aspect ratio in a hstack plot.

Orginal plot:

using Gadfly
p1 = Gadfly.plot(x=[1,2], y=[3,4], Geom.line)

enter image description here

hstack plot (to be adjusted):

using Gadfly
p1 = Gadfly.plot(x=[1,2], y=[3,4], Geom.line)
hstack(p1, p1, p1)

enter image description here

Any suggestions on how to adjust the plot size / figure size?

Upvotes: 5

Views: 1479

Answers (1)

Mattriks
Mattriks

Reputation: 181

In the Gadfly galleries, plots use set_default_plot_size(). Another option is e.g.:

p = plot(...)
draw(PNG(6inch, 3inch), p)

see ?SVG, ?PDF, ?PNG for more info.

Upvotes: 5

Related Questions