아래에 표시된 신뢰 구간 스타일 막대 차트가 있습니다. 가독성을 높이기 위해 각 막대(및 각 레이블)가 다른 색상(색상 순환)을 갖도록 변경하는 방법이 있습니까? 내가 찾을 수 있었던 모든 대답은 파일에서 데이터를 로드하는 동안 foreach 또는 다른 구성을 사용하여 찾을 수 있었습니다.
\documentclass[tikz]{standalone}
\usepackage{pgfplots,filecontents}
\pgfplotsset{compat=newest}
\begin{filecontents}{ntrick.dat}
CHAMP X Y YL YH
YASUO 1 0.4107142857 0.1190484959 0.1305120931
AURELION-SOL 2 0.2222222222 0.1161512673 0.1853507324
DARIUS 3 0.1941747573 0.06481265042 0.08680517491
KOG-MAW 4 0.1785714286 0.09978757028 0.1773464869
TALIYAH 5 0.1666666667 0.07971256627 0.1291143337
GRAGAS 6 0.156626506 0.06274727049 0.09312680322
ZED 7 0.1492537313 0.06611188926 0.1041524436
NIDALEE 8 0.1304347826 0.06026929692 0.09925036651
URGOT 9 0.1282051282 0.07217777872 0.1388553622
OLAF 10 0.12 0.05556701031 0.0925984252
MORDEKAISER 11 0.1194029851 0.04455530856 0.06576953551
IVERN 12 0.1136363636 0.06410928774 0.1261579878
ORIANNA 13 0.1111111111 0.05918159294 0.1108383782
ANIVIA 14 0.1111111111 0.03129912354 0.04153724967
FIORA 15 0.1076923077 0.04245156691 0.06497205726
KHA-ZIX 16 0.1058823529 0.04917058778 0.08325467346
SINGED 17 0.1027777778 0.02728978089 0.03567787553
TRYNDAMERE 18 0.09979633401 0.02348415136 0.02969794746
REK-SAI 19 0.09523809524 0.06871988644 0.1939077434
JARVAN-IV 20 0.09090909091 0.04412322921 0.07834657977
TALON 21 0.08450704225 0.03550617218 0.05739509477
IRELIA 22 0.08438818565 0.02909757023 0.0423561962
RAMMUS 23 0.0843373494 0.04288454022 0.07965976404
JAYCE 24 0.08421052632 0.03171308747 0.04819352141
JANNA 25 0.08316008316 0.02149690193 0.02810249116
RIVEN 26 0.08227114716 0.01653443314 0.02023694848
KALISTA 27 0.08108108108 0.05312101468 0.1319288439
KASSADIN 28 0.08108108108 0.05312101468 0.1319288439
KLED 29 0.07894736842 0.0422638629 0.08278198352
FIZZ 30 0.07894736842 0.03321198596 0.05397044569
RUMBLE 31 0.0780141844 0.03389651291 0.05628097579
EVELYNN 32 0.07751937984 0.02678004714 0.03917686682
CASSIOPEIA 33 0.07692307692 0.05041616285 0.1262906544
TWISTED-FATE 34 0.07446808511 0.03792996909 0.07134568192
KARTHUS 35 0.07246376812 0.0411164589 0.08621220606
JAX 36 0.0701754386 0.02652196482 0.04076629401
SHACO 37 0.06944444444 0.01803462731 0.0237397103
AKALI 38 0.06784660767 0.02221503378 0.03189974224
GANGPLANK 39 0.06443298969 0.02041233594 0.02895290043
GALIO 40 0.0625 0.05138094269 0.2207926837
DRAVEN 41 0.06162464986 0.0154014113 0.020093429
ELISE 42 0.06 0.03938540364 0.1021734337
TEEMO 43 0.05967450271 0.01687076741 0.02294629924
SHEN 44 0.0593220339 0.03029263859 0.05808131626
KINDRED 45 0.05882352941 0.03861725655 0.10042521
VEIGAR 46 0.05479452055 0.02677117999 0.04959930475
VEL-KOZ 47 0.05421686747 0.01965055354 0.02984893564
AATROX 48 0.05263157895 0.03457161085 0.09106619766
UDYR 49 0.05154639175 0.02933066833 0.06349869782
RENEKTON 50 0.05138339921 0.02111228283 0.03453227035
FIDDLESTICKS 51 0.05058365759 0.02078745972 0.03402520877
SKARNER 52 0.05 0.03617962285 0.1150417082
TARIC 53 0.05 0.02444971 0.04555204298
BLITZCRANK 54 0.04838709677 0.01884791975 0.02990391825
NOCTURNE 55 0.04807692308 0.02736918613 0.05956655138
XERATH 56 0.048 0.02581829682 0.05277237376
AHRI 57 0.04761904762 0.02329534513 0.04352172416
RYZE 58 0.046875 0.02521745111 0.05162375989
SION 59 0.046875 0.02202104919 0.0397979158
KAYLE 60 0.0462962963 0.02095782855 0.03681422832
SEJUANI 61 0.04545454545 0.03289969909 0.1058981698
ANNIE 62 0.04545454545 0.0181882452 0.02938740412
MASTER-YI 63 0.04545454545 0.01728501618 0.02709939324
SORAKA 64 0.04387990762 0.01561125405 0.0236335255
GNAR 65 0.04347826087 0.03147306728 0.1018469683
HEIMERDINGER 66 0.04347826087 0.01903019573 0.0326866588
LULU 67 0.04329004329 0.01960870772 0.03455066835
PANTHEON 68 0.04237288136 0.01919678035 0.03385662534
VLADIMIR 69 0.04210526316 0.02561175718 0.06120503817
LISSANDRA 70 0.04166666667 0.03427340131 0.1607555958
NUNU 71 0.03846153846 0.03163972948 0.1504702315
SYNDRA 72 0.03846153846 0.03163972948 0.1504702315
LEE-SIN 73 0.03773584906 0.02296524095 0.05529969278
POPPY 74 0.03738317757 0.02275151504 0.05481869533
SWAIN 75 0.03731343284 0.01692164376 0.02999879395
WUKONG 76 0.0367816092 0.01401665416 0.02212664086
KENNEN 77 0.03636363636 0.02213355578 0.05342449783
MALZAHAR 78 0.03636363636 0.02213355578 0.05342449783
DIANA 79 0.03535353535 0.01812488744 0.03581188416
ZAC 80 0.03465346535 0.01776801123 0.0351374375
CHO-GATH 81 0.03355704698 0.01914015326 0.04258779118
TWITCH 82 0.03355704698 0.01914015326 0.04258779118
MAOKAI 83 0.03333333333 0.02742489534 0.1333741806
ZILEAN 84 0.03300330033 0.01497977204 0.02667319641
HECARIM 85 0.0303030303 0.02493375821 0.1228875864
TAHM-KENCH 86 0.0303030303 0.01994457841 0.05503520086
CORKI 87 0.02941176471 0.02420099278 0.1197472575
SHYVANA 88 0.02884615385 0.01898814955 0.05255561546
MISS-FORTUNE 89 0.02857142857 0.01346866316 0.02482878681
AMUMU 90 0.02830188679 0.01863077815 0.05162511675
YORICK 91 0.02777777778 0.02012691631 0.06796580391
JHIN 92 0.02777777778 0.01585583158 0.03559117863
BRAND 93 0.02713178295 0.01392843003 0.02780376949
NASUS 94 0.02688172043 0.01534615471 0.03449402517
BARD 95 0.02659574468 0.01518346633 0.03414316837
SONA 96 0.02616516762 0.0075710332 0.01053846419
EKKO 97 0.02608695652 0.01407759625 0.02964868666
GRAVES 98 0.02469135802 0.01789391311 0.06093755395
VIKTOR 99 0.0243902439 0.02007182363 0.1015632262
QUINN 100 0.02395209581 0.01459922489 0.03600836211
THRESH 101 0.02151639344 0.007401003996 0.0111529219
NAMI 102 0.02080624187 0.007959442523 0.01272334431
ALISTAR 103 0.01973684211 0.01300231219 0.03667993033
LEONA 104 0.01946472019 0.007448633761 0.01191928365
XIN-ZHAO 105 0.01915708812 0.01094737104 0.0248968875
ZYRA 106 0.01893095768 0.00707839643 0.01117684306
KARMA 107 0.01826484018 0.01113976474 0.0277491751
VAYNE 108 0.01739130435 0.0126090522 0.04381007213
GAREN 109 0.015 0.009885854816 0.02816648056
DR-MUNDO 110 0.01470588235 0.01210526575 0.06400572126
VOLIBEAR 111 0.01449275362 0.009551973694 0.02724416193
MALPHITE 112 0.01307189542 0.00947983485 0.03333298359
EZREAL 113 0.0125 0.009065400844 0.03192626158
VARUS 114 0.01149425287 0.009462397449 0.05077923199
VI 115 0.01123595506 0.009249822963 0.04969798316
ILLAOI 116 0.01052631579 0.008665787426 0.04671377745
MORGANA 117 0.009538950715 0.00516009818 0.01111468513
JINX 118 0.008645533141 0.005701054612 0.01646139386
BRAUM 119 0.008547008547 0.006200021825 0.02207584684
CAITLYN 120 0.006756756757 0.005563056588 0.03052121355
NAUTILUS 121 0.005730659026 0.004157729224 0.01492054801
LUX 122 0.002364066194 0.001946639235 0.01090414574
CAMILLE 123 0 0 0.6576280471
AZIR 124 0 0 0.1245590371
SIVIR 125 0 0 0.1135170914
LEBLANC 126 0 0 0.1015179062
RENGAR 127 0 0 0.08380161251
ZIGGS 128 0 0 0.08201257002
TRUNDLE 129 0 0 0.07707617733
WARWICK 130 0 0 0.06314100878
LUCIAN 131 0 0 0.06017393048
TRISTANA 132 0 0 0.05273909414
KATARINA 133 0 0 0.03259969315
ASHE 134 0 0 0.03028659367
\end{filecontents}
\begin{document}
\begin{tikzpicture}
\sffamily
\begin{axis}[
xtick=data,% crucial line for the xticklabels directive
xticklabels from table={ntrick.dat}{CHAMP},
xticklabel style={rotate=90,font=\tiny},
xmin=-2,
xmax=137,
ymin=-0.02,
ymax=0.6,
height=480,
width=820
]
\draw
(axis cs:\pgfkeysvalueof{/pgfplots/xmin},0) --
(axis cs:\pgfkeysvalueof{/pgfplots/xmax},0);
\addplot [
only marks, mark=o,
error bars/.cd, y dir = minus, y explicit
]
table [
x=X,
y=Y,
y error=YL
] {ntrick.dat};
\addplot [
only marks, mark=o,
error bars/.cd, y dir = plus, y explicit
]
table [
x=X,
y=Y,
y error=YH
] {ntrick.dat};
\end{axis}
\end{tikzpicture}
\end{document}
답변1
여기서는 각 데이터 포인트의 색상을 변경하는 직접적인 질문에 대답하지 않지만 이것이 어떻게 가독성을 높여야 하는지에 대해서는 알 수 없습니다.
그러나기본가독성을 향상시키기 위해 두 가지 변형을 제안합니다. 첫째, 5개의 항목마다 수직선을 추가하여 항목을 그룹화하고 데이터 포인트를 따라갈 수 있는 안내선을 갖거나 두 번째로 그룹 내에서 방향 역할을 하는 동일한 목적을 가진 배경에 색상 사각형을 추가할 수 있습니다.
개인적으로 나는 두 번째 옵션을 선호하는데, 이는 순수한 수직선만큼 방해를 주지 않기 때문입니다. 이는 큰 오차 막대로 잘못 해석될 수 있으므로 아래에 표시된 것입니다.
작동 방식에 대한 자세한 내용은 코드의 주석을 살펴보시기 바랍니다.
% used PGFPlots v1.14
\begin{filecontents}{ntrick.dat}
CHAMP X Y YL YH
YASUO 1 0.4107142857 0.1190484959 0.1305120931
AURELION-SOL 2 0.2222222222 0.1161512673 0.1853507324
DARIUS 3 0.1941747573 0.06481265042 0.08680517491
KOG-MAW 4 0.1785714286 0.09978757028 0.1773464869
TALIYAH 5 0.1666666667 0.07971256627 0.1291143337
GRAGAS 6 0.156626506 0.06274727049 0.09312680322
ZED 7 0.1492537313 0.06611188926 0.1041524436
NIDALEE 8 0.1304347826 0.06026929692 0.09925036651
URGOT 9 0.1282051282 0.07217777872 0.1388553622
OLAF 10 0.12 0.05556701031 0.0925984252
MORDEKAISER 11 0.1194029851 0.04455530856 0.06576953551
IVERN 12 0.1136363636 0.06410928774 0.1261579878
ORIANNA 13 0.1111111111 0.05918159294 0.1108383782
ANIVIA 14 0.1111111111 0.03129912354 0.04153724967
FIORA 15 0.1076923077 0.04245156691 0.06497205726
KHA-ZIX 16 0.1058823529 0.04917058778 0.08325467346
SINGED 17 0.1027777778 0.02728978089 0.03567787553
TRYNDAMERE 18 0.09979633401 0.02348415136 0.02969794746
REK-SAI 19 0.09523809524 0.06871988644 0.1939077434
JARVAN-IV 20 0.09090909091 0.04412322921 0.07834657977
TALON 21 0.08450704225 0.03550617218 0.05739509477
IRELIA 22 0.08438818565 0.02909757023 0.0423561962
RAMMUS 23 0.0843373494 0.04288454022 0.07965976404
JAYCE 24 0.08421052632 0.03171308747 0.04819352141
JANNA 25 0.08316008316 0.02149690193 0.02810249116
RIVEN 26 0.08227114716 0.01653443314 0.02023694848
KALISTA 27 0.08108108108 0.05312101468 0.1319288439
KASSADIN 28 0.08108108108 0.05312101468 0.1319288439
KLED 29 0.07894736842 0.0422638629 0.08278198352
FIZZ 30 0.07894736842 0.03321198596 0.05397044569
RUMBLE 31 0.0780141844 0.03389651291 0.05628097579
EVELYNN 32 0.07751937984 0.02678004714 0.03917686682
CASSIOPEIA 33 0.07692307692 0.05041616285 0.1262906544
TWISTED-FATE 34 0.07446808511 0.03792996909 0.07134568192
KARTHUS 35 0.07246376812 0.0411164589 0.08621220606
JAX 36 0.0701754386 0.02652196482 0.04076629401
SHACO 37 0.06944444444 0.01803462731 0.0237397103
AKALI 38 0.06784660767 0.02221503378 0.03189974224
GANGPLANK 39 0.06443298969 0.02041233594 0.02895290043
GALIO 40 0.0625 0.05138094269 0.2207926837
DRAVEN 41 0.06162464986 0.0154014113 0.020093429
ELISE 42 0.06 0.03938540364 0.1021734337
TEEMO 43 0.05967450271 0.01687076741 0.02294629924
SHEN 44 0.0593220339 0.03029263859 0.05808131626
KINDRED 45 0.05882352941 0.03861725655 0.10042521
VEIGAR 46 0.05479452055 0.02677117999 0.04959930475
VEL-KOZ 47 0.05421686747 0.01965055354 0.02984893564
AATROX 48 0.05263157895 0.03457161085 0.09106619766
UDYR 49 0.05154639175 0.02933066833 0.06349869782
RENEKTON 50 0.05138339921 0.02111228283 0.03453227035
FIDDLESTICKS 51 0.05058365759 0.02078745972 0.03402520877
SKARNER 52 0.05 0.03617962285 0.1150417082
TARIC 53 0.05 0.02444971 0.04555204298
BLITZCRANK 54 0.04838709677 0.01884791975 0.02990391825
NOCTURNE 55 0.04807692308 0.02736918613 0.05956655138
XERATH 56 0.048 0.02581829682 0.05277237376
AHRI 57 0.04761904762 0.02329534513 0.04352172416
RYZE 58 0.046875 0.02521745111 0.05162375989
SION 59 0.046875 0.02202104919 0.0397979158
KAYLE 60 0.0462962963 0.02095782855 0.03681422832
SEJUANI 61 0.04545454545 0.03289969909 0.1058981698
ANNIE 62 0.04545454545 0.0181882452 0.02938740412
MASTER-YI 63 0.04545454545 0.01728501618 0.02709939324
SORAKA 64 0.04387990762 0.01561125405 0.0236335255
GNAR 65 0.04347826087 0.03147306728 0.1018469683
HEIMERDINGER 66 0.04347826087 0.01903019573 0.0326866588
LULU 67 0.04329004329 0.01960870772 0.03455066835
PANTHEON 68 0.04237288136 0.01919678035 0.03385662534
VLADIMIR 69 0.04210526316 0.02561175718 0.06120503817
LISSANDRA 70 0.04166666667 0.03427340131 0.1607555958
NUNU 71 0.03846153846 0.03163972948 0.1504702315
SYNDRA 72 0.03846153846 0.03163972948 0.1504702315
LEE-SIN 73 0.03773584906 0.02296524095 0.05529969278
POPPY 74 0.03738317757 0.02275151504 0.05481869533
SWAIN 75 0.03731343284 0.01692164376 0.02999879395
WUKONG 76 0.0367816092 0.01401665416 0.02212664086
KENNEN 77 0.03636363636 0.02213355578 0.05342449783
MALZAHAR 78 0.03636363636 0.02213355578 0.05342449783
DIANA 79 0.03535353535 0.01812488744 0.03581188416
ZAC 80 0.03465346535 0.01776801123 0.0351374375
CHO-GATH 81 0.03355704698 0.01914015326 0.04258779118
TWITCH 82 0.03355704698 0.01914015326 0.04258779118
MAOKAI 83 0.03333333333 0.02742489534 0.1333741806
ZILEAN 84 0.03300330033 0.01497977204 0.02667319641
HECARIM 85 0.0303030303 0.02493375821 0.1228875864
TAHM-KENCH 86 0.0303030303 0.01994457841 0.05503520086
CORKI 87 0.02941176471 0.02420099278 0.1197472575
SHYVANA 88 0.02884615385 0.01898814955 0.05255561546
MISS-FORTUNE 89 0.02857142857 0.01346866316 0.02482878681
AMUMU 90 0.02830188679 0.01863077815 0.05162511675
YORICK 91 0.02777777778 0.02012691631 0.06796580391
JHIN 92 0.02777777778 0.01585583158 0.03559117863
BRAND 93 0.02713178295 0.01392843003 0.02780376949
NASUS 94 0.02688172043 0.01534615471 0.03449402517
BARD 95 0.02659574468 0.01518346633 0.03414316837
SONA 96 0.02616516762 0.0075710332 0.01053846419
EKKO 97 0.02608695652 0.01407759625 0.02964868666
GRAVES 98 0.02469135802 0.01789391311 0.06093755395
VIKTOR 99 0.0243902439 0.02007182363 0.1015632262
QUINN 100 0.02395209581 0.01459922489 0.03600836211
THRESH 101 0.02151639344 0.007401003996 0.0111529219
NAMI 102 0.02080624187 0.007959442523 0.01272334431
ALISTAR 103 0.01973684211 0.01300231219 0.03667993033
LEONA 104 0.01946472019 0.007448633761 0.01191928365
XIN-ZHAO 105 0.01915708812 0.01094737104 0.0248968875
ZYRA 106 0.01893095768 0.00707839643 0.01117684306
KARMA 107 0.01826484018 0.01113976474 0.0277491751
VAYNE 108 0.01739130435 0.0126090522 0.04381007213
GAREN 109 0.015 0.009885854816 0.02816648056
DR-MUNDO 110 0.01470588235 0.01210526575 0.06400572126
VOLIBEAR 111 0.01449275362 0.009551973694 0.02724416193
MALPHITE 112 0.01307189542 0.00947983485 0.03333298359
EZREAL 113 0.0125 0.009065400844 0.03192626158
VARUS 114 0.01149425287 0.009462397449 0.05077923199
VI 115 0.01123595506 0.009249822963 0.04969798316
ILLAOI 116 0.01052631579 0.008665787426 0.04671377745
MORGANA 117 0.009538950715 0.00516009818 0.01111468513
JINX 118 0.008645533141 0.005701054612 0.01646139386
BRAUM 119 0.008547008547 0.006200021825 0.02207584684
CAITLYN 120 0.006756756757 0.005563056588 0.03052121355
NAUTILUS 121 0.005730659026 0.004157729224 0.01492054801
LUX 122 0.002364066194 0.001946639235 0.01090414574
CAMILLE 123 0 0 0.6576280471
AZIR 124 0 0 0.1245590371
SIVIR 125 0 0 0.1135170914
LEBLANC 126 0 0 0.1015179062
RENGAR 127 0 0 0.08380161251
ZIGGS 128 0 0 0.08201257002
TRUNDLE 129 0 0 0.07707617733
WARWICK 130 0 0 0.06314100878
LUCIAN 131 0 0 0.06017393048
TRISTANA 132 0 0 0.05273909414
KATARINA 133 0 0 0.03259969315
ASHE 134 0 0 0.03028659367
\end{filecontents}
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
% use this `compat' level or higher so you don't need to prefix every
% TikZ coordinate with `axis cs:'
\pgfplotsset{compat=1.11}
% declare the layer background on which later on the rectangles will be placed
% and set the order of the layers
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\begin{document}
\begin{tikzpicture}
\sffamily
\begin{axis}[
height=480,
width=820,
% I wouldn't use these explicitly here, because if the number of data
% points changes you have to adjust them ...
% xmin=-2,
% xmax=137,
ymin=-0.02,
ymax=0.6,
% ... Insted use `enlarge x limits'.
enlarge x limits={abs=1},
xtick=data,% crucial line for the xticklabels directive
xticklabels from table={ntrick.dat}{CHAMP},
xticklabel style={rotate=90,font=\tiny},
% to avoid the nasty "5 \cdot 10^-2".
yticklabel style={
/pgf/number format/fixed,
},
% % ---------------------------------------------------------------------
% % one possibility would be to add some "guide lines" only to easier see
% % to which xtick which data point belongs
% extra x ticks={5,10,...,150},
% extra x ticks={5.5,10.5,...,150.5},
% extra x tick labels={},
% extra x tick style={
% grid=major,
% major tick length=0pt,
% },
% % ---------------------------------------------------------------------
% I realized your zero line with the help of the `extra y ticks' feature
extra y ticks={0},
extra y tick labels={},
extra y tick style={
grid=major,
major tick length=0pt,
},
only marks,
]
% ---------------------------------------------------------------------
% my prefered solution is to place filled rectangles in the background
% each 5 entries to guide the reader to which xtick which data point
% belongs.
%
% We place the rectangles on the previously defined background layer,
% so they are also placed behind the axis and thus the `xtick's.
% (Using the `axis on top' feature would also be an option, but that
% would cause the created `extra y ticks' line to be on top of the
% data points as well which most probably is not desired.)
\begin{pgfonlayer}{background}
% I suggest to group data points in steps of 5, so we have to draw
% colored rectangles each 10 entries with a width of 5.
% I think it is a matter of taste if the rectangles should be placed
% *on* the data points or *between* the data points. Here I have
% chosen the later one.
\pgfplotsinvokeforeach {5.5,15.5,...,135.5} {
\fill [black!5] (#1,\pgfkeysvalueof{/pgfplots/ymin})
rectangle (#1+5,\pgfkeysvalueof{/pgfplots/ymax});
}
\end{pgfonlayer}
% ---------------------------------------------------------------------
% you can draw both error bars in one call
\addplot [
% because I don't like it that you see the error bar line "through"
% the data point I changed the mark to the corresponding one that
% can be filled and filled it white
mark=*,
fill=white,
error bars/.cd,
y dir = both,
y explicit,
] table [
x=X,
y=Y,
y error minus=YL,
y error plus =YH,
] {ntrick.dat};
\end{axis}
\end{tikzpicture}
\end{document}
답변2
적어도 내가 매뉴얼을 이해하는 한 의 cycle list name
메커니즘 의 문제점은 사이클 목록 요소가 및 친구에 의해 증가되는 현재 플롯 번호를 기반으로 선택된다는 것입니다. 따라서 축에 단일 요소만 있는 경우 사이클 목록의 다음 요소는 선택되지 않습니다.pgfplots
\addplot
\addplot
나는 가까스로 아이디어를 생각해 냈어부분적인해결책. 그러나 몇 가지 단점이 있습니다.
- 느립니다. 어떤 사람들은 이렇게 말할 수도 있습니다.매우느립니다(원래 코드의 컴파일 시간은 약 2초인 반면 내 컴퓨터에서는 컴파일 시간이 거의 30초입니다). 이는 각 플롯 주기 동안 전체 테이블이 처리되기 때문입니다.하나 빼고 다폐기할 요소. 다소 우아하지 않다는 점을 인정해야 합니다. 누군가가 덜 투박한 변형을 생각해 낼 수 있다면 나는 그것에 매우 관심을 가질 것입니다.
- 눈금 레이블 스타일을 순환하지 않습니다. 나는
pgfplots
매뉴얼을 샅샅이 뒤지고 눈금 라벨과 기호 좌표를 모두 만지작거렸지만 안타깝게도 일이 내가 원하는 대로 되지 않았습니다. 눈금 레이블이 전체에 대해 설정되어axis
순환이 없기 때문에 이는 의미가 있습니다. 실행 가능한 해결책을 찾으면 업데이트를 게시하겠습니다. 이것이 있으면 정말 좋을 것이기 때문에 거기에 동의합니다.
실제 솔루션 이전의 마지막 작업: x filter/.code
타악기에 대한 스니펫에 대한 크레딧입니다.이 답변, 그리고 오류 바코드 조각에 대해서는 Stefan Pinnow에게 보내주십시오.그의 대답은 여기에 있다.
어쨌든 코드는 다음과 같습니다.
\documentclass[tikz]{standalone}
\usepackage{pgfplots,filecontents,pgfplotstable}
\pgfplotsset{compat=newest}
\begin{filecontents}{ntrick.dat}
CHAMP X Y YL YH
YASUO 1 0.4107142857 0.1190484959 0.1305120931
AURELION-SOL 2 0.2222222222 0.1161512673 0.1853507324
DARIUS 3 0.1941747573 0.06481265042 0.08680517491
KOG-MAW 4 0.1785714286 0.09978757028 0.1773464869
TALIYAH 5 0.1666666667 0.07971256627 0.1291143337
GRAGAS 6 0.156626506 0.06274727049 0.09312680322
ZED 7 0.1492537313 0.06611188926 0.1041524436
NIDALEE 8 0.1304347826 0.06026929692 0.09925036651
URGOT 9 0.1282051282 0.07217777872 0.1388553622
OLAF 10 0.12 0.05556701031 0.0925984252
MORDEKAISER 11 0.1194029851 0.04455530856 0.06576953551
IVERN 12 0.1136363636 0.06410928774 0.1261579878
ORIANNA 13 0.1111111111 0.05918159294 0.1108383782
ANIVIA 14 0.1111111111 0.03129912354 0.04153724967
FIORA 15 0.1076923077 0.04245156691 0.06497205726
KHA-ZIX 16 0.1058823529 0.04917058778 0.08325467346
SINGED 17 0.1027777778 0.02728978089 0.03567787553
TRYNDAMERE 18 0.09979633401 0.02348415136 0.02969794746
REK-SAI 19 0.09523809524 0.06871988644 0.1939077434
JARVAN-IV 20 0.09090909091 0.04412322921 0.07834657977
TALON 21 0.08450704225 0.03550617218 0.05739509477
IRELIA 22 0.08438818565 0.02909757023 0.0423561962
RAMMUS 23 0.0843373494 0.04288454022 0.07965976404
JAYCE 24 0.08421052632 0.03171308747 0.04819352141
JANNA 25 0.08316008316 0.02149690193 0.02810249116
RIVEN 26 0.08227114716 0.01653443314 0.02023694848
KALISTA 27 0.08108108108 0.05312101468 0.1319288439
KASSADIN 28 0.08108108108 0.05312101468 0.1319288439
KLED 29 0.07894736842 0.0422638629 0.08278198352
FIZZ 30 0.07894736842 0.03321198596 0.05397044569
RUMBLE 31 0.0780141844 0.03389651291 0.05628097579
EVELYNN 32 0.07751937984 0.02678004714 0.03917686682
CASSIOPEIA 33 0.07692307692 0.05041616285 0.1262906544
TWISTED-FATE 34 0.07446808511 0.03792996909 0.07134568192
KARTHUS 35 0.07246376812 0.0411164589 0.08621220606
JAX 36 0.0701754386 0.02652196482 0.04076629401
SHACO 37 0.06944444444 0.01803462731 0.0237397103
AKALI 38 0.06784660767 0.02221503378 0.03189974224
GANGPLANK 39 0.06443298969 0.02041233594 0.02895290043
GALIO 40 0.0625 0.05138094269 0.2207926837
DRAVEN 41 0.06162464986 0.0154014113 0.020093429
ELISE 42 0.06 0.03938540364 0.1021734337
TEEMO 43 0.05967450271 0.01687076741 0.02294629924
SHEN 44 0.0593220339 0.03029263859 0.05808131626
KINDRED 45 0.05882352941 0.03861725655 0.10042521
VEIGAR 46 0.05479452055 0.02677117999 0.04959930475
VEL-KOZ 47 0.05421686747 0.01965055354 0.02984893564
AATROX 48 0.05263157895 0.03457161085 0.09106619766
UDYR 49 0.05154639175 0.02933066833 0.06349869782
RENEKTON 50 0.05138339921 0.02111228283 0.03453227035
FIDDLESTICKS 51 0.05058365759 0.02078745972 0.03402520877
SKARNER 52 0.05 0.03617962285 0.1150417082
TARIC 53 0.05 0.02444971 0.04555204298
BLITZCRANK 54 0.04838709677 0.01884791975 0.02990391825
NOCTURNE 55 0.04807692308 0.02736918613 0.05956655138
XERATH 56 0.048 0.02581829682 0.05277237376
AHRI 57 0.04761904762 0.02329534513 0.04352172416
RYZE 58 0.046875 0.02521745111 0.05162375989
SION 59 0.046875 0.02202104919 0.0397979158
KAYLE 60 0.0462962963 0.02095782855 0.03681422832
SEJUANI 61 0.04545454545 0.03289969909 0.1058981698
ANNIE 62 0.04545454545 0.0181882452 0.02938740412
MASTER-YI 63 0.04545454545 0.01728501618 0.02709939324
SORAKA 64 0.04387990762 0.01561125405 0.0236335255
GNAR 65 0.04347826087 0.03147306728 0.1018469683
HEIMERDINGER 66 0.04347826087 0.01903019573 0.0326866588
LULU 67 0.04329004329 0.01960870772 0.03455066835
PANTHEON 68 0.04237288136 0.01919678035 0.03385662534
VLADIMIR 69 0.04210526316 0.02561175718 0.06120503817
LISSANDRA 70 0.04166666667 0.03427340131 0.1607555958
NUNU 71 0.03846153846 0.03163972948 0.1504702315
SYNDRA 72 0.03846153846 0.03163972948 0.1504702315
LEE-SIN 73 0.03773584906 0.02296524095 0.05529969278
POPPY 74 0.03738317757 0.02275151504 0.05481869533
SWAIN 75 0.03731343284 0.01692164376 0.02999879395
WUKONG 76 0.0367816092 0.01401665416 0.02212664086
KENNEN 77 0.03636363636 0.02213355578 0.05342449783
MALZAHAR 78 0.03636363636 0.02213355578 0.05342449783
DIANA 79 0.03535353535 0.01812488744 0.03581188416
ZAC 80 0.03465346535 0.01776801123 0.0351374375
CHO-GATH 81 0.03355704698 0.01914015326 0.04258779118
TWITCH 82 0.03355704698 0.01914015326 0.04258779118
MAOKAI 83 0.03333333333 0.02742489534 0.1333741806
ZILEAN 84 0.03300330033 0.01497977204 0.02667319641
HECARIM 85 0.0303030303 0.02493375821 0.1228875864
TAHM-KENCH 86 0.0303030303 0.01994457841 0.05503520086
CORKI 87 0.02941176471 0.02420099278 0.1197472575
SHYVANA 88 0.02884615385 0.01898814955 0.05255561546
MISS-FORTUNE 89 0.02857142857 0.01346866316 0.02482878681
AMUMU 90 0.02830188679 0.01863077815 0.05162511675
YORICK 91 0.02777777778 0.02012691631 0.06796580391
JHIN 92 0.02777777778 0.01585583158 0.03559117863
BRAND 93 0.02713178295 0.01392843003 0.02780376949
NASUS 94 0.02688172043 0.01534615471 0.03449402517
BARD 95 0.02659574468 0.01518346633 0.03414316837
SONA 96 0.02616516762 0.0075710332 0.01053846419
EKKO 97 0.02608695652 0.01407759625 0.02964868666
GRAVES 98 0.02469135802 0.01789391311 0.06093755395
VIKTOR 99 0.0243902439 0.02007182363 0.1015632262
QUINN 100 0.02395209581 0.01459922489 0.03600836211
THRESH 101 0.02151639344 0.007401003996 0.0111529219
NAMI 102 0.02080624187 0.007959442523 0.01272334431
ALISTAR 103 0.01973684211 0.01300231219 0.03667993033
LEONA 104 0.01946472019 0.007448633761 0.01191928365
XIN-ZHAO 105 0.01915708812 0.01094737104 0.0248968875
ZYRA 106 0.01893095768 0.00707839643 0.01117684306
KARMA 107 0.01826484018 0.01113976474 0.0277491751
VAYNE 108 0.01739130435 0.0126090522 0.04381007213
GAREN 109 0.015 0.009885854816 0.02816648056
DR-MUNDO 110 0.01470588235 0.01210526575 0.06400572126
VOLIBEAR 111 0.01449275362 0.009551973694 0.02724416193
MALPHITE 112 0.01307189542 0.00947983485 0.03333298359
EZREAL 113 0.0125 0.009065400844 0.03192626158
VARUS 114 0.01149425287 0.009462397449 0.05077923199
VI 115 0.01123595506 0.009249822963 0.04969798316
ILLAOI 116 0.01052631579 0.008665787426 0.04671377745
MORGANA 117 0.009538950715 0.00516009818 0.01111468513
JINX 118 0.008645533141 0.005701054612 0.01646139386
BRAUM 119 0.008547008547 0.006200021825 0.02207584684
CAITLYN 120 0.006756756757 0.005563056588 0.03052121355
NAUTILUS 121 0.005730659026 0.004157729224 0.01492054801
LUX 122 0.002364066194 0.001946639235 0.01090414574
CAMILLE 123 0 0 0.6576280471
AZIR 124 0 0 0.1245590371
SIVIR 125 0 0 0.1135170914
LEBLANC 126 0 0 0.1015179062
RENGAR 127 0 0 0.08380161251
ZIGGS 128 0 0 0.08201257002
TRUNDLE 129 0 0 0.07707617733
WARWICK 130 0 0 0.06314100878
LUCIAN 131 0 0 0.06017393048
TRISTANA 132 0 0 0.05273909414
KATARINA 133 0 0 0.03259969315
ASHE 134 0 0 0.03028659367
\end{filecontents}
\begin{document}
\pgfplotstableread{ntrick.dat}{\champs}
\pgfplotstablegetrowsof{\champs}
\pgfmathsetmacro\totRows{\pgfmathresult}
\begin{tikzpicture}
\sffamily
\begin{axis}[
xtick=data,% crucial line for the xticklabels directive
xticklabels from table={\champs}{CHAMP},
xticklabel style={rotate=90,font=\tiny},
xmin=-2,
xmax=137,
ymin=-0.02,
ymax=0.6,
height=480,
width=820,
unbounded coords=discard,
filter discard warning=false,
cycle list name=color,
]
\draw
(axis cs:\pgfkeysvalueof{/pgfplots/xmin},0) --
(axis cs:\pgfkeysvalueof{/pgfplots/xmax},0);
%Need this so that all xaxis tick labels are printed.
\addplot [
white,
only marks, mark=o,
]
table [
x=X,
y=Y,
] {\champs};
\foreach \row in {1,...,\totRows} {%
\addplot+ [
x filter/.code={\pgfplotstablegetelem{\coordindex}{X}\of{\champs}
\ifnum\pgfplotsretval=\row,
\else
\def\pgfmathresult{}
\fi
},
only marks, mark=o,
error bars/.cd, y dir = both, y explicit
]
table [
x=X,
y=Y,
y error plus expr=\thisrow{YH},
y error minus expr=\thisrow{YL},
] {\champs};
}
\end{axis}
\end{tikzpicture}
\end{document}
결과: