gnuplot 加中文

10 篇文章 0 订阅
7 篇文章 0 订阅
解决了gnuplot下使用中文字符的问题,在Ubuntu 7.04环境下介绍一下方法:
使用gnuplot-4.2,如果不是这个版本,到http://www.gnuplot.info下载最新版,编译运行。

代码:
  $gnuplot
  gnuplot> set term png font "/usr/share/fonts/truetype/chinese/simsun.ttc,12"
  Terminal type set to 'png'
  Options are 'nocrop font /usr/share/fonts/truetype/chinese/simsun.ttc 12 xffffff x000000 xa0a0a0 xff0000 x00c000 x0080ff xc000ff x00eeee xc04000 xeeee00 x2020c0 xffc020 x008040 xa080ff x804000 xff80ff x00c060 x00c0c0 x006080 xc06080 x008000 x40ff80 x306080 x806000 x404040 x408000 x000080 x806010 x806060 x806080 x0000c0 x0000ff x006000 xe3b0c0 x40c080 x60a0c0 x60c000 x60c0a0 x800000 x800080 x602080 x606060 x202020 x204040 x204080 x608020 x608060 x608080 x808040 x208020 x808080 xa0a0a0 xa0d0e0 xc02020 x008080 xc06000 x80c0e0 xc060c0 xc08000 xc08060 xff4000 xff4040 x80c0ff xff8060 xff8080 xc0a000 xc0c0c0 xc0ffc0 xff0000 xff00ff xff80a0 xc0c0a0 xff6060 x00ff00 xff8000 xffa000 x80e0e0 xa0e0e0 xa0ff20 xc00000 xc000c0 xa02020 xa020ff x802000 x802020 x804020 x804080 x8060c0 x8060ff x808000 xc0c000 xff8040 xffa040 xffa060 xffa070 xffc0c0 xffff00 xffff80 xffffc0 '
   gnuplot> set title "中文标题"
   gnuplot> set output "chstitle.png"
   gnuplot> plot sin(x)


打开chstitle.png,就可以看到中文了!
/usr/share/fonts/truetype/chinese/是我Ubuntu上保存Windows XP(TM)字体的文件夹.另有2个环境变GDFONTPATH和GNUPLOT_DEFAULT_FONT可以设置,可以简化字体设置.

代码:
$export GDFONTPATH=/usr/share/fonts/truetype/chinese/


如果需要永久设置GDFONTPATH,可以修改/etc/profile,环境变量保存于此文件中.

代码:
$sudo gedit /etc/profile


在文件尾部添加一行

代码:
GDFONTPATH=/usr/share/fonts/truetype/chinese/


测试一下:

代码:
   1. $gnuplot
   2. gnuplot> set term png font "simsun.ttc,12"
   3. Terminal type set to 'png'
   4. Options are 'nocrop font simsun.ttc 12 '
   5. gnuplot> set title "中文标题"
   6. gnuplot> set output "defaultfont_chstitle.png"
   7. gnuplot> plot sin(x)


GNUPLOT_DEFAULT_FONT我没有测试成功,但理论上是可以设置默认字体的。如果你成功了,请告诉我
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值