9

inspired by the following graphic, I tried to copy it with tikz. I'd like to modify it in some details: enter image description here

  1. The rim of the coloured background should be homogeneous.
  2. I don't want the bonds between the amino acids, I prefer them to be seperated

Here is my first try:

\documentclass{standalone}%
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri}
\usepackage{chemfig,xstring}
\begin{document}
\setatomsep{2.5em}
\setcrambond{2pt}{}{}
\begin{tikzpicture}[
 point/.style={circle,draw=none,minimum size=#1},
 point/.default=0pt % default Wert für minimum size bei point]
 \foreach \anfang/\ende/\farbe in { 25/100/green!60,104/170/orange!60,174 /254/red!60, 258/314/yellow!60, 318/381/blue!60}
\draw[fill=\farbe,draw=none] (0,0) -- (\anfang:12cm) arc (\anfang:\ende:12cm);
\draw[fill=white,draw=none] (0,0) circle (6cm);

% mit count=\i werden die Kreise nummeriert
% der zugehörige Winkel wird mit evaluate aus dieser Nummer berechnet
% insgesamt werden (bis zu) 20 Kreise auf 360 Grad gleichmäßig verteilt
\foreach[count=\i,evaluate=\i as \angle using (\i-1)*360/20] \text in {%
  1,2,3,4,\begin{tiny}\schemestart \chemnameinit{}\chemname{\chemfig{C(=[3]O)(-[1]OH)(-[6]CH_2(-[6]CH(-[5]NH_2)(-[7]C(=[6]O)(-[1]OH))))}}{Asparaginsäure\\Asp\\D} \schemestop\end{tiny},\begin{tiny}\schemestart \chemnameinit{} \chemname{\chemfig{CH(-[3]NH_2)(-[1]C(=[2]OH)(-[7]OH))(-[6]CH_2(-[6]C(=[5]O)(-[7]NH_2)))}}{Asparagin\\Asn\\N}\schemestop\end{tiny},7,8,9,10,11,12,13,14,15,16,17,18,19,20% Beschriftung der Kreise
}
\node[point=2.2em] (node\i) at (\angle:9) {\text};
\end{tikzpicture}
\end{document}

I wrote the structure of the amino acids in an other TeX file and usually use the \input command. For the MWE two amino acids should be enough.

How can I rotate the nodes/amino acids so that they point to the center of the inner circle?

Any alternative solution is welcome, too.

I'm very sorry but I can't comment my own Question so I add the Information here.

@Alenanno thank you very much for your very helpful answer.

I don't want the same graphic. I actually like what I've got so far: all sturctural formulas in the coloured circle with nearly the same distance to the center.

Next step will be the outer description (small, polar (hydrophil) etc.). If it is possible respectively if I can manage it, I want the description to be below the structural formula at the inner rim of the coloured circle.

Can you tell me how to adress the single nodes?

What have you defined the \aminoacid command for? - I couldn't get it from the MWE

greets

@Alenanno: That is exactly what I want! Thanks a lot! Is there a function to mark your answer beside the accepted button?

UPDATE: This is my final output which fits perfect for me. Special thanks to Alenanno. enter image description here

  • Apologies if English is not your first language, but in point 2. I think you mean "bond" (Bindung) rather than "bound" (Grenze). – Thruston Feb 25 '16 at 9:20
  • Just a clarification: do you want the same scheme? As in: rectangles that appear at different distances from the center of the circle and colored the same way? Thanks. :) – Alenanno Feb 25 '16 at 9:28
  • @Alenanno You have mail ^^ ;). (I'm also not sure why you've defined that command. Is it just to put space around the argument so you get <space><thing><space> rather than just <thing>? That seems to be all it would do? – cfr Feb 25 '16 at 22:51
  • @cfr sorry, mail where? :D the command is a remnant of something I was testing but if the OP wants a replica of the above picture, it's going to become more useful. :) – Alenanno Feb 25 '16 at 23:09
  • 1
    Mellon, did you accidentally create another login instead of logging in with your usual account? I will ask for a merge of your two accounts, so you get back to one, but you should be able to accept if you manage to login from your first account. :) You will also be able to comment on your own question. – Alenanno Feb 26 '16 at 14:58
5

You can add rotate=\angle-90 to your node printed by the foreach.

Edit: Since you don't want the image in the OP, here's your fixed version. Note that you can draw the colored arcs without "cutting" with a white circle in the middle. I have fixed that. I think the descriptions are as you would want them (German characters should be fixed). If you don't want them colored, remove the line \color{\farbe} from the code.

Edit 2: See below for a different version.

Output

enter image description here

Code

\documentclass[margin=10pt]{standalone}%
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{calc, arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri, intersections, decorations.text}
\usepackage{pgfmath}
\usepackage{chemfig,xstring}

\tikzset{
    point/.style={minimum size=#1},
    point/.default=0pt,
    bent text/.style={postaction={
            decorate,
            decoration={
                text along path,
                reverse path=true,
                text align/align=center,
                text={| \Large\bfseries\color{\farbe}|#1}
            }
        }
    }
}


\def\colorlist{{"green!60", "orange!60", "red!60", "yellow!60", "blue!60"}}

\begin{document}
\setatomsep{2.5em}
\setcrambond{2pt}{}{}
\begin{tikzpicture}\tiny
 \foreach \anfang/\ende/\descr [count=\ix starting from 0] in {%
    25/100/{klein polar (hydrophil)},
    104/170/{groß, polar (hydrophil)},
    174/254/{mittiere Polarität},
    258/314/{groß unpolar},
    318/381/{klein, unpolar}}{
    \pgfmathsetmacro\farbe{\colorlist[\ix]}
    \fill[\farbe] (\anfang:6cm) -- (\anfang:12cm) arc (\anfang:\ende:12cm) -- (\ende:6cm) arc (\ende:\anfang:6cm);
    \path[bent text={\descr}] (\anfang:5cm) arc (\anfang:\ende:5cm);
}
% mit count=\i werden die Kreise nummeriert
% der zugehörige Winkel wird mit evaluate aus dieser Nummer berechnet
% insgesamt werden (bis zu) 20 Kreise auf 360 Grad gleichmäßig verteilt
\foreach [count=\i, evaluate=\i as \angle using int((\i-1)*360/20), evaluate=\i as \midangle using int((\i-1.5)*360/20), remember=\midangle as \lastmid (initially -27)] \text in {%
 1,2,3,4,
  \schemestart \chemnameinit{}\chemname{\chemfig{C(=[3]O)(-[1]OH)(-[6]CH_2(-[6]CH(-[5]NH_2)(-[7]C(=[6]O)(-[1]OH))))}}{Asparaginsäure\\Asp\\D} \schemestop,
  \schemestart \chemnameinit{} \chemname{\chemfig{CH(-[3]NH_2)(-[1]C(=[2]OH)(-[7]OH))(-[6]CH_2(-[6]C(=[5]O)(-[7]NH_2)))}}{Asparagin\\Asn\\N}\schemestop
  ,7,8,9,10,11,12,13,14,15,16,17,18,19,20% Beschriftung der Kreise
}{

\node[point=2.2em, rotate=\angle-90] (node\i) at (\angle:9) {\text};
}
\end{tikzpicture}
\end{document}

Matching the OP

Here's another version to fit the one in your image.

Output

enter image description here

Code

\documentclass[margin=10pt]{standalone}%
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{calc, arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri, intersections, decorations.text}
\usepackage{pgfmath}
\usepackage{chemfig,xstring}

\definecolor{xlime}{RGB}{228,246,13}
\definecolor{xpink}{RGB}{245,109,175}
\definecolor{xorange}{RGB}{232,117,53}
\definecolor{xgreen}{RGB}{151,184,43}
\definecolor{xblue}{RGB}{144,181,236}

\tikzset{
    point/.style={minimum size=#1},
    point/.default=0pt,
    bent text/.style={postaction={
            decorate,
            decoration={
                text along path,
                reverse path=true,
                text align/align=center,
                text={| \Large\bfseries\color{\farbe}|#1}
            }
        }
    }
}

\newcommand\aminoacids[4][black]{
    \node[point=2.2em, minimum width=5cm,rotate=\angle-90, inner sep=2mm] (node#2) at (#3) {#4};
    \path[green, name path=around] (node#2.north west) -- (node#2.north east) -- (node#2.south east) -- (node#2.south west) -- cycle;
    \path[name path={tris#2}] (\midangle:12cm) -- (0,0) -- (\lastmid:12cm) -- cycle;
    \path[name intersections={of={tris#2} and around, name=i, total=\t}];
    \begin{scope}[on background layer]
        \filldraw[draw=black, fill=#1] (i-1) -- (i-2) -- (i-4) -- (i-3) -- cycle;
\end{scope}
}

\def\colorlist{{"xgreen", "xorange", "xpink", "xlime", "xblue"}}

\begin{document}
\setatomsep{2.5em}
\setcrambond{2pt}{}{}
\begin{tikzpicture}\tiny
 \foreach \anfang/\ende/\descr [count=\ix starting from 0] in {%
    25/100/{klein polar (hydrophil)},
    104/170/{groß, polar (hydrophil)},
    174/254/{mittiere Polarität},
    258/314/{groß unpolar},
    318/381/{klein, unpolar}}{%
    \pgfmathsetmacro\farbe{\colorlist[\ix]}
    \path[bent text={\descr}] (\anfang:5cm) arc (\anfang:\ende:5cm);
}

\foreach [count=\i, 
    evaluate=\i as \angle using int((\i-1)*360/20), 
    evaluate=\i as \midangle using int((\i-1.5)*360/20), 
    evaluate=\midangle as \lastmid using int((\i-.5)*360/20)
    ] 
    \text/\colr in {%
        1/0,2/0,3/0,4/0,
        \schemestart \chemnameinit{}\chemname{\chemfig{C(=[3]O)(-[1]OH)(-[6]CH_2(-[6]CH(-[5]NH_2)(-[7]C(=[6]O)(-[1] OH))))}}{Asparaginsäure\\Asp\\D} \schemestop/0,
        \schemestart \chemnameinit{} \chemname{\chemfig{CH(-[3]NH_2)(-[1]C(=[2]OH)(-[7]OH))(-[6]CH_2(-[6]C(=[5]O)(-[7]  NH_2)))}}{Asparagin\\Asn\\N}\schemestop/0
        ,7/1,8/1,9/1,10/2,11/2,12/2,13/3,14/3,15/3,16/3,17/4,18/4,19/4,20/4% Beschriftung der Kreise
}{
    \pgfmathsetmacro\farbe{\colorlist[\colr]}
    \aminoacids[\farbe]{\i}{\angle:9}{\text}
}
\end{tikzpicture}
\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.