Axis fonts, LaTeX font in legend

I'm having trouble correctly setting fonts in my graphs in GAUSS using only code. I want to avoid using the GUI for setting plot attributes, so that I can use the plotSave() function to export the image and then import it into the LaTeX document I want to include it in. I have set the text interpreter to "latex" so that the fonts in my figures can match the fonts in the body of the document. I'm wondering if anyone can help with the following issues:

  1. I cannot find a function that sets the font and especially the font size of the axes. I'm really trying to avoid having to use the GUI to edit this one little feature of my figures "by hand" every time they're redrawn.
  2. Using plotSetLegendFont() to set the legend font to "CMU Serif" (the default LaTeX font) appears to disable the legend altogether in the saved file. It also undesirably alters the location of the legend in the Graphics tab in GAUSS.

I have the font and plotSave() size set so high because I plan on printing these on a 600 dpi printer. It's the only way to get the PNG to have the "correct" font sizes while maintaining high resolution.

The current context is an an elementary Solow growth model simulation, in case anyone is wondering. You can find my code at this link.

3 Answers




The current implementation of LaTeX in GAUSS uses a fixed font for the math content (TeX), which would explain the rendering issues (unless 'CMU Serif' is a system font that can be found, the font won't be found). The font family also only applies to \{text} wrapped tags for LaTeX strings.

  1. On the 'plotSetXLabel' assignment, remove the last 2 arguments (setting the font family and font size) so it looks like this:
    plotSetXLabel(&kssPlot, "\\text{Time}x^2");

    If you are using the GUI and have the graph settings widget open, you can see the available fonts by double-clicking the font name of the appropriate graph section you'd like to modify. This will bring up the system list and you can try various fonts from here (only for text tags).

  2. To change all the axes font size, please add this snippet to your code:
    kssPlot.axesNumbers.fontSize = fontSize;
    kssPlot.axesLabel.fontSize = fontSize;
    kssPlot.legend.fontSize = fontSize;
    kssPlot.title.fontSize = fontSize;
  3. To ensure a thicker line for rendering at a higher resolution, you can also add this line:
    plotSetLineThickness(&kssPlot, 10);
  4. The plotSave command in GAUSS 17 supports supplying a dpi for the 4th argument. You can modify your plotSave command to look like the following so you don't have to guess the pixel dimensions:
    // Save the image as 11x8.5 inches at 600 dpi
    // You may also specify the dimension in centimeters by changing the 'in' to 'cm'.
    plotSave("../figures/figure1.png", 11|8.5, "in", 600);
  5. The behavior you're experiencing with the legend placement is being affected by the output size. We're looking to fix this behavior, but in the mean-time there is a work-around available:
    1. In the graphics page settings widget (View menu -> Graph Settings), click on the background so the graph is not selected. This will show the 'scene settings'
    2. Select the 'fixed size' checkbox and adjust the width up to ~6000 or so. The height will automatically adjust if 'fixed ratio' is checked. You can also specify the output size here in physical dimensions and dpi if you'd like. (DPI setting does not apply to pixels). We're looking to implement changing these settings as a GAUSS function in the near future to fix problems such as this.
    3. Ensure your graph is set to re-use the same window (though the default is to re-use the same window, but it can be verified in the Tools -> Preferences -> Graphics page):
      kssPlot.multWin = 0;
  6. Keep this tab open each time you re-run the gss file and your placement should be fixed. Setting the legend placement to "inside top left" might also yield more desirable behavior.

We do appreciate you notifying us about your experience using the graphics package and are working to improve this process.

If you'd like to follow up on this please send an e-mail to and the tech support team will provide further assistance.




This worked out pretty well, so thank you for your help! I hadn't thought to use the Data tab to examine the full structure of the plotControl structures (I'm really new to GAUSS).

Regarding the font name "CMU Serif," yes it is a font that I installed on my system independently. It's "Computer Modern," the same font that is used by default in most LaTeX document classes. As it isn't installed as a system font by TeXLive (the distribution I use), I had to download it separately. Any interested readers can find it at the font's SourceForge page.

There are only a few more nitpicks, and I don't think that you can actually help instantly the way you did for the major problems as they're probably deep within the machinery of GAUSS.

  1. The line width in the legend does not match the line width in the graph. I'm guessing that the procedures/functions that draw the legend do not refer to the lineThickness attribute of the given plotControl structure before drawing.
  2. The fontSize attribute for the various text objects in the plot has to be set to a much higher value than its print size. I'm guessing that the given font size in points is converted to pixels, but is not scaled along with the graph.
  3. Another anomaly regarding font sizes is that using the same font size for the axis numbers and the axis title results in different output sizes, with the numbers being larger than the titles. This is easy enough to fix, but may vex some users.
  4. This one is *really* nitpicky, but there doesn't seem to be any option for providing "padding" between graph objects, in the sense you may find in the CSS properties for a particular HTML element class. For instance, if you refer to the provided code and output (link to ZIP file below), you'll find that the vertical axis title, vertical axis number labels, and the vertical axis itself are bunched really closely together. Adding such a capability would go a long way from a graphic design standpoint.

Regardless of these little issue, I thank you very much for your assistance. It was very helpful!


For anybody curious as to how I'm applying this, you can look at the "solow" folder in the gauss-examples BitBucket repository I just created.

Your Answer

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 30 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy