我需要制作散点图并将 x 刻度标签样式更改为点 (.) 千位分隔符。我已阅读文档pgfplots package
和页面上的其他答案,但任何解决方案都有效。以下是我使用的代码的简化版本:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{wasysym}
\begin{document}
\begin{figure}[htb]
\centering
\begin{tikzpicture}[scale=0.9]
\begin{axis}[
enlargelimits=0.09,
width=13cm,
x tick label style={/pgf/number format/.cd,
scaled x ticks = false,
set thousands separator={.},
set decimal separator={,},
fixed
},
xtick distance=20000,
xlabel=PIB per cápita (PPP USD actuales),
ylabel=Esperanza de Vida (años),
ytick distance=5,
grid=both,
grid style={
line width=.2pt,
draw=gray,
},
]
\addplot[only marks] table[x=gdp, y=le, col sep=comma] {
gdp,le
1926.357336,63.288
11334.22093,78.174
14614.97043,75.86
6631.618694,61.241
21462.28694,76.207
16337.96649,70.99454147
20356.91551,76.415
8727.558325,74.445
46220.25126,82.4
49883.0413,81.1902439
17782.02615,71.921
30249.73823,75.527
46775.74033,76.761
3335.759791,72.155
17525.64926,75.755
18347.1407,73.62439024
45414.8906,80.99268293
8654.855391,70.192
2116.036775,60.639
8245.605306,69.817
6955.18277,68.756
11526.42439,76.735
16352.87933,65.846
15656.26667,75.284
79439.06245,77.046
18115.23037,74.61463415
1699.879935,59.927
796.9608114,57.094
6298.803772,72.599
3504.418254,68.62
3502.407887,57.582
44647.36423,82.12902439
15829.14408,73.0627324
661.8876249,51.41
25841.60932,76.59107024
2201.182699,52.575
22785.81803,79.315
14450.09499,76.092
13827.67279,74.2
1504.716581,63.473
865.0994627,59.205
5902.429651,64.112
15694.6192,79.634
3451.877418,53.053
22723.61426,77.27560976
31523.92688,80.344
33468.7265,78.57804878
48674.84075,80.70243902
14264.83549,73.673
8762.816615,69.51694097
16114.48315,75.24891578
12958.52798,74.33497357
13096.23133,74.37106401
11446.36514,76.102
10750.4563,71.304
7474.913704,73.267
29341.48771,57.434
28688.96877,77.5902439
1632.551806,65.037
40864.7359,81.55961007
30654.8667,77.15663422
19184.3161,72.53579461
19838.61971,72.99200108
38457.37629,80.61411878
9027.542438,70.117
42071.19127,81.4804878
4144.105176,62.2405421
40564.46071,82.27317073
17928.89201,65.685
1669.74581,60.954
9610.543382,73.096
47810.83601,80.64146341
4181.412842,62.448
26697.2485,81.03658537
13585.50464,73.531
7765.757271,73.15
1872.367758,59.419
1540.315132,57
7535.976471,66.536
1758.33446,63.055
2209.715002,61.65997345
44718.32709,80.33203243
4599.650144,73.376
57068.04043,84.27804878
26147.53737,75.56829268
12350.29247,72.55575242
47499.62538,82.46829268
10149.80067,70.25307541
5144.480705,61.37007175
2723.796089,64.23904036
3537.356365,63.28970182
6130.067515,68.302
11040.19721,69.025
17571.22224,75.73
16050.56191,69.672
68576.74433,81.45365854
35888.87589,82.05121951
36640.11558,82.54390244
8620.356524,75.836
40717.32438,83.79390244
9041.817565,74.182
25049.93554,72
3019.951952,66.695
2094.910004,66.13
35203.73414,82.02439024
9748.773845,71.34634146
72918.00376,74.577
3447.60825,70.65121951
6128.358238,66.335
15950.39862,75.52966717
15306.5141,75.33548436
14349.24172,75.07764241
15217.99063,75.23120107
24510.16206,74.4804878
2541.162584,64.08958665
14218.82972,79.409
2883.811087,53.745
836.181489,62.007
15810.25223,71.776
28783.66677,74.32195122
9887.33762,70.14911818
1963.729937,62.52786541
6446.565515,67.6473864
102517.1382,82.29268293
106959.8763,83.7
13766.31883,75.549
1466.497463,65.539
1159.319842,62.661
26623.32837,75.143
14593.9729,77.042
2043.718105,57.478
35787.87696,81.79756098
3835.230926,63.082
20087.71538,74.35317073
17239.32066,76.933
3483.455937,69.078
18676.31894,73.28575815
12302.29818,72.78573636
12392.03253,72.77948414
10909.86247,71.12668337
5054.682473,71.468
12152.17138,69.087
16272.19565,76.938
7770.245991,75.573
1190.755747,57.714
5384.869389,66.464
10622.15643,63.782
2464.389033,69.887
49527.66966,81.5097561
37864.99954,81.45682927
5278.44924,75.149
967.0846194,59.667
6038.462315,52.985
55259.59286,79.03588312
61722.23991,82.30487805
40946.37388,80.06707019
42459.75058,76.801
24980.14714,67.36391256
5617.41536,70.69238368
5000.283839,66.322
22134.9748,77.806
4072.818793,65.384
9199.669384,73.023
12533.49118,74.747
7320.498539,68.951
26594.75786,77.45121951
29532.38116,81.12439024
43709.76612,80.40786041
3740.765533,59.53466941
37581.03004,79.59612195
127516.9086,78.036
21566.07305,75.01219512
24737.68944,71.16829268
1843.326591,66.696
5919.359821,74.77
3138.69963,66.488
54013.87804,74.4
2442.643073,66.784
13896.12139,75.28780488
26468.86683,74.29512195
1399.523362,51.423
87043.18771,82.74390244
29522.04477,76.56341463
31468.36317,80.77560976
22114.72005,68.60052618
2288.629698,70.43
13180.52924,61.981
5678.732828,68.45652588
5678.732828,68.45652588
1997.02555,56.322
34818.12051,82.83170732
11798.38995,75.088
13334.2754,75.3
11147.28078,73.06
3726.249491,59.93914297
3724.137621,59.93780952
3726.249491,59.93914297
4568.664858,64.257
15724.63939,71.279
8261.74606,57.107
47891.27784,82.20487805
63648.28802,82.89756098
2811.86989,70.879
2652.530219,64.95
16241.55555,75.103
7878.759385,68.569
1438.689326,59.949
5526.478696,72.88
33569.41352,70.556
11464.20947,75.525
24844.89555,75.498
15964.79184,67.704
1774.010819,59.575
7949.149002,71.1895122
70887.39073,77.101
41579.86341,80.95609756
56443.81724,78.6902439
15980.87956,75.08883849
21117.8016,77.341
6069.978666,71.192
2988.850538,71.925
5915.170833,76.052
5019.238115,73.299
15710.16761,71.85712676
2458.385012,64.743
3862.478483,61.397
2036.319256,60.398
};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
这里我保留原来的序言。可能存在我不知道的已知软件包冲突。
\documentclass[letterpaper,11pt,oneside]{article}
\usepackage{geometry}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage[hidelinks]{hyperref}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fontenc}
\usepackage{graphicx}
\graphicspath{<path>}
\usepackage{verbatim}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{apacite}
\usepackage{wrapfig}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{wasysym}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{adjustbox}
\usepackage{enumitem}
\usepackage{array}
\usepackage{listings}
\usepackage{appendix}
\usepackage{afterpage}
\usepackage{parskip}
\usepackage{layout}
\usepackage[sectionbib]{natbib}
我尝试了很多不同的组合和变化,但都不起作用。另外,我认为这可能是utf8-inputenc
或的问题spanish-babel
,但真的不知道。我真的很感激帮助,我正在写论文。谢谢!
(*) 数据最初位于 .csv 文件中,并且发生的情况相同。
(**)我在 Windows 10 上使用 TeXstudio。