I generate some density plot using the following code:
DensityPlot[
Log10[distr2[1, \[Theta]B, EB]], {\[Theta]B, 7*10^-4, 0.2}, {EB, 2,
350}, ScalingFunctions -> {"Log", "Log"}, AspectRatio -> 0.7,
PlotRange -> {{7*10^-4, 0.2}, All, {-2, 2}}, ImageSize -> Large,
FrameLabel -> {"\!\(\*SubscriptBox[\(\[Theta]\), \(a\)]\) [rad]" ,
"\!\(\*SubscriptBox[\(E\), \(a\)]\) [GeV]"}, Frame -> True,
FrameStyle -> Directive[Black, 25],
PlotLegends ->
Placed[BarLegend[{Automatic(*ColorData["RedBlueTones"]*), {-2, 2}},
LegendMarkerSize -> 340,
LegendLabel ->
Placed["\!\(\*SubscriptBox[\(Log\), \
\(10\)]\)[\!\(\*SubscriptBox[\(f\), \(ALP\)]\)]", Bottom],
LabelStyle -> {FontSize -> 22},
Method -> {FrameStyle -> Black, AxesStyle -> None,
TicksStyle -> Black}], Bottom],
PlotLabel ->
Style[Row[{"ALPs coupled to \[Gamma]. Primakov process. \
\!\(\*SubscriptBox[\(m\), \(a\)]\) = 1 GeV"}], 18, Black],
FrameTicks -> {{Automatic, Automatic}, {TicksPlotx, None}}]
Export[FileNameJoin[{NotebookDirectory[],
"plots/SensCalc/Double-Distr-ALPs.pdf"}], plot1]
In Mathematica and in Chrome/Edge web-browsers, as well as in Adobe Acrobat, it looks okay:
However, it is empty on Safari:
In addition, the size of the file is pretty large - around 1 Mb. Could you please tell me how to save the file without losing the quality of the plot but without the mentioned problems? I was thinking of rasterizing the plot itself but keeping the labels and legends vector, but I do not know whether it is possible at all in Mathematica.
The option "AllowRasterization" -> True
is ugly. On the other hand, the option "AllowRasterization" -> False
produces a light .pdf but with ugly rectangles and triangles (but who knows, maybe it is the only way...):
Edit
This is some example plot:
function[x_, y_] =
10^18 Cos[5*x] Sin[x] Exp[-((y^2*Cos[2*x]^4)/100)];
TicksPlotx =
Join[Flatten[
Table[{i*10^j, ""}, {i, 2, 9, 1}, {j, -4, 0, 1}], {1,
2}], {{10^-3,
"\!\(\*SuperscriptBox[\(10\), \(-3\)]\)", {0.03, 0}}, {10^-2,
"\!\(\*SuperscriptBox[\(10\), \(-2\)]\)", {0.03, 0}}, {10^-1,
"\!\(\*SuperscriptBox[\(10\), \(-1\)]\)", {0.03, 0}}, {1, 1,
0.03}}];
plot1 = DensityPlot[
Log10[function[x, y]], {x, 7*10^-4, 0.2}, {y, 2, 350},
ScalingFunctions -> {"Log", "Log"}, AspectRatio -> 0.7,
PlotRange -> {{7*10^-4, 0.2}, All, {-6, 13}}, ImageSize -> Large,
FrameLabel -> {"\!\(\*SubscriptBox[\(\[Theta]\), \(a\)]\) [rad]" ,
"\!\(\*SubscriptBox[\(E\), \(a\)]\) [GeV]"}, Frame -> True,
FrameStyle -> Directive[Black, 25],
PlotLegends ->
Placed[BarLegend[{Automatic(*ColorData[
"RedBlueTones"]*), {-6, 13}}, LegendMarkerSize -> 340,
LegendLabel ->
Placed["\!\(\*SubscriptBox[\(Log\), \
\(10\)]\)[\!\(\*SubscriptBox[\(f\), \(ALP\)]\) [\!\(\*SuperscriptBox[\
\(GeV\), \(-1\)]\) \!\(\*SuperscriptBox[\(rad\), \(-1\)]\)]]",
Bottom], LabelStyle -> {FontSize -> 22},
Method -> {FrameStyle -> Black, AxesStyle -> None,
TicksStyle -> Black}], Bottom],
PlotLabel ->
Style[Row[{"ALPs coupled to \[Gamma]. Primakov process. \
\!\(\*SubscriptBox[\(m\), \(a\)]\) = 1 GeV"}], 18, Black],
FrameTicks -> {{Automatic, Automatic}, {TicksPlotx, None}}]