1

I am plotting a multi-curve graph by using pst-plot, and naturally need different color to label each curve in legend, by using \pslegend command. However, I find I can only use a number of pre-defined color commands

\red \blue \black \green \cyan \yellow \gray % ...may be more

When I looked into the pstricks package documentation and tried to define my own color command

\newrgbcolor{myorg}{255 165 0} % trying to define a orange color command

however, it does not work, here is an MWE (compile by using xelatex, Windows 64-bit, TeX Live 2015)

% !TEX program = xelatex
\documentclass[border = 1.2cm]{standalone}

\usepackage{pstricks-add}
\newrgbcolor{myorg}{255 165 0}

\begin{document}

\pslegend[rt]{ \myorg\rule[1ex]{2em}{1pt} & Line 1) }
\begin{psgraph}(0,0)(5,5){10cm}{8cm}
\end{psgraph}

\end{document}

enter image description here The color is exactly like using \yellow.

How can I define a color command properly (for the use of \pslegend in pst-plot), and where am I able to look up all the pre-defined color commands in pstricks (can't find a list of color commands in both pstricks and pst-plot package documents)?

1

pstricks loads the xcolor package. If you want a broader choice, pass the option, say, x11names to xcolor (via \documentclass). This option gives access to nearly 320 predefined colours. See § 4, Colors by Names, pp38–40 of the documentation. You also can use the option svgnames which more or less the same as HTML colour names.

Example:

\documentclass[x11names, border = 1.2cm]{standalone}

\usepackage{pstricks-add}

\begin{document}

\pslegend[rt]{ \color{SeaGreen3}\rule[0.5ex]{2em}{1pt} & Line 1) }
\begin{psgraph}(0,0)(5,5){10cm}{8cm}
\end{psgraph}

\end{document} 

enter image description here

  • Thanks for your suggestion. I have tried in this direction in different ways after seeing that, but still not make it work. Could you please give a working example that shows how the method works, specifically for \pslegend in a plot with pst-plot. Let us say I want an orange color, or purple, for my curve color in legend box – Spaceship Apr 17 '16 at 16:30
  • @Spaceship: I've added an example (sorry for the colour, but you can change that easily). – Bernard Apr 17 '16 at 16:56
  • The \color command works perfectly, and solve the problem. Big help of you, Cheers! – Spaceship Apr 17 '16 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.