从散点图中删除科学计数法

从散点图中删除科学计数法

我正在尝试删除科学计数法。我还希望将计数法改为 100 000 000 €。

我的代码是

\documentclass[oneside,12pt]{scrbook} %scrbook has more options than article
\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{tikz,pgfplots}

\begin{document}

 \begin{tikzpicture}

 \begin{axis}
   [xlabel={SCR}, ylabel={P}]
   [scaled ticks=false,  tick label style={/pgf/number format/fixed}]
   \addplot[only marks, scatter src=\thisrow{class},
   error bars/.cd]
   table[x=x,y=y] {
   x y class
   43180451.0 4761236.1 0
   91883446.9  13054769.6 0
   108682844.6 22229984.8 0
   160752614.1 28476074.6 0
   160844652.5 39735331.0 0
   205534805.5 50633433.3 0
   229135588.7 55839308.4 0
   239734273.6 65922997.3 0
   274661461.9 70894410.3 0
   303910937.7 80620104.8 0
   308326651.6 82473387.5 0
   320992344.9 91249725.4 0
   361786375.3 100531386.8 0
   367192582.4 101346084.8 0
   425875799.1 111270629.7 0
   465495267.0 120771150.1 0
   472328821.5 128548460.2 0
   512806811.1 141383997.3 0
   542443666.4 145359191.6 0
   564853111.9 151264488.2 0
   584726688.2 157591274.5 0
   645100856.8 174767284.7 0
   677451445.3 184541127.8 0
   718624099.2 192368819.0 0
   789060505.9 212324646.6 0
   832336583.2 218058603.9 0
   855242375.4 228676018.9 0
   871301976.9 231941074.9 0
   914674996.2 241443839.9 0
   1006547285.4 247207854.6 0
   1024056068.8 252271740.9 0
   1069573698.3 261233638.6 0
   1195213783.5 272484062.0 0
   1273011914.1 278271858.7 0
   1281253323.8 285867590.9 0
   1361570753.0 302510890.3 0
   1392904014.9 309592078.6 0
   1488366314.2 318032675.6 0
   1571232455.9 329446033.2 0
   1623552691.5 332137529.3 0
   1629898350.6 338870799.2 0
   1765269432.5 351059518.9 0
   1892209564.9 365490881.6 0
   2020786263.6 377958441.9 0
   2053380046.3 385991328.3 0
   2133821961.0 392172626.1 0
   2180993179.7 401170442.4 0
   2225966873.7 406219279.7 0
   2319293478.3 415271974.8 0
    };
   \end{axis}
   \end{tikzpicture}
   \end{document}

你能帮我一下吗?

答案1

这里有几个选项。为了避免轴标签与刻度标签重叠的问题,您可以简单地将\pgfplotsset{compat=1.13}(假设您拥有最新版本的pgfplots)添加到序言中。

让图更宽是解决 xticklabels 问题的一种办法。其他选项包括旋转它们,或者将 x 和 y 都除以 1e9,并在轴标签中指定值以十亿为单位。

在此处输入图片描述

\documentclass[oneside,12pt]{scrbook} %scrbook has more options than article
\usepackage{amsmath}
\usepackage{eurosym}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\begin{document}

