Message Boards Message Boards

0
|
1644 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Reducing the space between the legends for the LineLegend?

Hello, Is there any way to control the spacing between each legend in the legend box? Previously there seemed to be an option "Spacings" to specify the blank region between each legend, now I am using version 12, where the option is removed. So what are the alternative approach to realize this control of spacings?

I attached a notebook for illustration, where I would like to reduce the spacing between the legends in the box "t", "t^2" and "sin[t]", but leave the size of the lines and text unchanged.

POSTED BY: Haolin Li
2 Replies
Posted 2 years ago

Crossposted here.

POSTED BY: Rohit Namjoshi
Posted 2 years ago

Hi Haolin,

I am unable to reproduce the problem on "13.0.1 for Mac OS X ARM (64-bit) (January 28, 2022)".

enter image description here

So perhaps it is a bug in v12. As a workaround, the Spacings option does work even though it is not documented and is highlighted as an error in the front end. Try this

Plot[{t, t^2, Sin[t]}, {t, 0, Pi},
 PlotRange -> All,
 PlotPoints -> 10,
 Frame -> True,
 FrameStyle -> Thick,
 Axes -> {True, False}, 
 PlotLegends -> 
  Placed[
   LineLegend[{"t", "\!\(\*SuperscriptBox[\(t\), \(2\)]\)", "Sin[t]"},
     LegendFunction -> "Frame", 
     LegendLayout -> "Column", 
     Spacings -> 0.1], {{0.3, 0.9}, {1, 1}}], 
 GridLines -> {Pi*#/4 & /@ Range[0, 4], Automatic}, 
 BaseStyle -> {FontSize -> 15, FontFamily -> "Times New Roman", Thick}, 
 PlotStyle -> {{Thickness[0.005], Dotted, Cyan}, {Thickness[0.005], Dashed},
   {Thickness[0.005]}},
 ImageSize -> 500]
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract