0

I would like to remove y-axes with keeping plot's consistency and then save it as pdf without cell number (I used save selection as), it is Ok if saved as an image but not working with pdf?! Here the used code:

t1=DensityPlot[Sin[y]^2 Cos[6 x], {x, -2, 2}, {y, 0, 5},ImageSize -> 240, Frame -> True, ImagePadding -> {{40, 0}, {50, 5}},FrameLabel -> {"x", "y"}, ColorFunction -> "Rainbow",PlotPoints -> 50]  

t2=DensityPlot[Sin[y]^2 Cos[3 x], {x, -2, 2}, {y, 0, 5},ImageSize -> 240, Frame -> True, ImagePadding -> {{40, 0}, {50, 5}},FrameLabel -> {"x", "y"}, ColorFunction -> "Rainbow",PlotPoints -> 50]

t3=DensityPlot[Sin[y]^2 Cos[4 x], {x, -2, 2}, {y, 0, 5},ImageSize -> 240, Frame -> True, ImagePadding -> {{40, 0}, {50, 5}},FrameLabel -> {"x", "y"}, ColorFunction -> "Rainbow",PlotPoints -> 50]

t4=DensityPlot[Sin[y]^2 Cos[2 x], {x, -2, 2}, {y, 0, 5},ImageSize -> 240, Frame -> True, ImagePadding -> {{40, 0}, {50, 5}},FrameLabel -> {"x", "y"}, ColorFunction -> "Rainbow",PlotPoints -> 50]  

Legended[GraphicsGrid[Partition[{t1, t2, t3, t4}, 2],Spacings -> {-70,-70}],Placed[BarLegend[{"Rainbow", {-1, 1}},LabelStyle -> {FontSize -> 12,Red, Bold},LegendMarkerSize -> 200], {{1.52, .59}}]]

enter image description here

MMA13
  • 4,664
  • 3
  • 15
  • 21

1 Answers1

1

I would use LevelScheme for this. Clearly, it's more involved than GraphicsGrid[]. However, the control is unbeatable.

Load package & set defaults

Needs["LevelScheme`LevelScheme`"]
A4LEN = (11 3)/4;
SetOptions[DensityPlot, 
  ColorFunction -> "Rainbow", 
  PlotPoints -> 50];

define a color bar

cbar = ContourPlot[y, {x, 0, 1}, {y, -1, 1},
  ColorFunction -> ColorData["Rainbow"],
  ColorFunctionScaling -> True,
  Contours -> 50,
  PlotRange -> {{0, 1}, {-1, 1}}
  ];

then construct the figure using

ofig = Figure[{
   SetOptions[SchemeObject, FontFamily -> "Helvetica", FontSize -> 10],
   ScaledLabel[{.5, .97}, "Title", FontSize -> 12, 
    FontWeight -> Bold, Offset -> {0, 0}],
   ScaledLabel[{.5, .94}, "Subtitle", FontSize -> 10, 
    FontSlant -> Italic, Offset -> {0, 0}],
   Multipanel[{{0, 1}, {0, 1}}, {2, 3},
    Margin -> 50,
    XPlotRanges -> {{-2, 2}, {-2, 2}, {0, 1}},
    YPlotRanges -> {{0, 5}, {0, 5}},
    XFrameLabels -> {"X", "X", ""}, BufferB -> 5,
    YFrameLabels -> {"Y", "Y"}, BufferL -> 7,
    XFrameTicks -> {LinTicks[-2, 2, 1, 1], LinTicks[-2, 2, 1, 1],
      LinTicks[0, 1, 1, 1]},
    YFrameTicks -> {
      {LinTicks[0, 5, 1, 1], LinTicks[0, 5, 1, 1], 
       LinTicks[-1, 1, .5, 1]},
      {LinTicks[0, 5, 1, 1], LinTicks[0, 5, 1, 1], 
       LinTicks[-1, 1, 1, 1]}},
    YGapSizes -> .1, XGapSizes -> {.1, .2},
    YPanelSizes -> {1, 1},
    XPanelSizes -> {1, 1, .1},
    Order -> Vertical, ShowPanelLetter -> False
    ],
   FigurePanel[{1, 1}],
   RawGraphics@DensityPlot[Sin[y]^2 Cos[6 x], {x, -2, 2}, {y, 0, 5}],
   FigurePanel[{2, 1}],
   RawGraphics@DensityPlot[Sin[y]^2 Cos[4 x], {x, -2, 2}, {y, 0, 5}],
   FigurePanel[{1, 2}],
   RawGraphics@DensityPlot[Sin[y]^2 Cos[3 x], {x, -2, 2}, {y, 0, 5}],
   FigurePanel[{2, 2}], 
   RawGraphics@DensityPlot[Sin[y]^2 Cos[2 x], {x, -2, 2}, {y, 0, 5}],
   FigurePanel[{1, 3}, ShowPanelLetter -> False, 
    ShowTickLabels -> {False, True, False, False},
    XPlotRange -> {0, 1}, YPlotRange -> {-1, 1}, 
    PanelAdjustments -> {{0, 0}, {.75, -.35}}],
   ScaledLabel[{1, .5}, "Lable", Offset -> {0, -2}, 
    Orientation -> -90 \[Degree]],
   RawGraphics@cbar
   },
  ImageSize -> (1*72) *  {A4LEN, A4LEN} (* adjust for page size *)
  ]

image ...

Save as PDF using

Export["test.pdf", ofig];
dwa
  • 1,939
  • 14
  • 14