\begin{tikzpicture}
\begin{axis}[
    xlabel={SCR},
    ylabel={P},
    scaled ticks=false,
    tick label style={/pgf/number format/fixed},
    xticklabel style={anchor=north east,rotate=30}]
   \addplot[only marks, scatter src=\thisrow{class},
   error bars/.cd]
   table[x=x,y=y] {
   x y class
   43180451.0 4761236.1 0
   91883446.9  13054769.6 0
   108682844.6 22229984.8 0
   160752614.1 28476074.6 0
   160844652.5 39735331.0 0
   205534805.5 50633433.3 0
   229135588.7 55839308.4 0
   239734273.6 65922997.3 0
   274661461.9 70894410.3 0
   303910937.7 80620104.8 0
   308326651.6 82473387.5 0
   320992344.9 91249725.4 0
   361786375.3 100531386.8 0
   367192582.4 101346084.8 0
   425875799.1 111270629.7 0
   465495267.0 120771150.1 0
   472328821.5 128548460.2 0
   512806811.1 141383997.3 0
   542443666.4 145359191.6 0
   564853111.9 151264488.2 0
   584726688.2 157591274.5 0
   645100856.8 174767284.7 0
   677451445.3 184541127.8 0
   718624099.2 192368819.0 0
   789060505.9 212324646.6 0
   832336583.2 218058603.9 0
   855242375.4 228676018.9 0
   871301976.9 231941074.9 0
   914674996.2 241443839.9 0
   1006547285.4 247207854.6 0
   1024056068.8 252271740.9 0
   1069573698.3 261233638.6 0
   1195213783.5 272484062.0 0
   1273011914.1 278271858.7 0
   1281253323.8 285867590.9 0
   1361570753.0 302510890.3 0
   1392904014.9 309592078.6 0
   1488366314.2 318032675.6 0
   1571232455.9 329446033.2 0
   1623552691.5 332137529.3 0
   1629898350.6 338870799.2 0
   1765269432.5 351059518.9 0
   1892209564.9 365490881.6 0
   2020786263.6 377958441.9 0
   2053380046.3 385991328.3 0
   2133821961.0 392172626.1 0
   2180993179.7 401170442.4 0
   2225966873.7 406219279.7 0
   2319293478.3 415271974.8 0
    };
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[
    xlabel={SCR [billion \euro]},
    ylabel={P [billion \euro]},
    scaled ticks=false,
    tick label style={/pgf/number format/fixed}]
   \addplot[only marks, scatter src=\thisrow{class},
   error bars/.cd]
   table[x expr=\thisrow{x}*1e-9,y expr=\thisrow{y}*1e-9] {
   x y class
   43180451.0 4761236.1 0
   91883446.9  13054769.6 0
   108682844.6 22229984.8 0
   160752614.1 28476074.6 0
   160844652.5 39735331.0 0
   205534805.5 50633433.3 0
   229135588.7 55839308.4 0
   239734273.6 65922997.3 0
   274661461.9 70894410.3 0
   303910937.7 80620104.8 0
   308326651.6 82473387.5 0
   320992344.9 91249725.4 0
   361786375.3 100531386.8 0
   367192582.4 101346084.8 0
   425875799.1 111270629.7 0
   465495267.0 120771150.1 0
   472328821.5 128548460.2 0
   512806811.1 141383997.3 0
   542443666.4 145359191.6 0
   564853111.9 151264488.2 0
   584726688.2 157591274.5 0
   645100856.8 174767284.7 0
   677451445.3 184541127.8 0
   718624099.2 192368819.0 0
   789060505.9 212324646.6 0
   832336583.2 218058603.9 0
   855242375.4 228676018.9 0
   871301976.9 231941074.9 0
   914674996.2 241443839.9 0
   1006547285.4 247207854.6 0
   1024056068.8 252271740.9 0
   1069573698.3 261233638.6 0
   1195213783.5 272484062.0 0
   1273011914.1 278271858.7 0
   1281253323.8 285867590.9 0
   1361570753.0 302510890.3 0
   1392904014.9 309592078.6 0
   1488366314.2 318032675.6 0
   1571232455.9 329446033.2 0
   1623552691.5 332137529.3 0
   1629898350.6 338870799.2 0
   1765269432.5 351059518.9 0
   1892209564.9 365490881.6 0
   2020786263.6 377958441.9 0
   2053380046.3 385991328.3 0
   2133821961.0 392172626.1 0
   2180993179.7 401170442.4 0
   2225966873.7 406219279.7 0
   2319293478.3 415271974.8 0
    };
\end{axis}
\end{tikzpicture}
\end{document}

答案2

\documentclass[12pt]{article}
\usepackage{marvosym}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}

\usepackage[gen]{eurosym}
\begin{document}
\begin{figure}[ht]
\centering
\begin{tikzpicture}
\begin{axis}[
width=0.8\textwidth,
height=0.6\textwidth,
axis on top=true,
xlabel = {$SCR_{Market}$},
ylabel = {$E[P]$},
% scale = 1,
xtick={10000000,20000000,30000000,40000000},
ytick={1000000,2000000,3000000,4000000,5000000,6000000,7000000,8000000,9000000,10000000},
xticklabel={\euro\pgfmathprintnumber\tick},
scaled ticks=false,
yticklabel={\euro\pgfmathprintnumber\tick},
scaled ticks=false,
ticklabel style={/pgf/number format/fixed},
xticklabel style={font=\scriptsize},
samples=2,
]

\addplot[only marks, scatter src=\thisrow{class},
error bars/.cd]
table[x=x,y=y] {
    x y class
    8536992.24       397151.92      0
    9952270.58       405413.94      0
    10648538.47      664558.80      0
    10851767.48      861792.22      0
    11529438.14      876440.25      0
    12076341.61      1021643.71     0
    12322947.45      1063744.54     0
    12832794.99      1331313.93     0
    13222910.53      1499538.86     0
    15590703.35      1646091.07     0
    14391835.67      1837935.12     0
    14866677.51      1871673.47     0
    15544490.39      2102402.16     0
    16904587.04      2182316.86     0
    16947631.07      2270382.99     0
    17075995.44      2370206.39     0
    17255083.09      2413202.68     0
    17306822.83      2487867.30     0
    17571797.42      3008838.70     0
    18816805.84      3027494.69     0
    19273601.26      3231479.03     0
    19885651.41      3397357.05     0
    20580605.43      3641018.21     0
    21133325.70      3846687.58     0
    21529955.06      3971194.38     0
    22318561.42      4270007.40     0
    24261898.21      4472551.36     0
    24397021.18      4732477.81     0
    25614170.32      5035438.87     0
    26194257.94      5088706.89     0
    26432393.36      5197947.93     0
    26481021.05      5367269.90     0
    27488517.42      5509265.84     0
    27920805.52      5559804.28     0
    28186508.53      5683479.01     0
    29085642.45      5922625.52     0
    29286588.84      5944931.71     0
    30307864.39      6131779.13     0
    31088278.58      6642382.31     0
    32218583.45      6831687.70     0
    33118207.56      6869654.52     0
    33255103.99      7048091.36     0
    33952828.22      7374745.70     0
    35088874.19      7380361.28     0
    35339550.28      7551190.13     0
    36230564.58      7755647.03     0
    36485950.03      8371869.20     0
    38977252.75      8430730.03     0
    39111982.77      8621605.25     0
    39752427.86      9084511.81     0

};

\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}

相关内容