0
$\begingroup$

I have the following plot enter image description here

I'd like to remove the edges of what look like boxes around the text with T's. For example, the $5T_2$ label has a hard edge around it which cuts into the lines. Is there a way to remove this background?

I used the following for the data

data1 = {
   n1[[;; , 3 ;; 4]],
   n2[[;; , 3 ;; 4]],
   n4[[;; , 3 ;; 4]],
   n8[[;; , 3 ;; 4]],
   n16[[;; , 3 ;; 4]],
   n32[[;; , 3 ;; 4]],
   Callout[n64[[;; , 3 ;; 4]], "64", After, FrameMargins -> None, 
    LeaderSize -> 5],
   Callout[n128[[;; , 3 ;; 4]], "128", After, FrameMargins -> None, 
    LeaderSize -> 5],
   Callout[ntheory[[;; , 3 ;; 4]], "\[Infinity]", After, 
    FrameMargins -> None, LeaderSize -> 5]
   };
places1 = Placed[
   {"1", "2", "4", "8", "16", "32"},
   {{21.5, 0.32}, {12.5, 1.1}, {31, 3.84}, {31, 14.66}, {31, 
     37.5}, {31, 75}}
   ];
data2 = {
   r1[[;; , 3 ;; 4]],
   r2[[;; , 3 ;; 4]],
   r3[[;; , 3 ;; 4]],
   r4[[;; , 3 ;; 4]],
   r5[[;; , 3 ;; 4]],
   r6[[;; , 3 ;; 4]],
   r7[[;; , 3 ;; 4]],
   r8[[;; , 3 ;; 4]],
   r9[[;; , 3 ;; 4]],
   r10[[;; , 3 ;; 4]]
   };
places2 = 
  Placed[{Style["1\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
     Background -> {None, Opacity[0]}], 
    Style["2\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
     Background -> Lighter[Gray, 1]], 
    "3\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
    "4\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
    "1\!\(\*SubscriptBox[\(T\), \(1\)]\)", 
    "5\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
    "6\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
    "7\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
    "8\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
    "9\!\(\*SubscriptBox[\(T\), \(2\)]\)"},
   {{3, 1.5}, {5.8, 5}, {9, 12}, {12, 20}, {14, 25}, {16, 32}, {19, 
     45}, {22, 60}, {25, 90}, {28, 100}}
   ];

And to plot

img = Show[
  ListLinePlot[
   data1,
   ScalingFunctions -> "Log",
   PlotRange -> {{0, 30}, {0, 200}},
   Frame -> True,
   FrameTicks -> Automatic, 
   FrameLabel -> {Style["T", 14], 
     Style["(E+1/3)\!\(\*SuperscriptBox[\(n\), \(2\)]\)", 14]},
   PlotLabels -> places1
   ],
  ListLinePlot[
   data2,
   ScalingFunctions -> "Log",
   PlotStyle -> Dashed,
   PlotRange -> {{0, 30}, {0, 200}},
   PlotLabels -> places2
   ],
  Graphics[{White, Rectangle[Scaled[{1, 0}], ImageScaled[{1, 1}]]}],
  ListLinePlot[
   data1,
   ScalingFunctions -> "Log",
   PlotRange -> {{0, 30}, {0, 200}},
   PlotStyle -> Opacity[0],
   PlotLabels -> places1
   ],
  ImageSize -> Large
  ]

I can also provide the data if needed, but it's kind of long. Let me know if I need to post that as well.

Here is the data which was used for the plots.

