TikZ in R Markdown

岁酱吖の 提交于 2019-11-30 04:02:34
jmjr

In this post it is described how to use LaTeX packages in R Markdown. Not sure if the tikz-package works with R Markdown though.

This is a example about how to use tikz graph in R Markdown within R Studio

---
title: "Hello World"
author: "Me"
date: "February 17, 2015"
output:
  pdf_document: default
header-includes: 
  - \usepackage{tikz}
  - \usepackage{pgfplots}
---

## TikZ picture
- Here is a TikZ picutre

\begin{tikzpicture}
\draw (0,0) circle (2cm);
\end{tikzpicture}

- Here is another TikZ picutre

\begin{tikzpicture}
\begin{axis}[xmax=9,ymax=9, samples=50]
  \addplot[blue, ultra thick] (x,x*x);
  \addplot[red,  ultra thick] (x*x,x);
\end{axis}
\end{tikzpicture}

Output:

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!