font size changes in figures

40 ビュー (過去 30 日間)
tlawren
tlawren 2011 年 2 月 11 日
コメント済み: Subash Y 2015 年 4 月 14 日
I'm trying to change the sizes of various fonts in some figures, but the changes never seem to take place. Specifically, I'm wanting to change the font size of the x- and y-labels, the title, the legend, and the tick numbers on the axes. I've tried changing these settings in the GUI as well as hard coding them in to a script, but they never seem to happen. I can change some fonts to bold face, but that is about it.
The version of MATLAB I am using is 7.11.0 (R2010b) on Linux.
EDIT 3/5/2012 #1:
Okay, this issue resolved itself months ago, but now it has popped back up. (Ironically, people have posted to this question in the last few days!) A bunch of updates and changes have occurred since the issue was first resolved and today, but I wasn't responsible for them all so I can't speak to them. Either way, I am now running Matlab R2011b (7.13.0.564) on Fedora 16. I log into this machine via ssh (with X11 forwarding) from a machine running Arch Linux.
A recap of the issue I am seeing is the following, I can put titles and labels on axes, but I can't change the font size. No matter what I do, the font size that shows up in the figure is the default size. Everything works as normal if I physically run Matlab at the Fedora machine. It is only when I ssh into the Fedoar box that the issue shows up.
EDIT 3/5/2012 #2:
I changed the default fonts from Helvetica to Dejavu Sans using the method in the link below and everything works as normal now.
I've got Helvetica fonts on my Arch Linux machine, so I don't know what is going on.
  2 件のコメント
Andrew Newell
Andrew Newell 2011 年 2 月 11 日
Can you provide a short bit of code that shows what is happening? Insert it in the question.
Walter Roberson
Walter Roberson 2011 年 2 月 12 日
I seem to remember someone posting about a month ago with this issue on Linux. I do not recall that any solution was posted, though the version of Java used can make a difference.
My memory on this matter is questionable as I do not have the affected release.

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

採用された回答

tlawren
tlawren 2011 年 3 月 8 日
@ the cyclist - I have tried hard coding font setting as you've posted, but still nothing changes. It seems as if there is a bug in the Linux version of Matlab I am using.
@ Walter - A snippet of code could be be what the cyclist posted above. Trying that with all font sizes results in the same (default?) Matlab plot. I think it is Helvetica size 10.
I did just notice that if I hard code font settings and open up the editor, the font sizes are what the code sets them to. However, the actual sizes are not rendered in the actual plot/image.
  7 件のコメント
tlawren
tlawren 2011 年 3 月 8 日
I'm looking through the bug database right now, and I haven't found anything related to my problem/bug yet. If you've seen this problem/bug posted before, please send me a link to the posting. I may post a bug report myself about this issue.
tlawren
tlawren 2012 年 3 月 5 日
Well, this issues has popped back up. Yeah!

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

その他の回答 (11 件)

Daniel Shub
Daniel Shub 2012 年 3 月 5 日
As this has surfaced again, I will dig my answer out of the comment I made to Ken.
So while I had no problem on Debian and Ubuntu systems, I did run into this problem on my Arch based systems. I fixed the problem by installing some of the missing xorg-fonts* packages.
EDIT:
I can only provide an Arch specific hammer for solving the problem. Arch has the following xorg-font* packages:
xorg-fonts-100dpi xorg-fonts-cyrillic xorg-fonts-type1
xorg-fonts-75dpi xorg-fonts-encodings xorg-font-util
xorg-fonts-alias xorg-fonts-misc xorg-font-utils
I have all but xorg-fonts-cyrillic installed on my system. My install script specifically installs xorg-fonts-100dpi, xorg-fonts-75dpi, and xorg-fonts-type1. As a hammer I am guessing
# pacman -S xorg-fonts-100dpi xorg-fonts-75dpi xorg-fonts-type1
will pull in all the dependencies you need, but I haven't confirmed this. I have also not investigated what the minimal set of packages is to get fonts working correctly in MATLAB in Arch (or any other distro).
  6 件のコメント
Lukas
Lukas 2013 年 4 月 25 日
Worked for me too, thanks!
Herbert
Herbert 2015 年 2 月 12 日
Works for me on Mint Linux 17

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


the cyclist
the cyclist 2011 年 2 月 12 日
Here is a code snippet that shows some of the ways to control font sizes. Play around with the individuals values to see what changes.
x = 1:10;
y = 1:10;
plot(x,y)
set(gca,'FontSize',12)
title('Nice big title','FontSize',18)
xlabel('Normal x-axis label')
ylabel('Pretty big y-axis label','FontSize',14)
  1 件のコメント
Haroldo Hattori
Haroldo Hattori 2014 年 5 月 28 日
very good and straightforward suggestion.

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


Anna
Anna 2012 年 9 月 20 日
編集済み: Anna 2012 年 9 月 20 日
I have the same problem since I switched to Kubuntu 12.04 from Kubuntu 10.04. I use Matlab through ssh -X from a server. Since the Kubuntu switch, my old routines do not work properly anymore as neither Fonts, nor Font Size switches have ANY effect.
Will try searching and installing this "xfonts" Package and then try the Java version switch...
Yepp! It works with installing
apt-get install xfonts-75dpi
apt-get install xfonts-100dpi
  3 件のコメント
