3
$\begingroup$

When adding rotated insets to an empty plot in Mathematica 10, the text looks fine:

enter image description here

And when adding them to a ListPlot, the text also looks fine:

enter image description here

Add them to a RegionPlot, however, and they look awful!

enter image description here

I tried the FontOpacity -> 0.999 trick mentioned here, but it does not make the text unblurry. Anyone know what to do here? Code below:

lbfs = Range[-5, 0];
Show[
 (*Graphics[{}]*)
 (*ListPlot[{{4, -3}, {7, -1}}, Joined -> True, Axes -> False]*)
 RegionPlot[x y>-10,{x,3,8},{y,-5,0}], 
 PlotTheme -> "Classic", ImageSize -> 500, Frame -> True, 
 PlotRange -> {{3, 8}, {-5, 0}}, 
 FrameStyle -> 
  Directive[FontSize -> 18, FontFamily -> Times, Black, 
    AbsoluteThickness@1], FrameLabel -> {"x", "y"}, 
 PlotRangePadding -> 0, 
 Epilog -> 
  Table[Inset[
    Rotate[Style[Text@Superscript[10, lbfs[[i]]], FontSize -> 14, 
      FontFamily -> Times], 
     10. \[Degree]], {4 + 
      2 (i - 1)/(Length@lbfs - 1), -3.5 + (-0.65) (i - 1)/(
       Length@lbfs - 1)}], {i, Length@lbfs}], AspectRatio -> 1]
$\endgroup$
  • $\begingroup$ Please post lbsf. $\endgroup$ – David G. Stork Jan 28 '16 at 20:07
  • $\begingroup$ Apologies, added. $\endgroup$ – Guillochon Jan 28 '16 at 20:47
  • 1
    $\begingroup$ It works okay for me. Could be related to your graphics hardware and the partial opacity in the RegionPlot. How does it look if you add PlotStyle -> Opacity[1] to the region plot? $\endgroup$ – Simon Woods Jan 28 '16 at 21:35
  • $\begingroup$ @SimonWoods Indeed it is opacity related, setting the opacity to 1 does get rid of the issue. Is the Overlay option really the only way out? Seems like a bug to me. $\endgroup$ – Guillochon Jan 29 '16 at 13:46
  • $\begingroup$ @SimonWoods Also, tried this on two different Macs (MBP and iMac), both on 10.11.3, and I get the same issue in both. $\endgroup$ – Guillochon Jan 29 '16 at 13:49
2
$\begingroup$

As @SimonWoods pointed out, this is Opacity[] related. One possible solution is by "tricking" and Overlay[]:

lbfs = Range[-5, 0];
gtxt = Show[Graphics[{}], 
   PlotTheme -> "Classic", ImageSize -> 500, Frame -> True, 
   PlotRange -> {{3, 8}, {-5, 0}}, 
   FrameStyle -> 
    Directive[FontSize -> 18, FontFamily -> Times, Black, 
     AbsoluteThickness@1], FrameLabel -> {"x", "y"}, 
   PlotRangePadding -> 0, 
   Epilog -> 
    Table[Inset[
      Rotate[Style[Text@Superscript[10, lbfs[[i]]], FontSize -> 14, 
        FontFamily -> Times], 
       10. \[Degree]], {4 + 
            2 (i - 1)/(Length@lbfs - 1), -3.5 + (-0.65) (i - 
            1)/(Length@lbfs - 1)}], {i, Length@lbfs}], 
   AspectRatio -> 1];

gra = Show[(*Graphics[{}]*)(*ListPlot[{{4,-3},{7,-1}},
   Joined\[Rule]True,Axes\[Rule]False]*)
   RegionPlot[x y > -10, {x, 3, 8}, {y, -5, 0}], 
   PlotTheme -> "Classic", ImageSize -> 500, Frame -> True, 
   PlotRange -> {{3, 8}, {-5, 0}}, 
   FrameStyle -> 
    Directive[FontSize -> 18, FontFamily -> Times, Black, 
     AbsoluteThickness@1], FrameLabel -> {"x", "y"}, 
   PlotRangePadding -> 0, AspectRatio -> 1];

Overlay[{gra, gtxt}]

Basically, create a text layer gtxt with only the text and a graph layer gra, then use Overlay[] instead of Show[] to put them together. As I understand, Show[] will copy the style of the first element and ignore the style of other elements. Result:

enter image description here

$\endgroup$
  • $\begingroup$ Doesn't this double up the axes/labels (the graphic now has two of them)? $\endgroup$ – Guillochon Jan 29 '16 at 13:48
  • $\begingroup$ Yes, but since both are the same position/style, they appear as one. $\endgroup$ – egwene sedai Jan 29 '16 at 13: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.