Incanter 绘图与 Web 图表创建指南
1. Incanter 图表添加公式
在 Incanter 中,以往给图表添加标题和轴标签时,使用的都是普通无格式文本。有时,我们可能希望使用公式。Incanter 允许使用 LaTeX 的数学符号向图表添加公式。
操作步骤 :
1. 准备工作 :在 project.clj
文件中使用与创建散点图时相同的依赖项。在脚本或 REPL 中使用以下导入:
(require '[incanter.core :as i]
'[incanter.charts :as c]
'[incanter.latex :as latex])
同时使用之前创建函数图时的图表,将其保存在 f-plot
变量中。
2. 添加公式 :
- 绑定 LaTeX 字符串到 inv-log
:
(def inv-log "f(x)=\\frac{1.0}{\\log x}")
- 使用 `incanter.latex/add-latex-subtitle` 函数将公式添加到图表: