Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • exporting a graph into eps format and get "fontface" codes in the eps file

    Happy new year!

    I want to export the graph into "eps" format so I can then transform it into a TIF format file with great resolution but also a small file size using Photoshop. (Learned this online...please kindly inform me of other options to get a clearer TIF graph file if you know some, thanks!)

    Here is my problem...

    I use the option:
    Code:
    xtitle("{stSerif:Temperature ({&degree}C)}")
    in the twoway command to get my title of the x-axis a little bit fancy. But when I export the graph into EPS format, I noticed that something went wrong with my title. Here is a screenshot...

    Click image for larger version

Name:	January 4, 2023 at 11:38:43.png
Views:	1
Size:	37.6 KB
ID:	1695840


    Here is the toy code so you can replicate this problem...

    Code:
    version 17.0
    clear
    input x y
    1 2
    2 4
    3 6.5
    4 7.5
    5 10
    6 13
    end
    
    tw scatter x y, xtitle("{stSerif:Temperature ({&degree}C)}")
    graph export "g1.eps", as(eps) replace
    By the way, I am working on Apple M1 Pro Ventura 13.0.1 and opening the EPS file exported using an APP called "Skim".

    Thanks!
    Attached Files

  • #2
    You should specify the font when exporting.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(x y)
    1   2
    2   4
    3 6.5
    4 7.5
    5  10
    6  13
    end
    
    tw scatter x y, xtitle("Temperature ({&degree}C)")
    graph export "g1.eps", as(eps) replace fontfaceserif("Times")
    See

    Code:
    help eps options

    Comment


    • #3
      Thanks, Musau! It works!

      By the way, I have to change the code into:
      Code:
      tw scatter x y, xtitle("Temperature ({c 176}C)")
      graph export "g1.eps", as(eps) replace fontfaceserif("Times")
      to get the "degree" mark display properly in the eps file. If I use
      Code:
      , xtitle("Temperature ({&degree}C)")
      instead, I got a "gamma" mark in the eps file for some reason...

      Comment

      Working...
      X