4

is there any possibility to change the options (for example color) of a printed node? I create a lot of nodes with multido and want to change their appearance. Is there any way to do it after it got printed?

Background: I want to plan biological experiments and color the circles (corresponding to a sample) in a different color like this:

MWE:

% !TeX encoding = UTF-8
% !TeX program = xelatex
\documentclass{scrartcl}
\usepackage{pstricks,pst-node,multido,fp}
\begin{document}
\FPset{\AnzahlX}{6}
\FPset{\AnzahlY}{4}
\FPset{\AbstandX}{1.57}
\FPset{\AbstandY}{1.47}
\FPset{\Abstand}{1.88}
\FPset{\Durchmesser}{1.5}
\FPdiv\Radius\Durchmesser{2}
\begin{pspicture}(0.7,-0.7)(12.9,-8.7)%
    %Rahmen
    \pspolygon(0,0)(12.8,0)(12.8,-8.2)(12.4,-8.6)(0,-8.6)%
    %
    %Beschriftung
    \multido{\nX=\AbstandX+\Abstand,\iN=1+1}{\AnzahlX}{\rput(\nX,0.5){\iN}}%
    \multido{\nY=-\AbstandY+-\Abstand,\iC=65+1}{\AnzahlY}{\rput(-0.5,\nY){\char\iC}}%
    %
    %Wellplates
    \multido{\nY=-\AbstandY+-\Abstand,\iX=1+1}{\AnzahlY}{\multido{\nX=\AbstandX+\Abstand,\iY=1+1}{\AnzahlX}{\Cnode[radius=\Radius](\nX,\nY){\iX\iY}}}%
\end{pspicture}
Now I want to change color from red to light red for Well A1 to A5
\end{document}

  • Why do you want to change it afterwards? Wouldn't it be more efficient (and possible) to do it while creating the circles? – TeXnician Aug 24 '17 at 18:13
  • Werner gave me a good idea. This works, but is somewhat a lot defining. In my mind was something like \mycommand{Row1}{StartColor}{EndColor}, as I want to set different colors to different rows. – Niklas Aug 24 '17 at 21:30
1

Use the node names for the coordinates and define a color series with 6 steps:

\documentclass{scrartcl}
\usepackage{pst-node,multido}
\begin{document}
\def\AnzahlX{6}
\def\AnzahlY{4}
\def\AbstandX{1.57}
\def\AbstandY{1.47}
\def\Abstand{1.88}
\def\Durchmesser{1.5}
\pstFPdiv\Radius\Durchmesser{2}

\definecolorseries{foo}{rgb}{last}{red}{red!30!white}
\resetcolorseries[6]{foo}

\begin{pspicture}(0.7,-0.7)(12.9,-8.7)%
%Rahmen
\pspolygon(0,0)(12.8,0)(12.8,-8.2)(12.4,-8.6)(0,-8.6)%
%
%Beschriftung
\multido{\nX=\AbstandX+\Abstand,\iN=1+1}{\AnzahlX}{\rput(\nX,0.5){\iN}}%
\multido{\nY=-\AbstandY+-\Abstand,\iC=65+1}{\AnzahlY}{\rput(-0.5,\nY){\char\iC}}%
    %
%Wellplates
\multido{\nY=-\AbstandY+-\Abstand,\iX=1+1}{\AnzahlY}{%
    \multido{\nX=\AbstandX+\Abstand,\iY=1+1}{\AnzahlX}{%
        \Cnode[radius=\Radius](\nX,\nY){N\iX\iY}}}%
%Now I want to change color from red to light red for Well A1 to A5
\multido{\iA=1+1}{\AnzahlX}{%
    \pscircle[fillstyle=solid,fillcolor=foo!!+](N1\iA){\Radius}}
\end{pspicture}

\end{document}

enter image description here

  • Thanks Herbert, this is something i can use to do a easy command for adding color to the wells. – Niklas Aug 25 '17 at 11:54
  • Is there a command like \stepcolorseries that does just step through the colorseries? – Niklas Aug 27 '17 at 12:50
  • As far as I know yes, but you have to read the documentation. – user2478 Aug 30 '17 at 19:20
3

Specific to your example of changing the colours for A1 through A6 in a sequential manner, you can add options like for filling the nodes with a specific colour. Below I've added fillstyle=solid to ensure that the first row is filled and fillcolor=red!<C>!lightred be the fill colour; <C> measures the share of colour between red and lightred (defined as a mixture of red and white) which decreases from 100% red to (almost) 100% lightred in the last circle.

enter image description here

\documentclass{article}

\usepackage{pst-node,multido,fp}

\begin{document}

\FPset{\AnzahlX}{6}
\FPset{\AnzahlY}{4}
\FPset{\AbstandX}{1.57}
\FPset{\AbstandY}{1.47}
\FPset{\Abstand}{1.88}
\FPset{\Durchmesser}{1.5}
\FPdiv\Radius\Durchmesser{2}

\colorlet{lightred}{red!30!white}

\begin{pspicture}(0.7,-0.7)(12.9,-8.7)%
  %Rahmen
  \pspolygon(0,0)(12.8,0)(12.8,-8.2)(12.4,-8.6)(0,-8.6)%
  %Beschriftung
  \multido{\nX=\AbstandX+\Abstand,\iN=1+1}{\AnzahlX}{\rput(\nX,0.5){\iN}}%
  \multido{\nY=-\AbstandY+-\Abstand,\iC=65+1}{\AnzahlY}{\rput(-0.5,\nY){\char\iC}}%
  %Wellplates
  \multido{\nY=-\AbstandY+-\Abstand,\iX=1+1}{\AnzahlY}
    {\multido{\nX=\AbstandX+\Abstand,\iY=1+1,\iC=100+-16}{\AnzahlX}
      {\ifnum\iX=1
         \Cnode[radius=\Radius,fillstyle=solid,fillcolor=red!\iC!lightred](\nX,\nY){\iX\iY}
       \else
         \Cnode[radius=\Radius](\nX,\nY){\iX\iY}
       \fi
      }
    }%
\end{pspicture}

Now I want to change color from red to light red for Well A1 to A6

\end{document}

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.