Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone know how to change fonts in figures when using Octave?

Status
Not open for further replies.

flash3780

Mechanical
Dec 11, 2009
829
Ok... well I feel foolish. I didn't have Vera loaded on this machine. I tried Arial and it worked:
[tt]title("Pressure Vessel Cylinder\nStress Distribution",'FontSize',8,'FontName','Arial')[/tt]

That said, I can't seem to figure out how to list what fonts are available. Any suggestions there? I tried [tt]listfonts[/tt] and it doesn't seem to be implemented yet in Octave...

Also, it would be helpful if there were a way to change all of the fonts in the figure at once. set(h,'FontName','Arial') doesn't seem to work.

Thanks for the help.

//signed//
Christopher K. Hubley
Mechanical Engineer
Sunpower Incorporated
Athens, Ohio
 
Replies continue below

Recommended for you

Well, I still can't figure out how to find the available font names, but as far as changing the font goes a bit of tinkering produced this:
Code:
hh=findall(h,'-property','FontName')
set(hh,'FontName','Arial')
...which changes the typeface of the entire figure. :)

//signed//
Christopher K. Hubley
Mechanical Engineer
Sunpower Incorporated
Athens, Ohio
 
Ok, I figured out a way to change fonts (while I was waiting for Ansys to solve something unrelated). As I originally surmised, you can select a new font by pointing Octave/Matlab to the location of the font. Like so:
Code:
hh=findall(h,'-property','FontName')
set(hh,'FontName','/usr/share/fonts/dejavu/DejaVuSerifCondensed.ttf')
It seems that Octave recognizes some font names (eg. Arial), though I cannot seem to find a way to list what the recognized font names are.

Well, the method above might be clunky, but it does a fine job of selecting new fonts. I've attached a sample.

Hope this helps someone out there. :)

//signed//
Christopher K. Hubley
Mechanical Engineer
Sunpower Incorporated
Athens, Ohio
 
 http://files.engineering.com/getfile.aspx?folder=cd8e0f05-63fd-4a89-99e2-4219a4f83996&file=stressplot.png
Status
Not open for further replies.

Part and Inventory Search

Sponsor