{{0, 1, 6.1559, 0.268762, 1, 0}, {1, 1, 21.2234, 0.316673, 2, 0}, {0, 
  2, 4.29788, 0.671316, 1, 0}, {1, 2, 12.3117, 1.07505, 2, 0}, {0, 4, 
  3.33506, 0.972728, 1, 0}, {1, 4, 8.59587, 2.68529, 2, 0}, {2, 4, 
  14.3822, 3.59775, 3, 0}, {3, 4, 103.51, 5.12115, 9, 0}, {0, 8, 
  3.15531, 1.12982, 1, 0}, {1, 8, 6.67039, 3.89115, 2, 0}, {2, 8, 
  10.7852, 7.10209, 3, 0}, {3, 8, 17.1918, 10.7412, 4, 0}, {4, 8, 
  22.6351, 12.7895, 1, 1}, {5, 8, 28.7645, 14.391, 6, 0}, {6, 8, 
  49.2471, 17.2008, 8, 0}, {7, 8, 207.019, 20.4846, 18, 0}, {0, 16, 
  3.10751, 1.17763, 1, 0}, {1, 16, 6.31083, 4.51953, 2, 0}, {2, 16, 
  9.69797, 9.52761, 3, 0}, {3, 16, 13.3399, 15.5631, 4, 0}, {4, 16, 
  16.0614, 20.0555, 1, 1}, {5, 16, 17.291, 22.0215, 5, 0}, {6, 16, 
  21.5697, 28.4074, 6, 0}, {7, 16, 34.3835, 42.9646, 8, 0}, {8, 16, 
  45.2694, 51.1576, 2, 1}, {9, 16, 73.4464, 63.2197, 14, 0}, {10, 16, 
  146.495, 74.4367, 21, 0}, {11, 16, 414.038, 81.9384, 36, 0}, {0, 32,
   3.09517, 1.1901, 1, 0}, {1, 32, 6.21485, 4.71025, 2, 0}, {2, 32, 
  9.38272, 10.4148, 3, 0}, {3, 32, 12.6216, 18.078, 4, 0}, {4, 32, 
  14.5034, 23.2028, 1, 1}, {5, 32, 19.3944, 38.1056, 6, 0}, {6, 32, 
  22.9672, 49.8306, 7, 0}, {7, 32, 26.6821, 62.2602, 8, 0}, {8, 32, 
  32.123, 80.2231, 2, 1}, {9, 32, 34.5814, 88.0839, 10, 0}, {10, 32, 
  43.1396, 113.63, 12, 0}, {11, 32, 47.6313, 125.776, 13, 0}, {12, 32,
   71.2611, 176.253, 17, 0}, {13, 32, 90.5376, 204.629, 4, 1}, {14, 
  32, 292.991, 297.747, 42, 0}, {15, 32, 828.078, 327.754, 72, 0}, {0,
   64, 3.09215, 1.19332, 1, 0}, {1, 64, 6.19048, 4.7606, 2, 0}, {2, 
  64, 9.29984, 10.6613, 3, 0}, {3, 64, 12.4299, 18.8417, 4, 0}, {4, 
  64, 14.1178, 24.1366, 1, 1}, {5, 64, 15.5828, 29.2084, 5, 0}, {6, 
  64, 18.7656, 41.66, 6, 0}, {7, 64, 21.9839, 56.0735, 7, 0}, {8, 64, 
  25.2452, 72.3225, 8, 0}, {9, 64, 28.5489, 90.2278, 9, 0}, {10, 64, 
  31.906, 109.665, 10, 0}, {11, 64, 45.4461, 196.072, 3, 1}, {12, 64, 
  69.1626, 352.334, 20, 0}, {13, 64, 95.2646, 503.116, 26, 0}, {14, 
  64, 152.377, 737.595, 36, 0}, {15, 64, 215.82, 894.86, 46, 0}, {16, 
  64, 585.985, 1190.99, 84, 0}, {17, 64, 1656.15, 1311.01, 144, 
  0}, {0, 128, 3.09119, 1.19396, 1, 0}, {1, 128, 6.18433, 4.77331, 2, 
  0}, {2, 128, 9.28031, 10.728, 3, 0}, {3, 128, 12.3809, 19.0422, 4, 
  0}, {4, 128, 14.0225, 24.3839, 1, 1}, {5, 128, 15.4878, 29.6946, 5, 
  0}, {6, 128, 18.6017, 42.6541, 6, 0}, {7, 128, 21.7263, 57.8967, 7, 
  0}, {8, 128, 24.861, 75.3736, 8, 0}, {9, 128, 28.0055, 95.0272, 9, 
  0}, {10, 128, 31.1663, 116.839, 10, 0}, {11, 128, 40.7386, 194.506, 
  13, 0}, {12, 128, 47.2154, 255.886, 15, 0}, {13, 128, 57.1007, 
  360.945, 18, 0}, {14, 128, 60.4418, 399.07, 19, 0}, {15, 128, 
  77.577, 609.68, 24, 0}, {16, 128, 90.8961, 784.34, 6, 1}, {17, 128, 
  102.952, 945.587, 31, 0}, {18, 128, 118.272, 1149.82, 35, 0}, {19, 
  128, 159.424, 1667.05, 45, 0}, {20, 128, 431.637, 3579.43, 92, 
  0}, {-1., \[Infinity], 3.09114, 1.19439, 1., 0.}, {-1., \[Infinity],
   6.18228, 4.77757, 2., 0.}, {-1., \[Infinity], 9.27342, 10.7495, 3.,
   0.}, {-1., \[Infinity], 12.3646, 19.1103, 4., 
  0.}, {-1., \[Infinity], 13.9904, 24.4666, 1., 
  1.}, {-1., \[Infinity], 15.4557, 29.8598, 5., 
  0.}, {-1., \[Infinity], 18.5468, 42.9982, 6., 
  0.}, {-1., \[Infinity], 21.638, 58.5253, 7., 0.}, {-1., \[Infinity],
   24.7291, 76.4412, 8., 0.}, {-1., \[Infinity], 27.8203, 96.7459, 9.,
   0.}, {-1., \[Infinity], 27.9809, 97.8663, 2., 
  1.}, {-1., \[Infinity], 30.9114, 119.439, 10., 
  0.}, {-1., \[Infinity], 34.0025, 144.522, 11., 
  0.}, {-1., \[Infinity], 37.0937, 171.993, 12., 
  0.}, {-1., \[Infinity], 40.1848, 201.853, 13., 
  0.}, {-1., \[Infinity], 41.9713, 220.199, 3., 
  1.}, {-1., \[Infinity], 43.276, 234.101, 14., 
  0.}, {-1., \[Infinity], 46.3671, 268.739, 15., 
  0.}, {-1., \[Infinity], 49.4582, 305.765, 16., 
  0.}, {-1., \[Infinity], 52.5494, 345.18, 17., 
  0.}, {-1., \[Infinity], 55.6405, 386.984, 18., 
  0.}, {-1., \[Infinity], 55.9618, 391.465, 4., 
  1.}, {-1., \[Infinity], 58.7317, 431.176, 19., 
  0.}, {-1., \[Infinity], 61.8228, 477.757, 20., 
  0.}, {-1., \[Infinity], 64.914, 526.728, 21., 
  0.}, {-1., \[Infinity], 68.0051, 578.087, 22., 
  0.}, {-1., \[Infinity], 69.9522, 611.664, 5., 
  1.}, {-1., \[Infinity], 71.0962, 631.834, 23., 
  0.}, {-1., \[Infinity], 74.1874, 687.971, 24., 
  0.}, {-1., \[Infinity], 77.2785, 746.496, 25., 
  0.}, {-1., \[Infinity], 80.3697, 807.41, 26., 
  0.}, {-1., \[Infinity], 83.4608, 870.713, 27., 
  0.}, {-1., \[Infinity], 83.9427, 880.797, 6., 
  1.}, {-1., \[Infinity], 86.5519, 936.405, 28., 
  0.}, {-1., \[Infinity], 89.6431, 1004.49, 29., 
  0.}, {-1., \[Infinity], 92.7342, 1074.95, 30., 
  0.}, {-1., \[Infinity], 95.8254, 1147.81, 31., 
  0.}, {-1., \[Infinity], 97.9331, 1198.86, 7., 
  1.}, {-1., \[Infinity], 98.9165, 1223.06, 32., 
  0.}, {-1., \[Infinity], 102.008, 1300.69, 33., 
  0.}, {-1., \[Infinity], 105.099, 1380.72, 34., 
  0.}, {-1., \[Infinity], 108.19, 1463.13, 35., 
  0.}, {-1., \[Infinity], 111.281, 1547.93, 36., 
  0.}, {-1., \[Infinity], 111.924, 1565.86, 8., 
  1.}, {-1., \[Infinity], 114.372, 1635.13, 37., 
  0.}, {-1., \[Infinity], 117.463, 1724.7, 38., 
  0.}, {-1., \[Infinity], 120.554, 1816.67, 39., 
  0.}, {-1., \[Infinity], 123.646, 1911.03, 40., 
  0.}, {-1., \[Infinity], 125.914, 1981.79, 9., 
  1.}, {-1., \[Infinity], 126.737, 2007.78, 41., 
  0.}, {-1., \[Infinity], 129.828, 2106.91, 42., 
  0.}, {-1., \[Infinity], 132.919, 2208.43, 43., 
  0.}, {-1., \[Infinity], 136.01, 2312.35, 44., 
  0.}, {-1., \[Infinity], 139.101, 2418.65, 45., 
  0.}, {-1., \[Infinity], 139.904, 2446.66, 10., 
  1.}, {-1., \[Infinity], 142.192, 2527.34, 46., 
  0.}, {-1., \[Infinity], 145.284, 2638.42, 47., 
  0.}, {-1., \[Infinity], 148.375, 2751.88, 48., 
  0.}, {-1., \[Infinity], 151.466, 2867.74, 49., 
  0.}, {-1., \[Infinity], 154.557, 2985.98, 50., 0.}}

Hopefully adding this data will let you run the code. Sorry that it just had to be pasted in and not generated with Mathematica code.

$\endgroup$
  • $\begingroup$ Please add the code for your plot to your question. Otherwise we can't really help :) $\endgroup$ – Carl Lange May 3 at 21:53
  • $\begingroup$ I've added the code used to generate the plot. $\endgroup$ – Bo Johnson May 3 at 22:17
  • $\begingroup$ Your code post is incomplete. It can't be run. Please give code needed to generate data. It doesn't need to be the full data set. $\endgroup$ – m_goldberg May 3 at 22:51
  • $\begingroup$ The data is actually generated from some C code, so I've given the data above. $\endgroup$ – Bo Johnson May 3 at 23:08
2
$\begingroup$

I worked with some contrived data and came up with this. I believe the general approach will work with your actual data even some of details need to changed.

Contrived data

data1 = Table[x^1.35 + 50, {x, 0, 33}];
data2 = Table[x^1.35, {x, 0, 33}]; 
places1 =
  Placed[
   {"1", "2", "4", "8", "16", "32"}, 
   Table[{x, Log[x^1.35 + 50]} // N, {x, Subdivide[2, 28, 5]}]];
places2 =
  Placed[
    {"1\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
     Style["2\!\(\*SubscriptBox[\(T\), \(2\)]\)", Background -> Lighter[Gray, .6]], 
     "3\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
     "4\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
     "1\!\(\*SubscriptBox[\(T\), \(1\)]\)", 
     "5\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
     "6\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
     "7\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
     "8\!\(\*SubscriptBox[\(T\), \(2\)]\)", 
     "9\!\(\*SubscriptBox[\(T\), \(2\)]\)"}, 
    N[{#[[1]], Log @ #[[2]]}] & /@ 
     {{3, 1.5}, {5.8, 5}, {9, 12}, {12, 20}, {14, 25}, {16, 32}, 
      {19, 45}, {22, 60}, {25, 90}, {28, 100}}];

The important thing to notice in the above is that because the plot data is going to log scaled, the y-components of label coordinates also have to be log scaled.

Given the properly scaled placements, the plotting can be done with the fairly simple code that follows:

Show[
  ListLinePlot[data1,
    ScalingFunctions -> "Log",
    PlotRange -> {{0, 30}, {0, 200}},
    Frame -> True,
    FrameTicks -> Automatic, 
    FrameLabel -> 
      {Style["T", 14], Style["(E+1/3)\!\(\*SuperscriptBox[\(n\), \(2\)]\)", 14]},
    PlotLabels -> places1],
  ListLinePlot[data2,
    ScalingFunctions -> "Log",
    PlotStyle -> Dashed,
    PlotRange -> {{0, 30}, {0, 200}},
    PlotLabels -> places2],
 ImageSize -> Large]

[plot[1]

Note that none of labels, except for $2T_2$, has a background

$\endgroup$
  • $\begingroup$ The simplest way to achieve the same effect is to use option Background->Transparent inside the Callout $\endgroup$ – Rom38 May 4 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.