
Inspirándome en el siguiente gráfico, intenté copiarlo con tikz. Me gustaría modificarlo en algunos detalles:
- El borde del fondo coloreado debe ser homogéneo.
- No quiero los enlaces entre los aminoácidos, prefiero que estén separados.
Aquí está mi primer intento:
\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}
Escribí la estructura de los aminoácidos en otro archivo TeX y normalmente uso el \input
comando. Para el MWE dos aminoácidos deberían ser suficientes.
¿Cómo puedo rotar los nodos/aminoácidos para que apunten al centro del círculo interior?
Cualquier solución alternativa también es bienvenida.
Lo siento mucho, pero no puedo comentar mi propia pregunta, así que agrego la información aquí.
@Alenanno muchas gracias por tu útil respuesta.
No quiero el mismo gráfico. De hecho, me gusta lo que tengo hasta ahora: todas las fórmulas estructurales en el círculo coloreado con casi la misma distancia al centro.
El siguiente paso será la descripción exterior (pequeño, polar (hidrófilo), etc.). Si es posible, respectivamente, si puedo lograrlo, quiero que la descripción esté debajo de la fórmula estructural en el borde interior del círculo coloreado.
¿Puede decirme cómo abordar los nodos individuales?
¿Para qué has definido el comando \aminoacid? - No pude conseguirlo en el MWE.
saluda
@Alenanno: ¡Eso es exactamente lo que quiero! ¡Muchas gracias! ¿Existe una función para marcar su respuesta al lado del botón aceptado?
ACTUALIZACIÓN: Este es mi resultado final que encaja perfecto para mí. Un agradecimiento especial a Alenanno.
Respuesta1
Puede agregar rotate=\angle-90
a su nodo impreso por foreach.
Editar:Como no desea la imagen en el OP, aquí está su versión arreglada. Ten en cuenta que puedes dibujar los arcos de colores sin "cortar" con un círculo blanco en el medio. Lo he arreglado. Creo que las descripciones son como usted quisiera (los caracteres alemanes deberían corregirse). Si no desea que estén coloreados, elimine la línea \color{\farbe}
del código.
Edición 2:Vea a continuación una versión diferente.
Producción
Código
\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}
Coincidiendo con el OP
Aquí tienes otra versión que se adapta a la de tu imagen.
Producción
Código
\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}