我正在轴环境中绘制一幅图。我的问题是,我希望轴线以零结束,并且不会超出左侧或下方。但是,当我设置属性 xmin=ymin=0 时,不仅线条会消失,而且我用来标记重要点的线条下方的所有图形也会消失。请参阅下面的图片以供参考。
因此,虽然我或多或少理解了为什么会发生这种情况,但我不知道如何在保留轴标签的同时擦除轴的负部分。下面是 MWE:
\documentclass[usenames,dvipsnames,handout,aspectratio=169]{beamer} % --> loads xcolor and hyperref
%----------------------------------------------------------------------------------------------
% PACKAGES
%----------------------------------------------------------------------------------------------
% Loaded by default in beamer (and many others...)
%\usepackage{
% amsthm
% color
% enumerate
% fourier
% hyperref
% xcolor
%}
\usepackage{
fourier, % For typesetting
newtxtext, % To set the fonts to Times New Roman
import, % to import files
caption, % To include captions in tables and figures
subcaption, % To include subcaptions in tables and figures
graphicx, % A more advanced package for images and figures
float, % Improves floating objects: figures and tables
nicematrix, % To make nice tables
multicol, % For multicolum slides
ragged2e, % New commands and environments for ragged tex
mathtools, % Loads and enhances the features of amsmath
amssymb, % to cross a term in an equation
cancel, % to cross a term in an equation
marvosym % Adds Marting Vogel's symbols: euro, comunicaiton,...
}
%TO BE REMOVED
%\let\marvosymLightning\Lightning
%This sequence of packages controls the mathematical tools of latex
%\usepackage[makeroom]{cancel} % to cross a term in an equation
%----------------------------------------------------------------------------------------------
% GRAPH CONTROL
%----------------------------------------------------------------------------------------------
\usepackage{pgfplots} %--> it loads tikz, already loaded?
\usetikzlibrary{
fit,
calc,
matrix,
positioning,
arrows.meta,
intersections,
through,
backgrounds,
patterns,
shapes,
decorations.pathreplacing,
arrows.meta
}
\usepgfplotslibrary{fillbetween}
\pgfplotsset{compat = newest}
\pgfplotsset{overwrite option/.style args={#1 with #2}{#1=#2,#1/.code=}}
\pgfplotsset{
vasymptote/.style={before end axis/.append code={\draw[dashed,<->,-{Latex}] ({rel axis cs:0,0} -| {axis cs:#1,0}) -- ({rel axis cs:0,1} -| {axis cs:#1,0}); }},
myaxis/.style={axis line style={<->, {Latex}-{Latex}}}
} % This fancy shit sets the arrows to both parts of the axis in the axis environment of pgfplot
%----------------------------------------------------------------------------------------------
% START OF THE PRESENTATION
%----------------------------------------------------------------------------------------------
\begin{document}
\begin{frame}
%------------------------------------------------------------------------------
% SUBSTITUTION AND INCOME EFFECTS
%------------------------------------------------------------------------------
\begin{tikzpicture}[scale = 1]
\begin{axis}[
width=6cm,
xscale = 1, yscale = 1,
axis lines = middle,
% myaxis,
% grid,
% grid style={densely dashed},
xmin = -20, xmax = 130, ymin = -25, ymax = 200,
every axis/.append style={font=\tiny},
xlabel = {$L$}, xlabel style={at=(current axis.right of origin), anchor=west},
ylabel = $C$, ylabel style={at=(current axis.above origin), anchor=east},
xtick = \empty,
xticklabels = \empty,
ytick = \empty,
yticklabels = \empty,
samples=100,
domain=-2:10,
% axis equal,
% no markers
]
% First slide
% ----------------------------------------------------------------------------------------
% Functions
\addplot[domain=0:110, Mahogany, name path = ic0]{(90*60^(1/3))/(x^(1/3))};
\addplot[domain=0:112, black , name path = bc0]{120-1/2*x};
% Points
\draw[black, thick, fill] (axis cs: 60,90) circle [ radius = .5] node[above] at (60,90) {\fontsize{5}{5} \selectfont $E_0$};
% Dashed lines
\draw[dashed,gray, ultra thin] (90,64)--(112,64) node[above,xshift = 5] at (90,60) {\fontsize{4}{4} \selectfont $w$};
\draw[dashed,gray, ultra thin] (60,0)--(60,90) node[below] at (60,0) {\fontsize{4}{4} \selectfont $L^*$};
\draw[dashed,gray, ultra thin] (0,90)--(60,90) node[left, xshift = 2] at (0,90) {\fontsize{4}{4} \selectfont $C^*=C'$};
\draw[dashed,gray, ultra thin] (112,0)--(112,200);
% Arrows
\draw[-latex, ultra thin] (120,27)--(120,0) node[above, yshift=-5, xshift=-1] at (120,32) {\fontsize{4}{4} \selectfont $R$};
\draw[-latex, ultra thin] (120,37)--(120,64);
\draw[-latex, ultra thin] (51,-20)--(0,-20) node[above, yshift=-5, xshift=-1] at (56,-20) {\fontsize{4}{4} \selectfont $T$};
\draw[-latex, ultra thin] (61,-20)--(112,-20);
\draw[-latex, ultra thin] (-10,55)--(-10,0) node[above, yshift=-7, xshift=-1] at (-10,65) {\fontsize{4}{4} \selectfont $V$};
\draw[-latex, ultra thin] (-10,65)--(-10,120);
% Solid lines
\draw[black, ultra thin] (117,64)--(123,64);
\draw[black, ultra thin] (0,-17)--(0,-23);
\draw[black, ultra thin] (112,-17)--(112,-23);
\draw[black, ultra thin] (-13,0)--(-7,0);
\draw[black, ultra thin] (-13,120)--(-7,120);
% Second slide
% ----------------------------------------------------------------------------------------
% Functions
\only<2->{ \addplot[domain=0:110, Mahogany, name path = ic0]{(132*44^(1/3))/(x^(1/3))};}
\only<2->{ \addplot[domain=0:112, black , name path = bc0]{176-x};}
% Points
\draw<2->[black, thick, fill] (axis cs: 44,132) circle [ radius = .5] node[above] at (44,132) {\fontsize{5}{5} \selectfont $E_1$};
% Dashed lines
\draw<2->[dashed,gray, ultra thin] (44,0)--(44,132) node[below] at (44,0) {\fontsize{4}{4} \selectfont $L_1$};
\draw<2->[dashed,gray, ultra thin] (0,132)--(44,132) node[left, xshift = 2] at (0,132) {\fontsize{4}{4} \selectfont $C_1$};
% Third slide
% ----------------------------------------------------------------------------------------
% Functions
\only<3->{ \addplot[domain=10:50, Mahogany, name path = ic0, draw opacity = .5]{(90*30^(1/3))/(x^(1/3))};}
\only<3->{ \addplot[domain=0:112, black , name path = bc0, draw opacity = .5]{120-x} node[right, xshift = -4] at (112,8) {\fontsize{4}{4} \selectfont $R_c$};}
% Points
\draw<3->[black, thick, fill] (axis cs: 30,90) circle [ radius = .5] node[above,yshift = -2] at (30,90) {\fontsize{4}{4} \selectfont $E'$};
% Dashed lines
\draw<3->[dashed,gray, ultra thin] (30,0)--(30,90) node[below] at (30,0) {\fontsize{4}{4} \selectfont $L'$};
\draw<3->[dashed,gray, ultra thin] (0,90)--(30,90);
% Fourth slide
% ----------------------------------------------------------------------------------------
% Functions
\only<4->{ \addplot[domain=0:112, black , name path = bc0, draw opacity = .5]{120*2^(1/4)-x};}
% Points
\draw<4->[black, thick, fill] (axis cs: 35.676,107.0286) circle [ radius = .5] node[above] at (35.676,107.0286) {\fontsize{4}{4} \selectfont $E''$};
% Dashed lines
\draw<4->[dashed,gray, ultra thin] (35.676,0)--(35.676,107.0286) node[below] at (35.676,0) {\fontsize{4}{4} \selectfont $L''$};
\draw<4->[dashed,gray, ultra thin] (0,107.0286)--(35.676,107.0286) node[left, xshift = 2] at (0,107.0286) {\fontsize{4}{4} \selectfont $C''$};
\end{axis}
\end{tikzpicture}
\end{frame}
\end{document}