Legend text appearance and behavior (2024)

Legend text appearance and behavior

expand all in page

Legend text properties control the appearance and behavior of the legend title. By changing property values, you can modify certain aspects of the title. Use dot notation to refer to a particular object and property:

l = legend('show');l.Title.String = 'My Title';l.Title.Color = 'red';c = l.Title.Color

Text

expand all

Text to display as title, specified as a character array, string array, cell array, categorical array, or numeric value.

Example: 'my title'

Example: string('my title')

Example: {'first line','second line'}

Example: 123

To include numeric variables with text in a title, use the num2str function. For example:

x = 42;str = ['The value is ',num2str(x)];

To include special characters, such as superscripts, subscripts, Greek letters, or mathematical symbols, use TeX markup. For a list of supported markup, see the Interpreter property.

To create multiline titles:

Numeric titles are converted to text using sprintf('%g',value). For example, 12345678 displays as 1.23457e+07.

Note

  • The words default, factory, and remove are reserved words that will not appear in a title when quoted as a normal character vector. To display any of these words individually, precede them with a backslash, such as '\default' or '\remove'.

  • If you specify this property as a categorical array, MATLAB® uses the values in the array, not the categories.

Selection mode for the Interpreter property, specified as one of these values:

  • 'auto' — Use the same value as the Interpreter property for the associated Legend object.

  • 'manual' — Use a value of Interpreter that you specify. To specify the value, set the Interpreter property. When you set the Interpreter property, the InterpreterMode property changes to 'manual'.

Font Style and Appearance

expand all

Selection mode for the Color property, specified as one of these values:

  • 'auto' — Use the same value as the TextColor property for the associated Legend object.

  • 'manual' — Use a value of Color that you specify. To specify the value, set the Color property. When you set the Color property, the ColorMode property changes to 'manual'.

Selection mode for the FontAngle property, specified as one of these values:

  • 'auto' — Use the same value as the FontAngle property for the associated Legend object.

  • 'manual' — Use a value of FontAngle that you specify. To specify the value, set the FontAngle property. When you set the FontAngle property, the FontAngleMode property changes to 'manual'.

Selection mode for the FontName property, specified as one of these values:

  • 'auto' — Use the same value as the FontName property for the associated Legend object.

  • 'manual' — Use a value of FontName that you specify. To specify the value, set the FontName property. When you set the FontName property, the FontNameMode property changes to 'manual'.

Selection mode for the FontSize property, specified as one of these values:

  • 'auto' — Use the same value as the FontSize property for the associated Legend object.

  • 'manual' — Use a value of FontSize that you specify. To specify the value, set the FontSize property. When you set the FontSize property, the FontSizeMode property changes to 'manual'.

Selection mode for the FontWeight property, specified as one of these values:

  • 'auto' — Use the same value as the FontWeight property for the associated Legend object.

  • 'manual' — Use a value of FontWeight that you specify. To specify the value, set the FontWeight property. When you set the FontWeight property, the FontWeightMode property changes to 'manual'.

Version History

Introduced in R2016a

See Also

legend | title

MATLAB-Befehl

Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:

 

Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.

Legend text appearance and behavior (1)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

Contact your local office

Legend text appearance and behavior (2024)

References

Top Articles
Latest Posts
Article information

Author: Laurine Ryan

Last Updated:

Views: 6440

Rating: 4.7 / 5 (77 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Laurine Ryan

Birthday: 1994-12-23

Address: Suite 751 871 Lissette Throughway, West Kittie, NH 41603

Phone: +2366831109631

Job: Sales Producer

Hobby: Creative writing, Motor sports, Do it yourself, Skateboarding, Coffee roasting, Calligraphy, Stand-up comedy

Introduction: My name is Laurine Ryan, I am a adorable, fair, graceful, spotless, gorgeous, homely, cooperative person who loves writing and wants to share my knowledge and understanding with you.