ENLARGE AND CHANGE COLOR OF A FRACTION IN TITLE !

8 views (last 30 days)
Hi everyone! Some help please! Beginner, here!
i used
h1=title('$y = \frac{1}{x+1}$');set (h1,'Interpreter','latex');
and got my desired fraction on title but TOO SMALL and BLACK.What are the exact lines to Change Size AND colour?
Thanks!!!

Accepted Answer

John D'Errico
John D'Errico on 19 Aug 2020
Not THAT much of a beginner. :) A true beginner thinks Latex is something you find in rubber gloves. :)
h1=title('$y = \frac{1}{x+1}$');set (h1,'Interpreter','latex');
>> h1
h1 =
Text ($y = \frac{1}{x+1}$) with properties:
String: '$y = \frac{1}{x+1}$'
FontSize: 11
FontWeight: 'bold'
FontName: 'Helvetica'
Color: [0 0 0]
HorizontalAlignment: 'center'
Position: [0.500000638346518 1.00401459854015 0.5]
Units: 'data'
Show all properties
>> get(h1)
BackgroundColor: 'none'
BeingDeleted: off
BusyAction: 'queue'
ButtonDownFcn: ''
Children: [0×0 GraphicsPlaceholder]
Clipping: off
Color: [0 0 0]
ContextMenu: [0×0 GraphicsPlaceholder]
CreateFcn: ''
DeleteFcn: ''
EdgeColor: 'none'
Editing: off
Extent: [0.456989192742906 1.00401459854015 0.0860229307605374 0.0400822771726734]
FontAngle: 'normal'
FontName: 'Helvetica'
FontSize: 11
FontSmoothing: on
FontUnits: 'points'
FontWeight: 'bold'
HandleVisibility: 'off'
HitTest: on
HorizontalAlignment: 'center'
Interpreter: 'latex'
Interruptible: on
LineStyle: '-'
LineWidth: 0.5
Margin: 3
Parent: [1×1 Axes]
PickableParts: 'visible'
Position: [0.500000638346518 1.00401459854015 0.5]
Rotation: 0
Selected: off
SelectionHighlight: on
String: '$y = \frac{1}{x+1}$'
Tag: ''
Type: 'text'
Units: 'data'
UserData: []
VerticalAlignment: 'bottom'
Visible: on
If you want to see all the properties, get gives you an expanded list.
Now, you can change a property on the fly using a simple assignment.
>> h1.FontSize = 18;
>> h1.Color = 'r'
h1 =
Text ($y = \frac{1}{x+1}$) with properties:
String: '$y = \frac{1}{x+1}$'
FontSize: 18
FontWeight: 'bold'
FontName: 'Helvetica'
Color: [1 0 0]
HorizontalAlignment: 'center'
Position: [0.500000638346518 1.00656934306569 0.5]
Units: 'data'
Show all properties
And now the title is as I set it.
  2 Comments
George Vigilaios
George Vigilaios on 19 Aug 2020
And very good humour, too! I am a beginner, indeed. You see, 20 days ago i thought Mathcad Prime 3.1 was better than Matlab. You see now, i have a good sense of humour as well.

Sign in to comment.

More Answers (1)

KSSV
KSSV on 19 Aug 2020
plot((1:10).^2)
title(['\fontsize{16}black {\color{magenta}magenta '...
'\color[rgb]{0 .5 .5}teal \color{red}red} black again'])

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!