Announcement

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

  • problem of mixed fontface for graph

    Hello. When I generate a graph, I want all numbers and english characters in the fontfact of "times new roman", and all Chinese characters in "SimSun". I set the "times new roman" as the default fontface of graph. In Stata 14, when I export a graph, Chinese Characters which is not applicable for "times new roman" will be by default in the fontface of "SimSun" (as attached bar graph in figure 1). But in Stata 16, when I export the graph, Chinese Characters will neither in the fontface of "times new roman" nor "SimSun", but in a fontface which is default for characters which is not applicable for the user defined fonface (as figure 2). Though I can define fontface for each Chinese character in the graph program, it's truely complicated (as example code). And I also has to define the fontface of the labels of group variable through relabeling, which is supposed to be in mixed fontface of both "times new roman" and "SimSun"(as figure 3). But it obviously cannot be achieved through relabeling. I am wondering is there any easier way to achieve my purpose in Stata 16, like modifying default fontface of Chinese chracters?

    Code:
    graph bar (asis) 种粮比例, over(规模组,sort(排序) relabel(3 "{fontface 宋体:200-500亩}" ///
                                                              2 "{fontface 宋体:500-1000亩}" 1 "{fontface 宋体:1000亩以上}" ///
                                                              ) label(labsize(5.5) angle(20))) ///
          ytitle("{fontface 宋体:粮}" "{fontface 宋体:食}" "{fontface 宋体:种}" "植" "比" "例" "" "%" "", size(5.5) orientation(horizontal)) ///
          ylabel(,labsize(5.5)) ///
          bargap(20) ///
          blabel(total, size(4.5) format(%9.1f)) ///
          bar(1, fcolor(gs12) lcolor(black) lwidth(0.2) lpattern(solid)) ///
          xsize(12.42) ysize(5.11) ///
          scheme(s1color)
    Click image for larger version

Name:	1.png
Views:	3
Size:	60.3 KB
ID:	1539768

    Click image for larger version

Name:	1test.png
Views:	1
Size:	57.8 KB
ID:	1539766

    Click image for larger version

Name:	1test1.png
Views:	1
Size:	61.7 KB
ID:	1539767
    Attached Files

  • #2
    我也遇到了这个问题,我认为通过设置4类默认字体中的一种为宋体,然后在代码中应用默认字体就可以,比你所 展示的要简便一些,代码如下:

    I also encountered this problem. I think that by setting one of the four default fonts to SimSun, and then applying the default font in the code, it is easier than what you showed. The code is as follows:
    Code:
    preserve
    sysuse auto, clear
    graph set window fontface "Times New Roman" 
    graph set window fontfacesans "宋体"
    scatter mpg weight,title("{stSans:宋体字体}")
    restore
    你可以尝试一下,根据一个早前的回答http://www.stata.com/statalist/archi.../msg00410.html,我估计从普通的途径解决的可能性比较小了,希望维护者可以注意到这个问题!请求将中文默认字体设置为宋体 或者提供多语言字体设置的功能,谢谢!

    You can try it, according to an earlier answer (https://www.stata.com/statalist/arch.../msg00410.html), I guess it is less likely to be solved by ordinary methods, hope the maintainer can notice this problem! Request to set Chinese default font to SimSun or provide multi-language font setting function, thank you!

    Comment


    • #3
      Here is the output pictrue, it's more acceptable.
      Attached Files

      Comment

      Working...
      X