代码改变世界

TeX系列: tikz-3dplot绘图宏包

2016-06-15 21:01  GarfieldEr007  阅读(2759)  评论(0编辑  收藏  举报

 tikz-3dplot包提供了针对TikZ的命令和坐标变换样式, 能够相对直接地绘制三维坐标系统和简单三维图形. tikz-3dplot包当前处于初创期, 有很多功能有待完善.

安装过程如下:

(1) 下载宏包tikz-3dplot.sty

http://www.ctan.org/tex-archive/graphics/pgf/contrib/tikz-3dplot/

(2) 把上述文件拷贝至TeX的目录树上, 比如D:\texmf\tex\latex\tikz-3dplot, 在DOS命令窗口执行

  texhash

重建TeX目录树

 

尝试编译如下例子:

[python] view plain copy
 
  1. \documentclass{article}  
  2. \usepackage{tikz}           %for TikZ graphics  
  3. \usepackage{tikz-3dplot} %for 3dplot functionality  
  4. \usepackage[active,tightpage]{preview}      %generates a tightly fitting border around the work  
  5. \PreviewEnvironment{tikzpicture}  
  6. \setlength\PreviewBorder{2mm}  
  7. \begin{document}  
  8. \tdplotsetmaincoords{70}{135}  
  9. \begin{tikzpicture}[line join=bevel,tdplot_main_coords, fill opacity=.7]  
  10. \tdplotsphericalsurfaceplot[parametricfill]{72}{36}%  
  11. {sqrt(15/2)*sin(\tdplottheta)*cos(\tdplottheta)}{black}{\tdplotphi}%  
  12.     {\draw[color=black,thick,->] (0,0,0) -- (2,0,0) node[anchor=north east]{$x$};}%  
  13.     {\draw[color=black,thick,->] (0,0,0) -- (0,2,0) node[anchor=north west]{$y$};}%  
  14.     {\draw[color=black,thick,->] (0,0,0) -- (0,0,2) node[anchor=south]{$z$};}%  
  15. \end{tikzpicture}  
  16. \end{document}  


结果如下:

 

 

tikz-3dplot官方网站: http://tikz3dplot.wordpress.com/

 

from: http://blog.csdn.net/mathsoperator/article/details/6825010