2
$\begingroup$
Figure[
 FigurePanel[
  {
   FigGraphics[Plot[0.5, {x, 0, 10}, {PlotStyle -> Black}]];
   FigGraphics[Plot[1, {x, 0, 10}, {PlotStyle -> {Red, Dashed}}]];
   FigGraphics[Plot[2, {x, 0, 10}, {PlotStyle -> {Blue, Dotted}}]];
   },
  XPlotRange -> {0, 10},
  YPlotRange -> {0, 4}
  ],
 CanvasSize -> {4, 2.5}
 ]

test

How can I add something like this to the Figure? Thanks.

enter image description here

$\endgroup$
8
  • 1
    $\begingroup$ Code firstly,don't just provide a screenshot,please. $\endgroup$
    – yode
    Commented Apr 5, 2017 at 15:03
  • 1
    $\begingroup$ Wrap the whole thing in Legended and use LineLegend. $\endgroup$
    – rcollyer
    Commented Apr 5, 2017 at 15:08
  • $\begingroup$ @rcollyer Could you be a little more specific? $\endgroup$ Commented Apr 6, 2017 at 13:51
  • $\begingroup$ @GrigoriSun Legended has the form Legended[object, legend], and Figure returns a Graphics so it is perfect for this. Use Legended[figure, LineLegend[...]]. $\endgroup$
    – rcollyer
    Commented Apr 6, 2017 at 13:56
  • $\begingroup$ @rcollyer Thanks! Is there a more native way in scidraw that does the trick? $\endgroup$ Commented Apr 6, 2017 at 14:20

1 Answer 1

2
$\begingroup$

FigInset works with graphics (namely _Graphics|_ContourGraphics|_DensityGraphics|_Image|_Graphics3D); LineLegend is not a graphics object, rather a typeset object. Use FigLabel instead:

Figure[FigurePanel[{
  FigGraphics[Plot[0.5, {x, 0, 10}, {PlotStyle -> Black}]];
  FigGraphics[Plot[1, {x, 0, 10}, {PlotStyle -> {Red, Dashed}}]];
  FigGraphics[Plot[2, {x, 0, 10}, {PlotStyle -> {Blue, Dotted}}]];
  FigLabel[
    LineLegend[
      {{Red, Dashed}, Black},
      {"\!\(\*SubscriptBox[\(\[Mu]I\), \(B\)]\) = 5.0", 
       "\!\(\*SubscriptBox[\(\[Mu]I\), \(B\)]\) = 10.0"}], 
      Point -> Scaled[{.05, .95}],
      TextOffset -> {-1, 1}];
}, XPlotRange -> {0, 10}, YPlotRange -> {0, 4}], 
CanvasSize -> {4, 2.5}]

Example

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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