Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot change font size /type in plots

I recently had to re-install my operating system (Ubuntu). The only thing I did differently is that I installed Matlab on a separate partition, not the main Ubuntu partition. After re-installing, the fonts in my plots are no longer configurable. For example, if I ask the title font to be bold, it doesn't happen. I ran the sample code below on my computer and then on my colleague's computer and the 2 results are attached. This cannot be a problem with the code; rather in the settings of Matlab. Could somebody please tell me what settings I need to change? Thanks in advance for your help.

Regards,

Sameet.

x1=-pi:.1:pi;
x2=-pi:pi/10:pi;
y1=sin(x1);
y2=tan(sin(x2)) - sin(tan(x2));
[AX,H1,H2]=plotyy(x1,y1,x2,y2);
xlabel ('Time (hh:mm)');
ylabel (AX(1), 'Plot1');
ylabel (AX(2), 'Plot2');
axes(AX(2))
set(H1,'linestyle','none','marker','.');
set(H2,'linestyle','none','marker','.');
title('Plot Title','FontWeight','bold');
set(gcf, 'Visible', 'off');
[legh, objh] = legend([H1 H2],'Plot1', 'Plot2','location','Best');
set(legend,'FontSize',8); 
print -dpng Trial.png;

Bad image: http://imageshack.us/photo/my-images/708/trial1u.png/

Good image: http://imageshack.us/photo/my-images/87/trial2.png/

like image 296
Sameet Nabar Avatar asked Oct 30 '12 22:10

Sameet Nabar


2 Answers

I think the problem is not in the fonts but in NVIDIA's DPI settings. From this link about How to fix MATLAB small figures and small fonts in Ubuntu linux:

In order to set your display DPI setting, you will need to add the following lines to your xorg.conf file in the "Device" section:

Option "UseEdidDpi"   "false"
Option "Dpi"          "92 x 92"

If you are new to linux, you can accomplish this with the following procedure:

  • Launch a terminal window by going to Applications -> Accessories -> Terminal
  • type this and press Enter: sudo gedit /etc/X11/xorg.conf
  • add the above 2 lines in the "Device" section in the file
  • Save, restart your computer

If this is not the case, try to follow this thread.

like image 134
bla Avatar answered Oct 23 '22 19:10

bla


I installed xfonts-100dpi and xfonts-75dpi. Then log out and log in.

It helped me perfectly with this issue in Linux Mint Petra. I did not try it in Ubuntu.

like image 39
ZMosna Avatar answered Oct 23 '22 19:10

ZMosna