%EA%B0%80%20%EA%B2%B9%EC%B9%98%EB%82%98%EC%9A%94%3F.png)
다음 MWE를 고려하십시오.
\documentclass[%
12pt,
journal,
twoside,
draftcls,
letterpaper,
]{IEEEtran}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{tikz}
\usetikzlibrary{intersections} %% named intersections "I do not know the key '/tikz/name path global'"
\begin{document}
\pgfplotstableread[col sep=&,row sep=\\]{
0.0159779999812599 & 0.00398599999607541 \\
0.0240009999834001 & 0.00802300000214018 \\
0.0240489999996498 & 4.80000162497163e-05 \\
0.0280280000006314 & 0.00397900000098161 \\
}\mytable
\begin{tikzpicture}
\begin{scope}
\begin{axis}[
title={\small my data},
title style={at={(0.5,0.9)},anchor=center},
clip=true,
axis x line=middle,
axis y line=middle,
y axis line style=-,
xmin = 2e-3,
xmax = 38e-3,
ymin = 0,
ymax = 1.5,
xlabel={$t$\,[ms]},
xlabel style={at={(axis description cs:1.01,+0.0)},anchor=west},
ylabel={}, %{$U$\,[V]},
ylabel style={at={(axis description cs:-0.02,1.01)},anchor=south},
xtick=data,
scaled x ticks=base 10:3,
xtick scale label code/.code={},
x tick label style={
rotate=-45,
anchor=west,
/pgf/number format/fixed,
/pgf/number format/fixed zerofill,
/pgf/number format/precision=3,
},
ymajorticks=false,
yminorticks=false,
tick label style={font=\small,},
legend cell align=left,
legend pos=outer north east,
]
\addplot[
name path global=afunc,
ycomb,
draw=black,
% opacity=0.2, % global
mark=*, mark options={
draw=black,
fill=black,
opacity=0.2, % on mark
},
line width=2pt,
]
table[x index = 0,y expr=1] \mytable ;
\end{axis}
\end{scope}
\end{tikzpicture}
\end{document}
코드를 있는 그대로 사용하면 evince
PDF가 다음과 같이 렌더링됩니다(전체 크기 img를 보려면 클릭).
"% 전역" 불투명도가 활성화되면 PDF는 다음과 같이 렌더링됩니다.
... 그러나 내가 원하는 것은 "충동"이 투명하여 겹쳐질 때 더 강렬한 색상을 얻는 것입니다. 위 이미지 중 어느 것도 다음을 보여주지 않습니다. 글로벌 이미지는 글로벌이고 "로컬" " 마크 스타일에 적용된 것이 무시된 것 같나요?
또한, 충동의 표시(원)를 완전히 채울 수 있는 방법이 있나요? (전체 크기의 사진을 자세히 보면 안에 구멍이 있는 것처럼 보입니다)
내가 원하는 것을 달성할 수 있는 방법이 있나요? 로그 파일은 다음과 같이 말합니다.
패키지: pgfplots 2011/12/29 v1.5.1 (git show 1.5.1-4-g53e640f)
답변1
글쎄, 나는 일종의 작업 방법을 얻었습니다. 먼저 ybar
스타일을 시도했는데 비슷한 종류입니다. 그러나 개별 막대/선이 아닌 그래프 전체의 불투명도/투명도도 적용되는 것 같습니다.
그래서 나는 테이블 데이터를 반복하면서 불투명하게 개별 선을 그려 보았습니다. 마침내 효과가 있었던 것 같습니다. 위 MWE의 관련 변경 사항은 다음과 같습니다.
...
\usepackage{pgfplotstable}
...
]
\def\opac{0.4}
\addplot[
name path global=afunc,
only marks, %ycomb,
draw=none, %black,
%opacity=\opac, % global
mark=*, mark options={
draw=none, %black,
%fill=black,
opacity=\opac, % on mark; both stroke and fill (and stroke will overlap fill - twice the opacity!? even with draw=none?)
},
%line width=2pt, % also changes the line around the mark!
]
table[x index = 0,y expr=1] \mytable ;
% \addplot[
% name path global=afuncb,
% ybar,
% bar width=2pt,
% %fill=black,
% %draw=none,
% opacity=0.4,
% ]
% table[x index = 0,y expr=1] \mytable ;
\pgfplotstableforeachcolumnelement{0}\of\mytable\as\cx{%
% \node{I have now cell element ‘\cx’ at row index ‘\pgfplotstablerow’;\par};
\edef\temp{ %
\noexpand\draw[%
line width=2pt, %semithick,
draw=black,%
fill=none,%
opacity=\opac,%
] ({axis cs:\cx,0}) -- ({axis cs:\cx,1}); %
}
\temp
}
\end{axis}
...
... 출력은 다음과 같습니다.
오버레이된 색상을 시각적으로 더 쉽게 비교할 수 있도록 "표시만" 스타일을 그대로 두었습니다. 지금 나를 괴롭히는 유일한 것은 원형 표시 주변에 눈에 보이는 선이 있다는 것입니다. 그러나 그것은 별 문제가 아닙니다.