如何使用一对FrameLabel绘制绘图网格? [英] How to make a grid of plots with a single pair of FrameLabels?

查看:120
本文介绍了如何使用一对FrameLabel绘制绘图网格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在整个网格只有一个FrameLabel的情况下,创建图的行/列/网格的最简单方法是什么?

What is the simplest way to create a row/column/grid of plots, with the whole grid having a single FrameLabel?

我需要与此类似的东西:

I need something similar to this:

p := ListPlot[RandomInteger[10, 5], Joined -> True, Axes -> False, 
  Frame -> True, PlotRange -> {0, 11}, 
  FrameLabel -> {"horizontal", None}, AspectRatio -> 1]

GraphicsRow[{Show[p, FrameLabel -> {"horizontal", "vertical"}], p, p}]

对于行格式,它可以具有一个或多个水平标签,但只能有一个垂直标签.

For a row format, it could have one or multiple horizontal labels, but only one vertical one.

要考虑的问题:

  • 垂直比例尺必须与所有地块相匹配,并且不得因例如垂直方向而损坏.标签太长或自动PlotRangePadding.
  • 需要良好地(且具有调整大小的公差!)控制图间间距(毕竟,这是删除多余标签的动机之一)
  • 该安排的总体空间效率.最大内容,最小(不必要)空格.

编辑

我试图能够可靠地创建可打印的图形,其中涉及很多调整大小. (因为导出的PDF通常与我在笔记本中看到的比例不同,并且必须具有可读但不大的字体)

I'm trying to be able to robustly create print ready figures, which involves a lot of resizing. (Because the exported PDFs will usually not have the same proportions as what I see in the notebook, and must have readable but not oversized fonts)

推荐答案

您可以使用 LevelScheme 实现您想要的.这是一个示例:

You can use LevelScheme to achieve what you want. Here's an example:

<< "LevelScheme`"
Figure[{
  Multipanel[{{0, 1}, {0, 1}}, {1, 3},
   XFrameLabels -> textit["x"], BufferB -> 3,
   YFrameLabels -> textit["Sinc(x)"], BufferL -> 3,
   TickFontSize -> 9,
   XGapSizes -> {0.1, 0.1},
   PanelLetterCorner -> {1, 1}
   ],
  FigurePanel[{1, 1}, PlotRange -> {{-1.6, -0.6}, {-0.5, 1}}],
  RawGraphics[Plot[Sinc[20 x], {x, -1.6, -0.6}]],

  FigurePanel[{1, 2}, PlotRange -> {{-0.5, 0.5}, {-0.5, 1}}],
  RawGraphics[Plot[Sinc[20 x], {x, -0.5, 0.5}]],

  FigurePanel[{1, 3}, PlotRange -> {{0.6, 1.6}, {-0.5, 1}}],
  RawGraphics[Plot[Sinc[20 x], {x, 0.6, 1.6}]]
  },
 PlotRange -> {{-0.1, 1.02}, {-0.12, 1.095}}]

LevelScheme为您提供情节安排的极大灵活性.

LevelScheme offers you tremendous flexibility in the arrangement of your plot.

  • 您可以在FigurePanel[]内移动定义,并分别控制每个标签.
  • 您可以在X和Y方向上同时设置图间距,也可以更改每个面板的尺寸,例如,左边的面板可以占据2/3的空间,接下来的两个面板可以占据1/6的空间.每个空间.
  • 您可以设置单独的打印范围,更改每个框的刻度线标签,控制应在面板的哪一侧(顶部/底部/l/r)进行标记,更改面板编号等.
  • Instead of naming giving the plot common labels, you can move the definition inside the FigurePanel[] and control the labels for each one individually.
  • You can set inter-plot spacings both in the X and Y directions and also change the sizes of each panel, for e.g., the left one can take up 2/3 of the space and the next two just 1/6 of the space each.
  • You can set individual plot ranges, change the frame tick labels for each, control which side of the panel (top/bottom/l/r) the labels should be marked, change panel numberings, etc.

唯一的缺点是您可能必须在某些情况下进行搏斗,但是总的来说,我发现使用起来很愉快.

The only drawback is that you might have to wrestle with it in some cases, but in general, I've found it a pleasure to use.

编辑

这与您的示例类似:

Figure[{
  Multipanel[{{0, 1}, {0, 1}}, {1, 3},
   YFrameLabels -> textit["Vertical"], BufferL -> 3,
   TickFontSize -> 9,
   XGapSizes -> {0.1, 0.1},
   PanelLetterCorner -> {1, 1}
   ],
  FigurePanel[{1, 1}, PlotRange -> {{1, 10}, {0, 10}}],
  RawGraphics[ListLinePlot[RandomInteger[10, 10]]],

  FigurePanel[{1, 2}, PlotRange -> {{1, 10}, {0, 10}},
   LabB -> textit["Horizontal"], BufferB -> 3],
  RawGraphics[ListLinePlot[RandomInteger[10, 10]]],

  FigurePanel[{1, 3}, PlotRange -> {{1, 10}, {0, 10}}],
  RawGraphics[ListLinePlot[RandomInteger[10, 10]]]
  },
 PlotRange -> {{-0.1, 1.02}, {-0.2, 1.095}}]

编辑2

要回答向导先生的评论,这是2x3网格的空白模板

To answer Mr. Wizard's comment, here's a blank template for a 2x3 grid

Figure[{Multipanel[{{0, 1}, {0, 1}}, {2, 3},
   XFrameTicks -> None,
   YFrameTicks -> None,
   XGapSizes -> {0.1, 0.1},
   YGapSizes -> {0.1}],
  FigurePanel[{1, 1}],
  FigurePanel[{1, 2}],
  FigurePanel[{1, 3}],
  FigurePanel[{2, 1}],
  FigurePanel[{2, 2}],
  FigurePanel[{2, 3}]
  }, PlotRange -> {{-0.01, 1.01}, {-0.01, 1.01}}]    

这是带有扩展面板的

Figure[{Multipanel[{{0, 1}, {0, 1}}, {2, 3},
   XFrameTicks -> None,
   YFrameTicks -> None,
   XGapSizes -> {0.1, 0.1},
   YGapSizes -> {0.1}],
  FigurePanel[{1, 1}, PanelAdjustments -> {{0, 0}, {1.1, 0}}],
  FigurePanel[{1, 2}],
  FigurePanel[{1, 3}],
  FigurePanel[{2, 2}, PanelAdjustments -> {{0, 1.1}, {0, 0}}]
  }, PlotRange -> {{-0.01, 1.01}, {-0.01, 1.01}}]

这篇关于如何使用一对FrameLabel绘制绘图网格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