Alessandro Masullo
Alessandro Masullo 2012 年 10 月 6 日
I LOVE your answer, because it solved my problem <3 <3 <3
Israel Vaughn
Israel Vaughn 2013 年 3 月 13 日
Installing both xfonts and gsfonts did not fix this issue in Ubuntu 12.04, and yes I logged out and back in again.

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


vijP Pe
vijP Pe 2012 年 5 月 21 日
I have been facing the same problem with the new version of Matlab 2012a on Ubuntu 12.04. Installation of the font packages didnot help my case.
  2 件のコメント
Daniel Shub
Daniel Shub 2012 年 5 月 22 日
I would suggest contacting technical support.
Israel Vaughn
Israel Vaughn 2013 年 3 月 13 日
Also doesn't work on my ubuntu 12.04 system with 2012a, fonts are a nightmare!

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


Byron
Byron 2012 年 6 月 26 日
I was unable to control font size, and was unable to get Greek symbols to display when I connected to our CentOS server's Matlab via NX or "ssh -X" from a Linux Mint KDE virtual box. I didn't have the problem doing "ssh-X" from Linux Mint LXDE or Bodhi linux virtual boxes.
The solution for the Mint KDE box was to install gsfonts-X11; the soution for NX was to click "Configure" and check the box for using the server as the font host on the "environment" tab
The root problem is that programs generally try to use the client for font rendering: see the X Font Server (xfs) article on Wikipedia ( https://en.wikipedia.org/wiki/X_Font_Server ) to learn more about this.

Philippe
Philippe 2013 年 8 月 26 日
Using Ubuntu 12.04.2 (64 bits) and R2011a (Student version).
I needed to install xfonts-100dpi, xfonts-75dpi --> you can set fontsize, but you get ugly fonts.
I then installed gsfonts-X11 and gsfonts-other --> you can set fontsize and the fonts are NOT ugly.
Good luck!
  1 件のコメント
Jean-Baptiste
Jean-Baptiste 2014 年 8 月 13 日
On ubuntu 14.04, I installed gsfonts-X11 and gsfonts-other, and it worked ! Thanks to all.

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


Aaron
Aaron 2014 年 7 月 18 日
As others here have suggested before I installed the following packages:
sudo apt-get install xfonts-base xfonts-100dpi xfonts-75dpi gsfonts-X11 gsfonts-other
This solved the problem for me (Xubuntu 14.04, Matlab R2014a).
  1 件のコメント
Subash Y
Subash Y 2015 年 4 月 14 日
Thanks. This worked for me on Ubuntu 12.04, Matlab R2011a

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


Ken
Ken 2011 年 11 月 4 日
This is an acknowledged bug with Matlab on the Linux OS. It has persisted now for many versions, at least back to 2009. The Matlab developers have been saying they were going to fix this for years now, but of course they haven't. They're very bad about that. Also, they seem to introduce more bugs than they fix.
They're suggested workaround for this is to use EPS or PDF plots instead since PNG, TIFF, etc. are all affected by the bug. Of course, those plots have their own issues, e.g., they don't respect page sizing well. So, bottom line---you're screwed if you want to use Matlab on Linux and have people actually be able to see your fonts.
  2 件のコメント
Walter Roberson
Walter Roberson 2011 年 11 月 4 日
I have not witnessed this in R2008b in Ubuntu 10.04; with the information Daniel posted, at the moment it appears plausible that it affects Fedora but not Ubuntu.
Daniel Shub
Daniel Shub 2011 年 11 月 4 日
Ken do you have the links of the bug reports? So while I had no problem on Debian and Ubuntu systems, I did run into this problem on my Arch based systems. I fixed the problem by installing some of the missing xorg-fonts* packages. I don't fully understand the problem or how to fix it across different distros, so I didn't post a new answer.

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


Weigang
Weigang 2012 年 1 月 20 日
I had the same problem with R2011b and Ubuntu 11.10, and I believe this is a java problem. It can be solved by the following: - uninstall OpenJDK - install Sun Java - make sure sun java is configured to be the default java - Reboot the computer
  2 件のコメント
Daniel Shub
Daniel Shub 2012 年 3 月 5 日
I think this is a red herring. First, I am not sure that MATLAB uses the the version of JAVA that is installed with by the package manager. Second, in Debian it appears that OpenJDK does not have any dependencies on X11 fonts, but that Sun Java does. So while this might solve the problem, it is a little extreme.
tlawren
tlawren 2012 年 3 月 5 日
I think Daniel is correct. I tried switching to a Sun Java and it was no help. Also, it appears that for Windows and Linux Matlab ships with a JVM. You can switch the boxed JVM to the machine JVM if you want to, but use of the machine version is not default.

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


AurAlchemist
AurAlchemist 2012 年 5 月 4 日
I have the same problem here with R2011b on Fedora 16 (64 bits). The command set(gca,'FontSize',S) will not affect the font size of x- and y-tick labels, regardless of the value of font size S that is specified in the command. This is a big drawback to readability when preparing professional graphs, and I must now consider other softwares. I hope MathWorks will fix this issue soon.

andres llopis
andres llopis 2012 年 5 月 25 日
I solved the problem installing all the xfonts-* packages in ubuntu and changing font in graphs to Arial
  2 件のコメント
Daniel Shub
Daniel Shub 2012 年 5 月 25 日
Can you provide the names of the packages that helped? Maybe even the command you used.
Daniel Shub
Daniel Shub 2012 年 5 月 25 日
Based on this answer, it seems like my answer about installing the font packages might be worth an upvote :(

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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by