圆柱形条形图

圆柱形条形图

我知道这可能不太可能,但有人知道(或告诉我从哪里开始)如何绘制此图表吗?假设我们有 6 个值(5、10、15、20、25、30),每列一个。

在此处输入图片描述

提前致谢!

答案1

对于实际的图表,如果您打算传达一些有关数据的有用信息,您不会(或不应该)希望它看起来像这样。但作为练习,以下内容虽然有点笨拙,但却是朝着正确方向迈出的第一步:

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{shadows,fadings}
\tikzset{pics/.cd,
  cylinder/.style 2 args={%
code={
\colorlet{cylinder color}{#2}
\edef\ch{#1}
\foreach \i in {-1,1}{
\begin{scope}[yscale=\i]
\ifnum \i=1
\path [circular glow={fill=black, opacity=0.25}]
  ellipse [x radius=1, y radius=1/2];
\else
\def\ch{2}
\fi
\begin{scope}    
\clip [preaction={left color=cylinder color, right color=cylinder color!25!black}] (1,0) arc (360:180:1 and 1/2) -- ++(0,\ch) arc (180:0:1 and 1/3) -- cycle;
\fill [white, opacity=0.25, path fading=east]
   (0.75,-1) rectangle (1,\ch+1);
\fill [white, opacity=0.25, path fading=west]
   (0.75,-1) rectangle (0.25,\ch+1);
\fill [white, opacity=0.25, path fading=west]
   (-0.5,-1) rectangle (-0.875,\ch+1);
\fill [white, opacity=0.25, path fading=east]
   (-0.5,-1) rectangle (-0.125,\ch+1);
\end{scope}
\ifnum\i<0\relax
\fill [white, opacity=0.25]
 (-1,0) rectangle (1,\ch+1/2);
\fill [white, path fading=north]
 (-1,0) rectangle (1,\ch+1/2);
\else
\shade [left color=cylinder color, right color=cylinder color!25!black,
postaction={fill=white,opacity=0.25, path fading=north}] (0,\ch) ellipse [x radius=1, y radius=1/3];
\fi
\end{scope}
}}}}
\begin{document}
\begin{tikzpicture}
\foreach \y/\c [count=\i from 1]
in {6/blue,5/cyan,4/green,3/yellow,2/orange,1/red}
\path (\i*60-15:5 and 1) pic {cylinder={\y}{\c}};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容