`테이블`의 플롯에 대한`PlotLabel`

Sep 08 2020

다음과 같이 Table두 개의 플롯 이 포함되어 있습니다.

Table[
 Plot[{Re[f[n]] /. j -> 3, Im[f[n]] /. j -> 3}, {n, 0, 15}, 
  GridLines -> Automatic, PlotRange -> All, PlotLegends -> {"Real", "Imaginary"}, 
  PlotLabel -> f[n]], 
{f, {Sum[Sinc[Pi*(#1 - i*j)], {i, 1, Floor[#1]}] & , 
   (-1 + E^(2*I*Pi*#1))/(j*(-1 + E^((2*I*Pi*#1)/j))) & }}
]

보시다시피 Mathematica는 첫 번째 PlotLabel(예 :)를 Sum[Sinc[Pi*(#1 - i*j)], {i, 1, Floor[#1]}] &더 유용하거나 자연스러운 표현으로 다시 작성했습니다 . 나는 이것을하기를 원하지 않는다. 내가 원하는 PlotLabel다음과 같이 해당 플롯을 위해 :

즉, 작성된 것처럼 PlotLabel -> "expr". 그러나 다른 레이블은 이미 내가 원하는 방식입니다.

나는 사용하여 실험 StringForm했지만 도움이되지 않습니다. 어떻게해야합니까? 아니면 불가능합니까?

답변

6 kglr Sep 08 2020 at 19:04
Table[Plot[{Re[ReleaseHold@f] /. j -> 3,  Im[ReleaseHold@f] /. j -> 3}, {n, 0, 15}, 
  GridLines -> Automatic, 
  PlotRange -> All, ImageSize -> 350, 
  PlotLegends -> {"Real", "Imaginary"}, 
  PlotLabel ->  f], 
{f, {HoldForm@Sum[Sinc[Pi*(n - i*j)], {i, 1, Floor[n]}], 
   HoldForm[(-1 + E^(2*I*Pi*n))/(j*(-1 + E^((2*I*Pi*n)/j)))]}}]

동일한 결과를 얻기 위해 및 각각 HoldFormReleaseHold로 바꿀 수 있습니다 .DeferFirst

Bob Hanlon이 의견에서 제안했듯이 버전 12.0 이상에서는 ReImPlot다음과 같이 사용할 수 있습니다 .

 Table[ReImPlot[ReleaseHold[f] /. j -> 3, {n, 0, 15}, 
    GridLines -> Automatic, PlotRange -> All, ImageSize -> 350, 
    PlotLegends -> "ReIm", 
    ReImLabels -> {"Real", "Imaginary"}, 
    ReImStyle -> {ColorData[97][1], {ColorData[97][2], Dashing[{}]}},
    PlotLabel -> f], 
  {f, {HoldForm@Sum[Sinc[Pi*(n - i*j)], {i, 1, Floor[n]}], 
      HoldForm[(-1 + E^(2*I*Pi*n))/(j*(-1 + E^((2*I*Pi*n)/j)))]}}]