我正在使用 TeXStudio 和 LuaLaTeX,这是我的代码:
\documentclass[12pt]{article}
\usepackage{pgfplots}
\usepackage{float}
\pgfplotsset{compat=1.17}
\usepackage{tikz}
\usetikzlibrary{shapes, arrows.meta, automata, positioning, matrix, calc}
\usepackage[margin=1in]{geometry}
\usepackage{caption}
\usepackage{siunitx}
\begin{document}
\begin{figure}[H]
\centering
\captionsetup{skip = 5pt} %default is 10pt; I am doing this to make use of pages more efficient; if I didn't do this, then some figures would go onto the next page, and leave a lot of space at the end of the current page
\pgfplotsset{grid style={dashed,gray}} %Both grids for this figure ONLY
\begin{tikzpicture}[trim axis left, trim axis right,
declare function = {r1 = 0.8;
A1 = 4*r1;
B1 = 1000*r1 - 4225;
C1 = 62500*r1;
r2 = 1.2;
A2 = 4*r2;
B2 = 1000*r2 - 4225;
C2 = 62500*r2;
R41 = (-B1 - sqrt(B1^2 - 4*A1*C1))/(2*A1);
R42 = (-B2 - sqrt(B2^2 - 4*A2*C2))/(2*A2);
R43 = (-B2 + sqrt(B2^2 - 4*A2*C2))/(2*A2);
R44 = (-B1 + sqrt(B1^2 - 4*A1*C1))/(2*A1);}]
\begin{semilogxaxis}[
width=12cm,
height=9cm,
xmin=10^0,xmax=10^6,
ymin=0,ymax=0.5,
%axis lines = left, %if this is activated, then the tick marks on up and right part of plot will disappear
xlabel = {$R_4$ ($\SI{}{\ohm}$)}, ylabel={$\eta$},
%every axis y label/.style={at={(0,1)},anchor=south},
%every axis x label/.style={at={(1,0)},anchor=west},
xmajorgrids,
ymajorgrids,
samples=1000,
grid=both] %More samples = smoother curve
\addplot [color = blue, thick, domain = 1:R41+1] {(4*x^2 + 5225*x + 62500)/(9*x^2 + 9725*x + 2131250)};
\addplot [color = red, thick, domain = R41:R42+1] {(4*x^2 + 5225*x + 62500)/(9*x^2 + 9725*x + 2131250)};
\addplot [color = blue, thick, domain = R42:R43+10] {(4*x^2 + 5225*x + 62500)/(9*x^2 + 9725*x + 2131250)};
\addplot [color = red, thick, domain = R43:R44+10] {(4*x^2 + 5225*x + 62500)/(9*x^2 + 9725*x + 2131250)};
\addplot [color = blue, thick, domain = R44:10^6] {(4*x^2 + 5225*x + 62500)/(9*x^2 + 9725*x + 2131250)};
%The top four \addplot commands had the right boundaries slightly over the bounds for the constraint set because if stopped right at, say, R41, then there will be a small gap between red and blue curves. The succeeding \addplot command will write over the preceding curve.
\end{semilogxaxis}
\end{tikzpicture}
\caption{This plot.}
\label{eta}
\end{figure}
\end{document}
输出:
如果我们放大,我们会看到一个瑕疵:
TeXStudio 中是否有一些 PDF 设置可以消除一般的瑕疵(以及未来的 tex 编译中的瑕疵)?