第一次发帖,长期潜水。我正在尝试在 LaTeX 中重新创建 DNA/蛋白质变性曲线。
我希望曲线看起来是这样的:
以下是我的“统计数据”:
- 我正在 TeXStudio 中编写并编译为 pdf。
- 我正在使用 TikZ 和 pgfplots 包。
这是我的代码:
\documentclass{article}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{arrows,positioning,shapes,decorations,automata,backgrounds,petri}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\usepgflibrary{shapes.geometric}
\usepgfplotslibrary{patchplots}
\usetikzlibrary{pgfplots.patchplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{calc}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{mathtools}
\usepackage{chemfig}
\usepackage{setspace}
\usepackage{parskip}
\usepackage{amssymb}
\usepackage{booktabs,array,dcolumn}
\usepackage{etoolbox}
\usepackage[framemethod=TikZ]{mdframed}
\pgfplotsset{my style/.append style={axis x line=middle, axis y line=middle, xlabel={$x$}, ylabel={$y$}, axis equal }}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{axis}[xmin=50, xmax=90, ymin=1.0, ymax=1.4, xlabel= Temperature ($^\circ$C), ylabel= Relative Absorbance (260 nm) ]
\addplot[color=blue, domain=50:90, samples= 100, no marks, x filter/.expression = {y==1.335 ? inf:x}] expression {
%(50, 1.01) (69, 1.02)
%(75, 1.2) (90, 1.335)
x^(3)+x^(2)+x^(1)};
%\addplot[color=green,mark=x] coordinates{
%(50, 1.033) (54, 1.036)
%(56,1.04) (62,1.32)
%(63.5,1.35) (74, 1.35) }; these interpolation point coordinates are averaged for the following coordinates:
\addplot[color=red, domain=50:90, samples= 100, no marks, x filter/.expression = {y==1.335 ? inf:x}] expression {
%(50, 1.033) (55, 1.038)
%(62.75,1.335) (74, 1.335)
x^(3)+x^(2)+x^(1)};
\legend{High AT, High GC}
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
对于所有内容,我深表歉意!这是一份相当大的文档的一部分。
答案1
我不熟悉这个主题,但这张图片看起来像逻辑函数。下面的代码绘制了一个这样的函数,其最小值和最大值如图像中所示。
我删减了序言,只保留必要的部分。
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15} % recommended to use specific version
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[
declare function={
k=0.3; % range
x0=75; % midpoint
L=0.3; % steepness
dna(\x)=1 + L/(1+exp(-k*(\x-x0))); % logistic function (https://en.wikipedia.org/wiki/Logistic_function)
}
]
\begin{axis}[
xmin=30,
xmax=119,
ymin=0.95,
ymax=1.35,
% put y-axis only on the left side of axis
axis y line=left,
% remove arrow tip
axis line style={-},
xlabel=Temperature ($^\circ$C),
ylabel=Relative Absorbance (260 nm),
% move legend
legend pos=north west
]
% plot main function
\addplot[color=blue, domain=40:100, samples=100, no marks] {dna(x)};
% plot upper asymptote
% "forget plot" means it's not included in the legend
\addplot[forget plot, blue, dashed,samples at={100,120}] {dna(100)};
% draw dashed line
% \pgfkeysvalueof{/pgfplots/ymin} is the ymin of the axis, similarly for xmax
% x0 is defined with "declare function" above
\draw [dashed] (x0,\pgfkeysvalueof{/pgfplots/ymin}) |-
(\pgfkeysvalueof{/pgfplots/xmax},{dna(x0)});
\legend{High AT, High GC}
\end{axis}
% second axis used to make the ticks and label on the right side
% use same ymin/ymax as previous axis, but custom ticklabels
\begin{axis}[
axis x line=none,
axis y line=right,
axis line style={-},
ylabel=Degree of denaturation (\%),
xmin=40,xmax=120,
ymin=0.95, ymax=1.35,
ytick={1,1.15,1.3},
yticklabels={0,50,100}
]
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}