Changing font size using xlabel

634 ビュー (過去 30 日間)
A
A 2011 年 6 月 6 日
コメント済み: Brando Miranda 2017 年 3 月 30 日
[EDIT: Mon Jun 6 16:32:41 UTC 2011 - Reformat - MKF]
Hello, I am putting a label on a graph using xlabel, and I want to increase the size of the font (to about 30) and possibly bold it (although, this is less important and I have not yet tried this).
I have tired using:
xlabel(text, 'FontSize', 30)
but this produces no notable change in the font size. Thank you in advance for your help!
Edit:
Using:
h = xlabel(printnombrejpg,'FontSize',60);
get(h)
Returns:
Annotation = [ (1 by 1) hg.Annotation array]
BackgroundColor = none
Color = [0 0 0]
DisplayName =
EdgeColor = none
Editing = off
Extent = [-435.849 -11.5896 837.736 8.69217]
FontAngle = normal
FontName = Helvetica
FontSize = [60]
FontUnits = points
FontWeight = normal
HorizontalAlignment = center
LineStyle = -
LineWidth = [0.5]
Margin = [2]
Position = [-5.76923 -4.46355 1.00011]
Rotation = [0]
String = cr45f__ch_24
Units = data
Interpreter = tex
VerticalAlignment = cap
BeingDeleted = off
ButtonDownFcn =
Children = []
Clipping = off
CreateFcn =
DeleteFcn =
BusyAction = queue
HandleVisibility = off
HitTest = on
Interruptible = on
Parent = [222.028]
Selected = off
SelectionHighlight = on
Tag =
Type = text
UIContextMenu = []
UserData = []
Visible = on
  4 件のコメント
A
A 2011 年 6 月 6 日
This is the code that I am using:
f=gcf;
printnombrejpg=strcat(cellname, '_ch_ ', num2str(neuronchan(cell)));
xlabel(printnombrejpg, 'FontSize', 100)
However, the font size does not change. Nor does it change with the methods suggested below... very weird! Thank you, everyone, for your answers!
Brando Miranda
Brando Miranda 2017 年 3 月 30 日
do you know how to do this in the GUI?

サインインしてコメントする。

採用された回答

Matt Fig
Matt Fig 2011 年 6 月 6 日
I suggest you edit your original post (read: don't make a new answer) to include the output from this:
xl = xlabel(printnombrejpg, 'FontSize', 100);
get(xl) % Show what this returns...
  6 件のコメント
A
A 2011 年 6 月 8 日
Thank you for finding this! (Sorry for the late reply).
I'm not sure if I have a courier, is there a way that I can find out? Hopefully this will fix the problem.
Brando Miranda
Brando Miranda 2017 年 3 月 30 日
do you know how to do this in the GUI?

サインインしてコメントする。

その他の回答 (2 件)

Paulo Silva
Paulo Silva 2011 年 6 月 6 日
h=xlabel('mylabel') %or h=get(gca,'xlabel')
set(h, 'FontSize', 30)
set(h,'FontWeight','bold') %bold font
  1 件のコメント
Brando Miranda
Brando Miranda 2017 年 3 月 30 日
do you know how to do this in the GUI?

サインインしてコメントする。


Chirag Gupta
Chirag Gupta 2011 年 6 月 6 日
Well it works for me!
I would suggest you try:
h = xlabel(text,'FontSize',30);
get(h)
and examine the properties. Specifically FontUnits
  3 件のコメント
A
A 2011 年 6 月 6 日
FontUnits says "points"
Brando Miranda
Brando Miranda 2017 年 3 月 30 日
do you know how to do this in the GUI?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by