Created
September 19, 2020 23:23
-
-
Save jmbr/ce7e0d4eed2c188343d3772375a07991 to your computer and use it in GitHub Desktop.
Gnuplot figure rendered in LaTeX with proper fonts and sizes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reset | |
load '~/gnuplot-colorbrewer/qualitative/Set2.plt' # Optional | |
set terminal push | |
set terminal epslatex size 3.22in, 2.255in | |
set output "fig-example.tex" | |
unset key | |
set border 3 | |
set xlabel '$x$' | |
set tics nomirror | |
set ytics 5 | |
set label 1 "$f(x)$" at 4.2, 3 | |
set label 2 '$\int_0^x \mathrm{d}\xi \, f(\xi)$' at 1.5, 7.5 | |
f(x) = (x - 1.0)**2 - x + 0.25 + sin(3.0 * x) + 5.0 * exp(-x) | |
F(x) = (x-1)**3 / 3.0 - x**2 / 2.0 + 0.25 * x + 1.0 / 3.0 - 1.0 / 3.0 * (cos(3.0 * x) - 1.0) - 5.0 * exp(-x) + 5.0 | |
set xrange [0:5] | |
set yrange [-2:15.5] | |
plot F(x) linestyle 1 linewidth 2, \ | |
f(x) linestyle 2 linewidth 2 | |
unset output | |
set terminal pop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[a4paper,12pt]{quantumarticle} | |
\pdfoutput=1 | |
\usepackage{lipsum} | |
\usepackage{graphicx} | |
\begin{document} | |
\title{Gnuplot example} | |
\author{Juan M. Bello-Rivas} | |
\maketitle | |
\section{Filler} | |
\lipsum[1-2] | |
\section{Test} | |
For comparison, I'm going to write two formulas. | |
This is one, $f(x)$, and this is the other, $\int_0^x \mathrm{d}\xi \, f(\xi)$. | |
Let's see how they look in Figure~\ref{fig:1}. | |
\begin{figure}[ht] | |
\centering | |
% \showthe\columnwidth | |
\input{fig-example} | |
\caption{This is a plot.} | |
\label{fig:1} | |
\end{figure} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment