8
$\begingroup$

Behold! MMA 13 brought us closer to getting publication-ready plots. I wonder if we can solve this one once and for all with a nifty & modern wolfram syntax.

I'd like to have 4 plots with each y-axis (FrameLabel) called differently, but with a common x-axis FrameLabel. Like on the image below which was done using Multicolumn hackery (aka, trial and error): enter image description here

Nowadays the positioning and ticks can be handled nicely (much nicer than above) with simple PlotLayout->{"Column",1}, but how can label the Frames?

I attach a random, but counterintuitive result that MMA 13 currently gave me to illustrate the problem.

Also is there a way to control the spacing between plots when using PlotLayout? It would be very nifty to have them close together so that the frames touch, but the ticks don't overlap.

Problematic FrameLabel

$\endgroup$
9
$\begingroup$

You can use yet-to-be-documented options "ColumnLabels" and "RowLabels" as Method sup-options:

ListLinePlot[RandomReal[3, {4, 20}], 
 PlotLayout -> {"Row", 2}, 
 ImagePadding -> {{Automatic, 10}, {Automatic, Automatic}},
 Method -> {"Spacings" -> {5, 5}, 
   "ColumnLabels" -> {{"bottom left", "top left"}, {"bottom right", "top right"}}, 
   "RowLabels" -> {{ "left top", "right top"}, { "left bottom", "right bottom"}}}]

enter image description here

$\endgroup$
8
  • $\begingroup$ Thank you @kglr that's exactly what I've been looking for! And really "exactly looking for", but I've lacked the skills to search in available "Method" parameters. $\endgroup$
    – Ranza
    Jan 4 at 10:47
  • $\begingroup$ How can one learn all the available options/parameters of the "Method" option? $\endgroup$
    – Ranza
    Jan 4 at 10:54
  • $\begingroup$ @Ranza, unfortunately afaik there is still no systematic/documented way to discover all Method sub-options. The way I bumped into the solution posted is sort of a cargo-cult ritual: trace/spelunk/squint/wish/try/stepback/"howWouldIHaveDoneIt"/... I used Trace[ ListLinePlot[RandomReal[3, {2,5}], PlotLayout -> {"Row", 2}, FrameLabel->{{"A","B"},{"C","D"}}]] which produced a lot of warning/error messages some of which contained the text System`GraphicsAlignDump`axisstyle. Then I used Names["*`*Graphics*Align*"] which returned a few results, among them Charting`GraphicsAlign. $\endgroup$
    – kglr
    Jan 4 at 18:33
  • $\begingroup$ ... I tried Information[Charting`GraphicsAlign] (or Options[Charting`GraphicsAlign])to get a list which contained "ColumnLabels", "RowLabels" etc. After several trials/errors (having seen before that using options of internal functions called by a *Plot/*Chart functions as Method sub-options in the calling function sometimes works) I found Method -> {"ColumnLabels" -> ... gives the desired result. $\endgroup$
    – kglr
    Jan 4 at 18:36
  • $\begingroup$ btw, sometimes powerful incantations like "blahblah" ->"blah" delivers the cargo: try for example FindRoot[{x - 1, 10 (y - x^2)}, {{x, -1}, {y, 1}}, Method -> {"Newton", "blahblah" -> "blah"}] and FindRoot[{x - 1, 10 (y - x^2)}, {{x, -1}, {y, 1}}, Method -> {"loremipsum" -> "dolor"}] :) $\endgroup$
    – kglr
    Jan 4 at 18:48
1
$\begingroup$

In a format similar to what the OP asked, and inspired by @kglr, I came up with this:

ListLinePlot[RandomReal[3, {4, 20}], PlotLayout -> {"Column", 1}, 
 ImagePadding -> {{10, 20}, {10, 10}}, 
 Method -> {"Spacings" -> {0, 5}, 
   "ColumnLabels" -> {"bottomCommonLabel"}, 
   "RowLabels" -> {{"", "rightTop"}, {"", "righttNext"}, {"", 
      "rightNext2"}, {"", "rightBottom"}}}]

The plot sizes aren't what I'd like and there seems to be padding at the top, so I'm missing something that should be done.

Result: Column of graphs with common x-axis

$\endgroup$

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.