如何定义图表中每条曲线的范围(范围)?

如何定义图表中每条曲线的范围(范围)?

我想在图表中绘制几个函数(曲线)。我的问题是:“如何定义每条曲线的范围(域)?”

例如,我的红色曲线应从 1e5 开始,到 1e7 结束。另一个例子是,我想绘制一条水平直线作为函数X=1e5-1e7=50谢谢

\begin{filecontents}{3.dat}
amplitudea  countb
106.62  1
106.62  50045
94.2741 50045
92.5907 100090
92.0295 300266
89.7849 500442
89.2237 700618
82.4899 750662
72.9502 950838
71.8279 1000882
69.0221 1050927
62.2883 1100971
60.6048 1151015
59.4825 1351191
58.9213 1401235
58.3602 1451279
57.799  1501323
57.2379 1701499
55.5544 1901675
53.3098 2101851
51.0651 2151895
48.8205 2402115
48.2594 2452159
48.2594 2652335
47.1371 2702379
46.5759 2752424
44.3313 2952600
43.7701 3002644
43.209  3202820
38.1586 3402996
35.3528 3453040
34.7916 3653216
33.1082 3703260
32.547  3903436
31.9859 4103612
31.4247 4303788
31.4247 4503964
29.7412 4704140
29.7412 4904316
29.1801 5104492
29.1801 5304668
29.1801 5354712
28.0578 5554888
26.9355 5604932
26.9355 5855152
26.9355 6055328
26.3743 6105372
26.3743 6305548
26.3743 6505724
26.3743 6555769
25.8132 6655857
25.8132 6856033
25.8132 7056209
25.252  7306429
25.252  7356473
24.6908 7556649
24.1297 7756825
24.1297 7806869
24.1297 7856913
23.5685 7957001
23.0074 8007045
23.0074 8207221
23.0074 8407397
23.0074 8607573
23.0074 8657617
22.4462 8907837
22.4462 9158057
21.8851 9608453
21.8851 9808629
21.3239 10008805
21.3239 10208981
21.3239 10409157
20.7628 10609333
20.7628 10809509
20.7628 10909597
20.2016 10959641
19.6404 11159817
19.6404 11359993
19.0793 11560169
18.5181 11760345
18.5181 12010565
18.5181 12260785
\end{filecontents}
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
  \begin{semilogxaxis}
    [
        enlarge x limits=false,
        no marks,
        grid=none,
        xmin=1e4, xmax=1e8,
        ymin=0, ymax=150,       
        title= Amplituden Spektrum $\sigma_{x}$,
        ylabel={$\sigma_{a}$},
        xlabel={$N$},
        extra y ticks  = {35},
        samples=50, %Function (red curve)
        domain=0.125:1e6, %Function (red curve)  
     ]

     %Here are my two "curves" 
    \addplot+[const plot] table[x=countb,y=amplitudea] {3.dat}; %step stairs blue
    \addplot+[mark=none] {100*(1e6/x)^(1/5)}; %Function red


    %Help lines and other things
    \draw[orange,dashed] ({axis cs:50045,0}|-{rel axis cs:0,1}) -- ({axis cs:50045,0}|-{rel axis cs:0,0});
    \draw[dashed,green] ({rel axis cs:1,0}|-{axis cs:0,34.385735235}) -- ({rel axis cs:0,0}|-{axis cs:0,34.385735235});          
    \draw [draw=black] (rel axis cs:0,0) rectangle (axis cs:100000,18.385735235);


\end{semilogxaxis}
\end{tikzpicture}
\end{document}
%https://www.sharelatex.com/blog/2013/08/27/tikz-series-pt1.html

相关内容