Skip to content

Commit

Permalink
GMT中文示例加上中文LABEL
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Jul 17, 2017
1 parent fe7fd84 commit 7561442
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
24 changes: 13 additions & 11 deletions source/install/cn-linux.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,25 +185,27 @@ Linux 的中文字体较少,所以这里使用 Windows 下中的中文字体
GMT 中文测试
++++++++++++

GMT5 测试脚本:
测试脚本:

.. code-block:: bash
#!/bin/bash
gmt gmtset FONT_TITLE 40p,35,black
gmt pstext -R0/10/0/3 -JX15c/3c -Bafg -B+t"GMT中文支持" -F+a+c+f -P > gmt5_cn.ps << EOF
3 2.1 0 LM 35p,35,red GMT宋体
3 0.9 0 LM 35p,36,blue GMT仿宋
7 2.1 0 LM 35p,37,black GMT黑体
7 0.9 0 LM 35p,38,green GMT楷体
gmt set FONT_TITLE 30p,35,black
gmt set FONT_LABEL 15p,35,black
gmt pstext -R0/10/0/4 -JX15c/5c -Bxafg+l"X轴" -Byafg+l"Y轴" \
-BWSen+t"中文标题" -F+f -P > cn.ps << EOF
3 2.5 35p,35,black GMT宋体
3 1.0 35p,36,blue GMT仿宋
7 2.5 35p,37,yellow GMT黑体
7 1.0 35p,38,green GMT楷体
EOF
rm gmt.*
rm gmt.history gmt.conf
成图效果如下
成图效果如下
.. figure:: /static_images/GMT_chinese_linux.png
.. figure:: /static_images/GMT_chinese.png
:width: 400px
:align: center
Expand Down
20 changes: 13 additions & 7 deletions source/install/cn-windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,22 @@ GMT 的中文支持

.. code-block:: bash
gmt gmtset FONT_TITLE 40p,35,black
gmt set FONT_TITLE 30p,35,black
gmt set FONT_LABEL 15p,35,black
echo 3.5 5 0 LM 45p,35,red GMT 宋体 > tmp
echo 3.5 4 0 LM 45p,36,blue GMT 仿宋 >> tmp
echo 3.5 3 0 LM 45p,37,yellow GMT 黑体 >> tmp
echo 3.5 2 0 LM 45p,38,green GMT 楷体 >> tmp
echo 3 2.5 35p,35,black GMT宋体 > tmp
echo 3 1.0 35p,36,blue GMT仿宋 >> tmp
echo 7 2.5 35p,37,yellow GMT黑体 >> tmp
echo 7 1.0 35p,38,green GMT楷体 >> tmp
gmt pstext tmp -R0/7/0/7 -JX6i/6i -Bafg -B+t"GMT 中文" -F+a+c+f -P > cn.ps
gmt pstext tmp -R0/10/0/4 -JX15c/5c -Bxafg+l"X轴" -Byafg+l"Y轴" \
-BWSen+t"中文标题" -F+f -P > cn.ps
若生成的 PS 文件正常显示汉字,则表示 GMT 已经可以支持中文。
成图效果如下:

.. figure:: /static_images/GMT_chinese.png
:width: 400px
:align: center

需要注意,若使用记事本编辑 bat 文件,则保存时应注意编码方式为 ANSI、Unicode 或
Unicode big endian,若使用 UTF-8 编码则会出现乱码;另外,很多编辑器默认将文本
Expand Down
Binary file added source/static_images/GMT_chinese.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed source/static_images/GMT_chinese_linux.png
Binary file not shown.

0 comments on commit 7561442

Please sign in to comment.