在 LaTeX 中生成简单的绘图
我想绘制几个简单的条形图以包含在 LaTeX 文档中。
由于某种原因(除非我遗漏了一些东西),似乎没有一种简单的方法可以在 LaTeX 中生成条形图。
我当然可以在 Excel 中生成它们并将它们另存为 PDF,但我宁愿在 LaTeX 中动态地灵活地生成它们。
我查看了 TikZ,但似乎互联网上没有人将它用于绘制简单的条形图(这正是我需要它的目的),下面的代码生成一个没有任何轴的条形图:
\begin{tikzpicture}[scale=2]
\draw[ycomb, color=gray,line width=0.5cm]
plot coordinates{(1,1) (2,2) (3,3)};
\end{tikzpicture}
你用什么?我做错了什么可怕的事情吗?
I want to draw a couple of simple bar plots to include in a LaTeX document.
For some reason (unless im missing something), there doesn't appear to be a simple way to generate bar plots in LaTeX.
I could of course generate them in Excel and save them as PDF, but I'd rather have the flexibility of doing them dynamically in LaTeX.
I looked into TikZ, but it seems nobody on the interwebs is using it for a measly barchart (which is what I need it for), and the code below generates a barplot without any axis:
\begin{tikzpicture}[scale=2]
\draw[ycomb, color=gray,line width=0.5cm]
plot coordinates{(1,1) (2,2) (3,3)};
\end{tikzpicture}
What do you use? Am I doing something horribly wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想说你想要
pgfplots
:这是建立在 Tikz 之上的作为一个合适的绘图界面。I'd say you want
pgfplots
: this is built on top of Tikz as a proper plot-drawing interface.我不知道你是否熟悉gnuplot,它可以生成条形图。 gnuplot 有一个 "TikZ 终端" (输出 TikZ 代码的东西),但是,据我所知,你必须自己编译它才能使其正常工作。
我认为还有另一个“LaTeX 终端”生成 pstricks(?)代码或类似的东西。
I do not know if you're familiar with gnuplot, that can generate bar plots. There is a "TikZ terminal" (something that outputs TikZ-code) for gnuplot, however, as far as i know, you have to compile it yourself in order to get it working.
I think there's also another "LaTeX terminal" generating pstricks (?) code or something similar.
我可以向您指出Asymptote (维基,图库) 。您可以通过 LaTex 处理离线制作具有专业外观的图表,但要了解 LaTeX。它是一种用于矢量图形和函数绘图的成熟的 C 语言。输出最终被封装为 postscript (eps),可以直接显示到 LaTeX 文档中。
Can I point you towards Asymptote (Wiki, Gallery). You can make professional looking graphs offline from LaTex processing, but being LaTeX aware. It is a full blown C-ish language for vector graphics and function graphing. The output eventually is encapsulated postscript (eps) which can be displayed directly into LaTeX documents.