Code Monkey home page Code Monkey logo

juliaplots.sty's Introduction

juliaplots.sty

This package makes it easy to integrate Julia code and plots into latex documents. It sits on top of pythontex, 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. PyPlot.jl
  3. 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[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}

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: \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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.