y 欄上的跳躍標記中點在 x 刻度處開始和結束,並且僅覆蓋第一個和最後一個欄的一半

y 欄上的跳躍標記中點在 x 刻度處開始和結束,並且僅覆蓋第一個和最後一個欄的一半

我在圖形上遇到這個問題,我需要完全這樣做,但是跳躍標記中間從刻度開始,我希望它像其他條一樣覆蓋整個條。我能想到的唯一解決方案是添加第一個和最後一個空條,但我仍然不知道如何使節點和條不可見。

\begin{tikzpicture}
\begin{axis}[width=\textwidth,height=10cm,
legend entries={Nord, Sud, Est, Ovest, Media},
%ylabel={\%},
symbolic x coords={Alimentari,Gastronomie,Macellerie,Discount,Ipermercati,Supermercati~grandi,Supermercati~piccoli,Ingrossi,Altro},
every node near coord/.style={font=\large },
every node near coord/.append style={yshift=1mm,
/pgf/number format/fixed,
/pgf/number format/precision=1
},
x tick label style={rotate=45,anchor=east},
ymin=-1,
xtick pos=left,
ytick pos=left
]
\addplot[jump mark mid, blue, very thick, line legend] table[x={esercizio}, y={Nord}] {scostamentotipoes.dat};
\addplot[jump mark mid,red, very thick, line legend] table[x={esercizio}, y={Sud}] {scostamentotipoes.dat};
\addplot[jump mark mid,green, very thick, line legend] table[x={esercizio}, y={Est}] {scostamentotipoes.dat};
\addplot[jump mark mid,yellow, very thick, line legend] table[x={esercizio}, y={Ovest}] {scostamentotipoes.dat};
\addplot[ybar,bar width=30, black, very thick, area legend, nodes near coords={\pgfmathprintnumber\pgfplotspointmeta\%}] table[x={esercizio}, y={Media}] {scostamentotipoes.dat};
\end{axis}
\end{tikzpicture}

如果你能幫助我,我將不勝感激。不過我對 pgf 不是很專家... 圖形影像 謝謝

這是一個簡單的例子:

\documentclass{article}
\usepackage{graphicx}
\usepackage{pgfplots}

\begin{document}

\begin{figure}
\begin{tikzpicture}
\begin{axis}[
legend entries={subset, mean},
symbolic x coords={A,B,C},
xtick pos=left,
ytick pos=left,
ymin=0,
]
\addplot[
jump mark mid,
blue, very thick, line legend] coordinates{(A,1) (B,2) (C,1.5)};
\addplot[ybar,bar width=30, black, very thick, area legend, nodes near coords={\pgfmathprintnumber\pgfplotspointmeta\%}] coordinates{(A,2) (B,3) (C,1)};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}

不管怎樣,我自己找到了解決方案(我猜我只是累了......)通過用簡單的線標記替換“jump mark mid”

only marks, mark=-, mark size=16,

答案1

只是為了關閉帖子..對我有用的明顯解決方案是使用簡單的線條標記而不是中間的跳躍標記。替換

jump mark mid,

only marks, mark=-, mark size=16,

相關內容