I am trying to put table in the form of Grid into GraphicsGrid. Here is my code:
sinfunc[ampl_, freq_, phase_, x_] := ampl Sin[2. Pi freq x + phase];
A1 = 1.;
A2 = 0.5;
f1 = 2.;
f2 = 5.;
phase1 = Pi/4.;
phase2 = Pi/3.;
plotstyle = {Blue, Red};
padding = {{25, 5}, {15, 5}};
plot = Plot[{sinfunc[A1, f1, phase1, x],
sinfunc[A2, f2, phase2, x]}, {x, 0., 2. Pi},
PlotRange -> {{0., 2. Pi}, {-1., 1.}}, AxesOrigin -> {0., -1.},
PlotStyle -> plotstyle, Frame -> True, ImagePadding -> padding];
emptyplot =
Plot[{}, {x, 0., 2. Pi}, PlotRange -> {{0., 2. Pi}, {-1., 1.}},
AxesOrigin -> {0., -1.}, PlotStyle -> plotstyle, Frame -> True,
FrameStyle -> Directive[White, Opacity[0.]],
ImagePadding -> padding];
legendSin1 =
LineLegend[{plotstyle[[1]]}, {""}, LabelStyle -> {0},
LegendMarkerSize -> {25, 5}];
legendSin2 =
LineLegend[{plotstyle[[2]]}, {""}, LabelStyle -> {0},
LegendMarkerSize -> {25, 5}];
size = 12;
text = Partition[
Style[#, size] & /@ {"", "Sin1", "Sin2", "", "", "", "Frequency",
ToString[f1], ToString[f2], "Amplitude", ToString[A1],
ToString[A2], "Phase", ToString[Round[phase1, 0.01]],
ToString[Round[phase2, 0.01]]}, 3];
table = Grid[text,
Dividers -> {All, {1 -> True, 3 -> True, 4 -> True, 5 -> True,
6 -> True}},
Alignment -> {Center, Center, {{3, 5}, {2, 3}} -> Left},
Spacings -> {1, 1.2}
, Frame -> {None,
None, {{3, 5}, {2, 3}} -> Directive[(Thickness[2])Thickness[0.005], Black]}
];
grid = GraphicsGrid[{{emptyplot, plot}},
Epilog -> {Inset[table, Scaled[{0.1, 0.5}]],
Inset[legendSin1, Scaled[{0.15, 0.63}]],
Inset[legendSin2, Scaled[{0.255, 0.63}]]}]
When I save the grid as PDF (Export["Grid.pdf", grid]). I get following image:
(Please notice that I am interested in PDF format of image, here I put JPG format due to format upload restrictions.)
I am facing two one problem:
- LineLegends
legendSin1andlegendSin2are missing in the PDF. However, they are present in the Mathematica notebook view ofGraphicsGridgrid. The table (@MelaGo solved this problem by changing the thickness ofGrid) appears as black rectangle. This in fact might be somehow related to the optionFrame. If theFrameis commented out, the table appears normally.Frameto e.g.Thickness[0.005]instead ofThickness[2].
I am using 12.1 version of Mathematica. I will be grateful for any help.

Thickness[2]- lines are so wide they fill up the grid. TryThickness[.02]– MelaGo Mar 23 '21 at 01:50LineLegendsexist in pdf). – Ben Izd Mar 23 '21 at 12:17LineLegendsexist in pdf. I am using the 12.1 and they are missing in pdf. I wonder if somebody else can confirm this on 12.1. – Moonwalk Mar 23 '21 at 13:55pdf, there was another question similar issue with the same version. – Ben Izd Mar 23 '21 at 14:34