Gnuplot - how to get colored text in a shortcut with epslatex terminal

I have a complex figure made with the epslatex terminal in gnuplot. This is a four-panel multiplier. On each panel, I draw three curves (for three different parameter values), and then overlay another curve for another parameter on top of each curve. I can distinguish the first parameter with different types of points, and the second with color.

So, I use a key to distinguish between different points, and I will need to have another key for two colors. Then I use a shortcut with colored text. The fact is that the text is not painted in the terminal epslatex!

I have

install epslatex color solid 8 terminal

and

set label 10 'H' tc lt 1 at 0.01.6

Thus, I get the label "H" in black. If i use

install epslatex color colortext solid 8 terminal

he gives me an error

Package color is not loaded in conjunction with the colourtext option of the terminal.

Any idea what the problem is?

+4
source share
2 answers

You can use the \texcolor provided by the color package. If you use standalone mode color , the package is automatically downloaded with the color option to the terminal, otherwise you must explicitly load the color (or xcolor ) xcolor into your LaTeX document.

A vivid example:

 set terminal epslatex color solid 8 standalone set output "foo.tex" set format x '$\textcolor{green}{%g}$' set format y '$\textcolor{yellow}{%g}$' set label 10 '\textcolor{blue}{H}' at 0.01,6 plot x**3 title '$\textcolor{magenta}{x}^{\textcolor{cyan}{3}}$' set output 

Result:

enter image description here

+5
source

Using the colortext parameter works, but as the error message says, you must include the color package in your document. If you use the standalone parameter, this is done automatically. So, the following works just fine:

 set terminal epslatex color colortext standalone set output 'foo.tex' set label 'lt 1' tc lt 1 at graph 0.2,0.5 set label 'blue' tc rgb 'blue' at graph 0.7,0.5 plot x 

There is no need to use the \textcolor macro explicitly if you do not want different colors to be in the same label.

+3
source

Source: https://habr.com/ru/post/1490897/


All Articles