Gnuplot and LaTeX tricks

A thing to share – so that you don’t waste your precious time looking for a solution, like I just did.

I wanted to plot the inner (hatched) part of a circle in gnuplot and kept looking for a solution, until i worked out this:

gnuplot> set terminal png font "/usr/share/fonts/dejavu/DejaVuSans.ttf" 9
gnuplot> set output 'a_circle.png'
gnuplot> plot [t=0:2*pi] sin(t)-1,cos(t) lc rgb "gold" with filledcurves title "A circle"

Yeah, I know it’s simple. But I had to google for over 10 mins to get to the “filledcurves” option. I copy&pasted this code from a project I’m working on, so the output is redirected to a png file. Hope you don’t mind.

As for Latex: Beware of FIGURES! I only noticed it by accident. If you insert a figure like that:

\begin{figure}
 \centering
 \label{fig:MyFigure}
 \includegraphics[width=0.8\textwidth]{fig/myFigure.png}\\
 \caption{SomeDescription}
\end{figure}

the numbering/referencing won’t work properly. Be sure to insert the \label{} part as the last thing in the figure environment or you’ll get strange results when referencing to that figure.

That’s it for now ;) Hope it’ll help.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.