Setzen Sie Inset außerhalb des Plotbereichs

Sep 09 2020

Ich möchte einen Einschub (a)weiter nach unten setzen ( ungefähr so ​​hoch wie der BarLegend ). Der folgende Code scheint dies jedoch nicht zuzulassen. Kann man das irgendwie machen?

data = Table[
   Sin[x] Cos[y] + 0.05 x y, {x, 0, 2 Pi, 0.1}, {y, 0, 2 Pi, 0.1}];
labellst = {"(a)", {0.15, 0.03}};
insetlst = Inset[Style[#[[1]], Large], ImageScaled[#[[2]]]] &@labellst;
MatrixPlot[data, PlotLegends -> Automatic, PlotRangeClipping -> False,
  Epilog -> insetlst, LabelStyle -> Medium, AspectRatio -> 1/2]

Antworten

4 OkkesDulgerci Sep 09 2020 at 02:26

Spielen Sie bei Bedarf mit den Parametern.

labelSize = 30;
labelPos = {0.1, -0.2};
legendPos = {0.5, -0.1};
data = Table[
   Sin[x] Cos[y] + 0.05 x y, {x, 0, 2 Pi, 0.1}, {y, 0, 2 Pi, 0.1}];
MatrixPlot[data, PlotLegends -> Placed[Automatic, Scaled[legendPos]], 
 LabelStyle -> Medium, AspectRatio -> 1/2, 
 Epilog -> Text[Style["(a)", labelSize], Scaled[labelPos]]]

3 Rom38 Sep 09 2020 at 01:36

Die Unterkennzeichnung der Parzellen wird in MMA schon schlimm genug realisiert. Ich denke, der einfachste Weg ist Overlay:

Overlay[
 {ContourPlot[Sin[x y^2], {x, -6, 6}, {y, -3, 3},
   AspectRatio -> Automatic,
   ContourStyle -> None,
   ImageSize -> 600,
   ColorFunction -> "Rainbow",
   PlotLegends -> 
    Placed[BarLegend[{"Rainbow", {-1, 1}}, 10, 
      LegendMarkerSize -> 350], Below]],
  Graphics[{Text[Style["a)", 14, Bold], Scaled@{0, 0}]}, 
   ImageSize -> {350, 350}]}
 ]

Wenn man mit ImageSizeder GraphicsEbene spielt, kann man die gewünschte Position des Etiketts erhalten.

3 kglr Sep 09 2020 at 01:59

So haben Sie das Etikett an derselben vertikalen Position wie die Legende:

1. Inject das Etikett in die Legende mit der Option LegendFunctionin BarLegend:

MatrixPlot[data, 
 PlotLegends -> BarLegend[Automatic, 
      LegendFunction -> (Row[{Style[labellst[[1]], Large], #}] &)], 
 PlotRangeClipping -> False, LabelStyle -> Medium, AspectRatio -> 1/2]

2. Fügen Sie das Etikett als Legende hinzu und geben Sie mehrere Legenden an in PlotLegends:

MatrixPlot[data, 
 PlotLegends -> Thread[Placed[{Style[labellst[[1]], Large], Automatic}, Below]], 
 PlotRangeClipping -> False, LabelStyle -> Medium, AspectRatio -> 1/2]

Mit dem können Sie eine genauere Positionierung vornehmen $\{\{e_x,e_y\},\{l_x, l_y\}\}$Form statt symbolischer Positionen in Placed:

positions = {{{.5, -.1}, {.5, .5}}, {{.15, -.1}, {.5, .5}}};

MatrixPlot[data, 
 PlotLegends -> Thread[Placed[{Automatic, Style[labellst[[1]], Large]}, positions]],
  PlotRangeClipping -> False, LabelStyle -> Medium, 
  AspectRatio -> 1/2]

3. Post-Prozess - MatrixPlotAusgang das Etikett links von der Legende einzufügen:

MatrixPlot[data, PlotLegends -> Automatic, PlotRangeClipping -> False,
   LabelStyle -> Medium, AspectRatio -> 1/2] /. 
 Placed[lg_, a__] :> Placed[Row[{Style[labellst[[1]], Large], lg}], a]

3 valarmorghulis Sep 09 2020 at 21:27

Hier ist ein direkter Weg mit LegendLabel

data = Table[
   Sin[x] Cos[y] + 0.05 x y, {x, 0, 2 Pi, 0.1}, {y, 0, 2 Pi, 0.1}];
MatrixPlot[data,PlotLegends -> Placed[BarLegend[Automatic, LegendMarkerSize -> 280, 
    LegendLabel -> Placed[Style[Text["(a)"], Red, FontSize -> 24], Left]], Bottom], 
 AspectRatio -> 1/2]