我们如何在 iPython notebook 中使用 plantuml UML 工具?它应该对我们有帮助,因为在文书工作中经常使用 UML 图。
在从互联网上搜索了一些谷歌之后,我找到了一个在 iPython notebook 中使用渐近线的优秀参考,然后我为 iPython notebook 创建了一个 Plantuml 扩展。下面是详细步骤:
从我的工作目录启动 iPython notebook。例如:$HOME/workshop。
# cd $HOME/workshop
# ipython notebook --pylab inline
Run Code Online (Sandbox Code Playgroud)在 $HOME/workshop.eg:plantuml.py 创建扩展脚本
"""
An Plantuml extension for generating UML figures from within ipython notebook.
"""
import os
from IPython.core.magic import magics_class, cell_magic, Magics
from IPython.display import Image, SVG
@magics_class
class Plantuml(Magics):
@cell_magic
def plantuml(self, line, cell):
"""Generate and display a figure using Plantuml.
Usage:
%java -jar plantuml.jar -tsvg …Run Code Online (Sandbox Code Playgroud)我是pgf的新手所以我正在尝试pgfplot手册中的一些例子.一个例子与我当前的任务特别相关,但是,它不会编译.
这是代码:
\documentclass[11pt]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[symbolic x coords={a,b,c,d,e,f,g,h,i}]
\addplot+[smooth] coordinates {
(a,42)
(b,50)
(c,80)
(f,60)
(g,62)
(i,90)};
\end{axis}
\end{tikzpicture}
\end{document}
Run Code Online (Sandbox Code Playgroud)
编译器退出时出现以下错误:
! Package PGF Math Error: Could not parse input 'a' as a floating point number,
sorry. The unreadable part was near 'a'..
Run Code Online (Sandbox Code Playgroud)
我不知道如何纠正这种行为.其他图(平滑,散点图,条形图),只包含数值数据编译.
有人可以给我一个暗示吗?
干杯
K.
我被要求绘制一个像这样的图表

使用Latex(更确切地说,tikz和/或pgf).如果我有数据,这不会是一个问题,但我没有.我所拥有的只是可以显示图表的网站,但我不知道如何从那里获取数据.
我今天花了一天时间试图获取这些数据,包括写入Google并使用一种跟踪线条并推断图形点的软件,例如Datathief和DigitizeIt,但我没有成功.我认为后者不起作用,因为图中的线条太薄而且有多个蓝色阴影.当然,我尝试使用Paint和Gimp来提高图像质量,但我仍然无法使其工作.
我也尝试使用eps2pgf,这是一个将eps数字转换为pgf代码的Java脚本,但即使这对我使用Image Capture(mac)和Print Screen(Windows)保存的图表也不起作用,说实话,这将是我的最后一次选项,因为它是一种"暴力方法",吐出一个你无法真正改进的丑陋代码.
毕竟我决定开始学习Python,因为我的主管,那个让我用tikz绘制这张图片的人,说有一个Python代码可以从这样的网站获取数据.现在我甚至不确定Python是否会完成这项工作(虽然我很高兴有借口学习它)当然,学习一门新语言并做类似的事情需要时间,所以我想知道是否真的有从该网站获取数据的方法,最好使用Python,但如果没有,则使用任何其他方法.
我在制作ggplot2,tikzDevice和knitr时遇到了问题.我正在使用RStudio,并尝试在Latex文档中包含一些R图形.我用了一个非常简单的例子:
\documentclass{article}
\begin{document}
\begin{figure}
<<fig1,eval=TRUE,echo=FALSE,dev='tikz'>>=
library(ggplot2)
library(tikzDevice)
qplot(displ, hwy, data = mpg, colour = factor(cyl))
@
\end{figure}
\end{document}
Run Code Online (Sandbox Code Playgroud)
但是没有输出pdf,我收到以下错误消息:
Error in getMetricsFromLatex(TeXMetrics) :
TeX was unable to calculate metrics for the following string
or character:
hwy
Common reasons for failure include:
* The string contains a character which is special to LaTeX unless
escaped properly, such as % or $.
* The string makes use of LaTeX commands provided by a package and
the tikzDevice was not told to load …Run Code Online (Sandbox Code Playgroud) 当使用 pdflatex 时,-output-directory我在外部化 tikz 数字时遇到了问题。虽然 .md5 文件是在我期望的地方创建的,但创建外部化图片文件(.pdf、.log、.dpth)的命令失败。我的假设是发生这种情况是因为pdflatex创建这些文件不继承-output-directory选项,因此无法在正确的位置创建文件。
这是显示行为的最小示例。
main.tex:
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=tikz/]
\begin{document}
Test externalize in combination with -output-directory
\tikzsetnextfilename{testpicture}
\begin{tikzpicture}
\node {Node};
\end{tikzpicture}
\end{document}
Run Code Online (Sandbox Code Playgroud)
重击:
mkdir -p build/tikz
pdflatex -output-directory build -shell-escape main.tex
Run Code Online (Sandbox Code Playgroud)
错误:
===== 'mode=convert with system call': Invoking 'pdflatex
-shell-escape -halt-on-error -interaction=batchmode -jobname
"tikz/testpicture" "\def\tikzexternalrealjob{main}\input{main}"'
======== This is pdfTeX, Version 3.14159265-2.6-1.40.16
(TeX Live 2015/Debian) (preloaded format=pdflatex)
\write18 enabled.
entering extended mode
! I can't write on file `tikz/testpicture.log'.
Run Code Online (Sandbox Code Playgroud)
结果目录结构(输出tree …
我有一张tikz图片:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, shapes, shadows, arrows}
\begin{document}
\thispagestyle{empty}
\tikzstyle{abstract}=[circle, draw=black, fill=white]
\tikzstyle{labelnode}=[circle, draw=white, fill=white]
\tikzstyle{line} = [draw, -latex']
\begin{tikzpicture}[
every node/.style={line width=2mm, circle split, draw, minimum size=5cm}
]
\node (output) [thick, font=\fontsize{60}{60}\selectfont, thick] {$y_{(out)}$ \nodepart{lower} $y_{(in)}$};
\node (hidden) [thick, font=\fontsize{60}{60}\selectfont, below=1cm of output] {$h_{(out)}$ \nodepart{lower} $h_{(in)}$};
\node (input) [thick, font=\fontsize{60}{60}\selectfont, below=1cm of output, abstract, below=of hidden] {$x$};
\draw[line width=1mm, ->] (input) -- (hidden) node[font=\fontsize{60}{60}\selectfont, below=of output, labelnode, midway, right=2cm] {$W_1\, {\rm{, }} \,b_1$};
\draw[line width=1mm, ->] (hidden) -- (output) …Run Code Online (Sandbox Code Playgroud) 使用R tikzDevice(在R端)和LaTeX tikz包(在LaTeX端)将R图和R表快速导出到LaTeX有很多种方法.有关详细信息,请查看此博客文章.
是否存在类似于上述概念的自动化方法或JS库,但是将D3.JS中的完整可视化转换为原生的LaTeX TiKz图形.我需要将优秀的分辨率图表包含在LaTeX论文和报告中.
我知道有很多方法和JS代码可以将可视化导出为PNG,JPEG,PDF等...有没有简单的方法将D3.js导出到TikZ LaTeX?
谢谢你的任何建议.
我试图在狮身人面像中为矩阵添加一些颜色。我以前使用过hf-tikz。但是,当我将其添加到Sphinx时,它会错误地呈现它。
我想要得到的结果是
我得到的结果是
这是我的代码。
main.rst:
.. math::
\left(\begin{array}{cc}
\tikzmarkin[style red]{a}a\tikzmarkend{a}
& \tikzmarkin[style green]{b}b\tikzmarkend{b} \\
\tikzmarkin[style blue]{c}c\tikzmarkend{c}
& \tikzmarkin[style orange]{d}d\tikzmarkend{d} \\
\end{array}\right)
\star
\left(\begin{array}{cc}
\tikzmarkin[style red]{w}w\tikzmarkend{w}
& \tikzmarkin[style green]{x}x\tikzmarkend{x} \\
\tikzmarkin[style blue]{y}y\tikzmarkend{y}
& \tikzmarkin[style orange]{z}z\tikzmarkend{z} \\
\end{array}\right)
=
\left(\begin{array}{cc}
\tikzmarkin[hor=style red]{aw}{a\star w}\tikzmarkend{aw}
& \tikzmarkin[hor=style green]{bx}b\star x\tikzmarkend{bx} \\
\tikzmarkin[hor=style blue]{cy}c\star y\tikzmarkend{cy}
& \tikzmarkin[hor=style orange]{dz}d\star z\tikzmarkend{dz} \\
\end{array}\right)
Run Code Online (Sandbox Code Playgroud)
conf.py
extensions = [
'sphinx.ext.imgmath',
]
# Math configurations (https://tex.stackexchange.com/a/69770/51173)
imgmath_image_format = 'svg'
imgmath_use_preview = True
imgmath_latex_preamble = r'''
\usepackage{xcolor}
\usepackage[customcolors]{hf-tikz}
\colorlet{myred}{red!50!purple!30} …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用https://www.latex-tutorial.com/tutorials/figures/中显示的 subfigure 方法来制作并排图,但我似乎无法调整大小并使它们并排...我究竟做错了什么?下面是我正在使用的代码
\begin{figure}
\centering
\begin{subfigure}[b!]{0.3\textwidth}
\begin{tikzpicture}
\begin{axis}[
axis y line = middle,
axis x line = middle,
xlabel = $x$,
ylabel = {$f(x) = x^3$},
grid=major,
]
\addplot [
domain=-3:3,
samples=100,
color=red,
]
{x^3};
\addlegendentry{$x^3$}
%
\addplot [
domain=-3:3,
samples=100,
color=blue,
]
{x^3 + 3};
\addlegendentry{$x^3 + 3$}
%
\addplot [
domain=-3:3,
samples=100,
color=green,
]
{x^3 - 3};
\addlegendentry{$x^3 - 3$}
\end{axis}
\end{tikzpicture}
\end{subfigure}
%\hfill
\begin{subfigure}[b]{0.3\textwidth}
\begin{tikzpicture}
\begin{axis}[
axis y line = middle,
axis x line = …Run Code Online (Sandbox Code Playgroud) 我想提高我的乳胶论文的编译速度。我读过,只有当它们编译的 tikz 代码发生变化时,才使用 \tikzexternalize 。
问题是我无法正确使用 \tikzexternalize 。这是我的序言:
\usepackage{circuitikz}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, shadows, calc,positioning}
\tikzexternalize
Run Code Online (Sandbox Code Playgroud)
这根本不起作用。我收到下一个错误:
Undefined control sequence. \tikzexternalize
Run Code Online (Sandbox Code Playgroud)
如果有用的话,我也在 Ubuntu 下将 MikTex 与 TextStudio 一起使用,并将 TextLive 与 Textstudio 一起使用。它在任何这些系统中都不起作用。
希望你能帮我。