draw package, multiple plots with different sizes?
Subject: draw package, multiple plots with different sizes?
From: Mario Rodriguez
Date: Thu, 19 Jan 2012 19:31:33 +0100
El jue, 19-01-2012 a las 15:41 +0100, Mario Rodriguez escribi?:
> El mi?, 18-01-2012 a las 11:39 -0800, dlakelan escribi?:
> > Using draw, is it possible to do something like put one plot above the
> > other, with the upper plot being say a square and the lower plot being a
> > thin rectangle. To explain here is some sort of ascii art showing the
> > relative aspect ratios I want to achieve.
> >
> > -------------
> > | |
> > | |
> > | |
> > | |
> > | |
> > -------------
> > | |
> > -------------
> >
> > All I see is the option to specify more than one plot, the number of
> > columns, and the overall size of the plot (the bounding box using
> > "dimensions"). I want to do this with the pdfcairo terminal.
> >
> > Any suggestions, other than to make them separate plots and glue them
> > together by hand?
>
> Hello,
>
> There is not any special draw options to declare the internal dimensions
> of the scenes, but you can make use of user_preamble to add some gnuplot
> code to maxout.gnuplot.
>
> Here is a workaround:
>
>
> draw(
> dimensions = 100*[21,29.7],
> terminal = pdfcairo,
>
> gr2d(
> explicit(x^2,x,-1,1),
> user_preamble=["set size 1.0, 0.75","set origin 0.0, 0.25"]),
>
> gr3d(
> explicit(x^2+y^2,x,-1,1,y,-1,1),
> user_preamble=["set size 1.0, 0.25","set origin 0.0, 0.0"]))$
>
>
> With variable 'origin', you tell Gnuplot where to start drawing the
> scene (lower-left corner). Since you are allocating the scenes by hand,
> you don't need to use option 'columns'.
>
> With variable 'size', you declare the dimensions, in relative units, of
> a particular scene. For example, with "set size 1.0, 0.75", the 2D scene
> will use 100% and 75% of the available width and height, respectively.
>
> Finally, with the values given to option 'dimensions' you'll get a pdf
> document of size A4.
>
> I hope this fits your needs.
>
> --
> Mario
>
Another interesting example:
draw(
dimensions = [500,500],
gr2d(
explicit(x^3,x,-1,1),
grid = true,
user_preamble=["set size 0.5, 0.5","set origin 0.25, 0.25"]),
gr2d(
explicit(x^2,x,-1,1),
user_preamble=["set size 1.0, 1.0","set origin 0.0, 0.0"])) $
--
Mario