• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

sisl/juliaplots.sty: A latex package for displaying plots made in Julia

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

sisl/juliaplots.sty

开源软件地址:

https://github.com/sisl/juliaplots.sty

开源编程语言:

TeX 100.0%

开源软件介绍:

juliaplots.sty

This package makes it easy to integrate Julia code and plots into latex documents. It sits on top of pythontex (version 0.17 or later), which comes bundled with TexLive and MikTeX. Python must be installed along with the other dependencies of pythontex (e.g., pygments).

To install this package, just download juliaplots.sty file and place it in the directory of your document.

The package currently supports the following Julia plotting packages:

  1. PGFPlots.jl
  2. PGFPlotsX.jl
  3. PyPlot.jl
  4. Gadfly.jl

Before using any of these packages, they must be installed and usable from Julia. In the case of Gadfly, you must also have Cairo.jl installed.

Only one plotting package is permitted. You specify the package you want as a package option to juliaplots. For example:

  • \usepackage[pgfplots]{juliaplots}
  • \usepackage[pgfplotsx]{juliaplots}
  • \usepackage[pyplot]{juliaplots}
  • \usepackage[gadfly]{juliaplots}

As with pythontex, you can run code using jlcode:

\begin{jlcode}
	x = [1,2,3]
	y = [2,4,1]
	plot(x, y)
\end{jlcode}

For PGFPlotsX, the equivalent code block is:

\begin{jlcode}
	x = [1,2,3]
	y = [2,4,1]

	p = @pgf TikzPicture(
            Axis(
                PlotInc({ no_marks },
                    Table(; x = x, y = y))))
	plot(p)
\end{jlcode}

You can run and typeset code using jlblock

\begin{jlblock}
	x = [1,2,3]
	y = [2,4,1]
	plot(x, y)
\end{jlblock}

You can run a command with, for example, \jlc{x=2}. You can typeset code without running it with \jlv{x=2}. You can run a command and typeset it using \jlb{x=2}.

The functionality that is added by juliaplots.jl is the \plot command, which will generate the plot and inject it into the document. The number of arguments depends on which plotting package you are using. Here are examples:

  • PGFPlots and PGFPlotsX: \plot{myfile}, where the sole argument is the name of the file (do not include the file extension) that will be used in the background for including the plot.
  • PyPlot: \plot{myfile}{width=3in}, where the first argument is the name of the PDF file (without file extension) to store the image, and the second argument are the options to be passed to \includegraphics when the PDF is included.
  • Gadfly: \plot{myfile}{3inch}{3inch}{width=3in}, where the first argument is the name of the PDF file (without file extension) to store the image, the second is the width of the image to be exported by Gadfly, the third is the height of the image to be exported by Gadfly, and the fourth argument contains the options to be passed to \includegraphics when the PDF is included.

To create your document, run lualatex mytexfile.tex (or similar command), then pythontex mytexfile.tex, and then lualatex mytexfile.tex. If you have trouble with the generation of your plot, see the error output from pythontex.

This repository contains example tex files and their associated PDF files.

Future work

In the future, we would like to support Plots.jl.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap