Generate EPS plot with appropriate font size and line width in GNU Octave

Source: Internet
Author: User

Because EPS terminal is different from the one to screen display, the font size and line width should all be adjusted as The following example:

CList = Gencolorlist ();

h = 1;

Figure (h);

CLF (h); # This is mandatory.

# # Set the axis position. Sometimes, the Y axis title may is outside the picture, therefore, the whole aixs should is shifted a little to the right.

Set (GCA, "position", [0.16000 0.11000 0.77500 0.81500]);

# # Set The font size of the axis labels:the default font is too small for EPS output

FontSize = 20;

# # Set The linewidth of the axis

Set (GCA, "FontSize", FontSize, "LineWidth", 1);

Hold on;

# # line width set to 3, the default value is too small.

Plot (T, mu_f_5k_a, "Color", clist (1,:), "LineStyle", "-", "LineWidth", 3, "marker", "O");

# # Print to the EPS file with the font size set to 24. This font size used for EPS output control.

Print (H, strcat (F, ". EPs"), "-DEPSC2", "-f:24");

# # Convert EPS to PNG using Ghostscript. Actually, this can is simplified by calling the script Eps2png

System (["Gs-dnosafer-r300-dbatch-sdevice=png16m-dnopause-depscrop-soutputfile=\" ", F,". png\ "\" ", F,". Eps\ ""]);

For the new Octave version on Linux, such as v3.6.2, and the situation is different.

The default font adopted by GNU Octave are {}, which is so strange. Then if a figure file was printed using the print function, the program would complain that it cannot find or op En the font file. Therefore, the following should is added before any plotting. Note that the font "Arial" was not supported on Mydebian Wheezy, but "Helvetica" is.

Set (0, "Defaultaxesfontname", "Helvetica");

Set (0, "Defaultaxesfontsize", 12);

Set (0, "Defaulttextfontname", "Helvetica");

Set (0, "Defaulttextfontsize", 12);

In addition, Octave would complain this it cannot find the binary file for epstool and Fig2dev. The former can installed directly from Apt-get and while the latter are contained in the transfig package.

Meanwhile, this version of Octave was different from traditional one for figure plotting. For example, in order to produce figures with appropriate axis and label text font sizes, previously we had to set the FO NT size to being larger than PT and enforce the font size to be is when the calling the print function, i.e.-f:24. But now, such internal bugs have been removed, we do not need to specify the font size any more.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.