Verified Commit 42cb32ad authored by Martin Isaksson's avatar Martin Isaksson
Browse files

Add pgfplots figure

parent 3e81e5c2
......@@ -19,6 +19,7 @@ pdf: $(PDF_OBJECTS)
clean:
-$(LATEXMK) -bibtex -C main
-make -C figures clean
dist-clean: clean
-rm $(FILENAME).tar.gz
......@@ -33,4 +34,14 @@ check: $(PDF_OBJECTS)
test -e $(FILE) ; \
)
rspec spec/pdf_spec.rb
\ No newline at end of file
rspec spec/pdf_spec.rb
figures:
$(DOCKER) $(DOCKER_COMMAND) $(DOCKER_MOUNT) $(DOCKER_IMAGE) \
make -C /data/figures
debug:
$(DOCKER) $(DOCKER_COMMAND) -it $(DOCKER_MOUNT) $(DOCKER_IMAGE) \
bash
.PHONY: figures
\ No newline at end of file
......@@ -2,7 +2,9 @@ See~\cite{DBLP:journals/cj/Knuth84}.
\begin{figure}
\centering
\includegraphics[width=.8\linewidth]{figures/example}
\begin{adjustbox}{width=.75\linewidth}%
\input{figures/example}%
\end{adjustbox}%
\caption{Example figure.}
\label{fig:duck}
\end{figure}
\ No newline at end of file
# This file runs code to make figures used in the report.
SOURCES=$(wildcard *.py)
TMPVAR := $(SOURCES)
SOURCES = $(filter-out utils.py, $(TMPVAR))
PDF_OBJECTS=$(SOURCES:.py=.tex)
BOUNDINGBOX=path
BBLOWERLEFT=(-1.2cm,-1.1cm)
BBUPPERRIGHT=(7.1cm, 3.6cm)
all: $(PDF_OBJECTS)
echo $(PDF_OBJECTS)
before_pgf:
pip install -r requirements.txt
%.tex: %.py before_pgf
python $<
sed -i -e '3i \\\$(BOUNDINGBOX) $(BBLOWERLEFT) rectangle $(BBUPPERRIGHT);' $@
clean:
-rm $(PDF_OBJECTS)
import matplotlib.pyplot as plt
import numpy as np
import tikzplotlib
import os
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
fig, ax = plt.subplots()
ax.plot(t, s)
ax.set(xlabel='Time [s]', ylabel='Voltage [mV]',
title='About as simple as it gets, folks')
plot_filename = os.path.basename(__file__).replace(".py",".tex")
tikzplotlib.save(plot_filename)
cycler==0.10.0
kiwisolver==1.2.0
matplotlib==3.2.1
numpy==1.18.4
Pillow==7.1.2
pyparsing==2.4.7
python-dateutil==2.8.1
six==1.14.0
tikzplotlib==0.9.1
\documentclass[10pt, a4paper]{article}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{pgfplots}
\pgfplotsset{compat=newest,
width=6cm,
height=3cm,
scale only axis=true,
max space between ticks=25pt,
try min ticks=5,
every axis/.style={
axis y line=left,
axis x line=bottom,
axis line style={thick,->,>=latex, shorten >=-.4cm}
},
every axis plot/.append style={thick},
tick style={black, thick}
}
\tikzset{
semithick/.style={line width=0.8pt},
}
\title{Gitlab CI pipeline for LaTeX}
\author{Martin Isaksson}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment