0
$\begingroup$

I want the following four plots to be displayed in two rows. That P1 and P2 in the top row and P3 and P4 in the bottom row.

 P1 = Plot[Sin[x], {x, -\[Pi], \[Pi]}, 
  Frame -> {True, True, True, True}, 
  FrameLabel -> {"x", Rotate["Sin(x)", 0 Degree]}, ImageSize -> 250]
P2 = Plot[Cos[x], {x, -\[Pi], \[Pi]}, 
  Frame -> {True, True, True, True}, 
  FrameLabel -> {"x", Rotate["Cos(x)", 0 Degree]}, ImageSize -> 250]
P3 = Plot[ArcSin[x], {x, -\[Pi], \[Pi]}, 
  Frame -> {True, True, True, True}, 
  FrameLabel -> {"x", Rotate["ArcSin(x)", 0 Degree]}, ImageSize -> 250]
P4 = Plot[ArcCos[x], {x, -\[Pi], \[Pi]}, 
  Frame -> {True, True, True, True}, 
  FrameLabel -> {"x", Rotate["ArcCos(x)", 0 Degree]}, 
  ImageSize -> 250]

Is it possible to do it in $Mathematica$ ?

$\endgroup$
4
$\begingroup$

You can use Labeled or PlotLabel for that

P1 = Plot[Sin[x], {x, -\[Pi], \[Pi]}, 
   Frame -> {True, True, True, True}, FrameLabel -> {"x", "Sin(x)"}, 
   ImageSize -> 250, PlotLabel -> "(a)"];
P2 = Labeled[Plot[Cos[x], {x, -\[Pi], \[Pi]}, Frame -> {True, True, True, True},
   FrameLabel -> {"x", "Cos(x)"}, ImageSize -> 250], "(b)"];
P3 = Labeled[Plot[ArcSin[x], {x, -\[Pi], \[Pi]}, Frame -> {True, True, True, True}, 
   FrameLabel -> {"x", "ArcSin(x)"}, ImageSize -> 250], "(c)", {Left}];
P4 = Labeled[Plot[ArcCos[x], {x, -\[Pi], \[Pi]}, Frame -> {True, True, True, True},
   FrameLabel -> {"x", "ArcCos(x)"}, ImageSize -> 250], "(d)", {Right}];

For extra artistic touch (as suggested by @Nasser)

plot=Grid[{{P1, P2}, {P3, P4}}, Spacings -> {2, 2}, Frame -> All, FrameStyle -> LightGray]

Export["plot.png",plot]

enter image description here

Check Grid documentation for more options.

Also, check GraphicsGrid (suggested by @march).

| improve this answer | |
$\endgroup$
  • $\begingroup$ Also, GraphicsGrid, that allows a little more fine-tuned control such as ImageSize. $\endgroup$ – march Oct 9 '17 at 15:54
  • $\begingroup$ +1, but when I do this sort of thing, I like to add Spacings and lightgray frame, makes the plot looks little more pretty as in Grid[{{P1, P2}, {P3, P4}}, Spacings -> {2, 2}, Frame -> All, FrameStyle -> LightGray] $\endgroup$ – Nasser Oct 9 '17 at 16:02
  • $\begingroup$ Thanks, friends. Can I label the plots as (a), (b) (c) and (d) such that the label appears below each plot? Also, is it possible to save the entire Grid as a single figure? $\endgroup$ – Jee Oct 9 '17 at 16:18
  • $\begingroup$ @Jee just add //Rasterize at the end $\endgroup$ – Alucard Oct 9 '17 at 16:41
  • $\begingroup$ Thanks a lot, guys. $\endgroup$ – Jee Oct 9 '17 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.