I am trying to create a wheel chart and it displays almost fine but i still have an error:

Package tikz Error: Cannot parse this coordinate.

‪main.tex, 32‬ See the tikz package documentation for explanation. Type H for immediate help. ...
l.32 }

This error message was generated by an \errmessage command, so I can't give any explicit help. Pretend that you're Hercule Poirot: Examine all clues, and deduce the truth by order and method.

i am running this code:

        12/green/state 1,
        1/red/state 2,
        1/yellow/state 3,
        1/gray/state 4

with this macro to generate the wheel chart:



% The main macro
  % Calculate total
  \foreach \value/\colour/\name in {#1} {
  % \begin{tikzpicture}[every node/.style={scale=1.4}]
    % Calculate the thickness and the middle line of the wheel
    % Rotate so we start from the top
    % add coordinate to define the upper left starting point of the legend entries
    \coordinate (L-0) at (\outerradius-3mm,-\outerradius-2.5cm);
    % Loop through each value set. \cumnum keeps track of where we are in the wheel
    \foreach [count=\i,remember=\i as \j (initially 0)] \value/\colour/\name in {#1} {
          \pgfmathsetmacro{\newcumnum}{\cumnum + \value/\totalnum*360}
          % Calculate the percent value
          % \pgfmathsetmacro{\percentage}{\value/\totalnum*100}
          % Calculate the mid angle of the colour segments to place the labels
          % This is necessary for the labels to align nicely
          } \edef\textanchor{\pgfmathresult}
          % Draw the color segments. Somehow, the \midrow units got lost, so we add 'pt' at the end. Not nice...
          \fill[\colour] (-\cumnum:\outerradius) arc (-\cumnum:-(\newcumnum):\outerradius) --
          (-\newcumnum:\innerradius) arc (-\newcumnum:-(\cumnum):\innerradius) -- cycle;
          % Draw the data labels
          \draw  [Circle-,thin] node [
            append after command={
              (\midangle:\midradius pt) -- (\midangle:\outerradius + 1ex) -- (\tikzlastnode)
          ] at (\midangle:\outerradius + 1ex) [shift=\labelshiftdir*0.5cm,inner sep=1pt, outer sep=1pt, ,anchor=\textanchor]{\pgfmathprintnumber{\percentage}};
          % add legend node
          \node [anchor=north west,text width=5cm,font=\footnotesize] (L-\i) at (L-\j.south west) {\textcolor{\colour}{\faPlug} \value \\ \name};

          % Set the old cumulated angle to the new value

Here is the chart it generates:

wheel chart generated by this code

  • 3
    Welcome. shift=\labelshiftdir*0.5cm is your mistake. The shift key expects a coordinate, e.g. shift=(\midangle:\labelshiftdir*0.5cm)? By the way, there are the pgf-pie and the wheelchart packages. May 19, 2023 at 16:07
  • Thank you, it worked with this
    – Balansoire
    May 22, 2023 at 8:34

1 Answer 1


Do you know the wheelchart package?


\textcolor{#1}{\faPlug}\ #2\\#3

    data style={text=gray},
    legend entry={
        \node[anchor=west] at (3.5,0) {%
    lines sep=-0.5,
    lines style={
            mark=at position 0 with {
                \fill[gray!30] (0,0) circle[radius=2pt];
    12/green/{state 1},
    1/red/{state 2},
    1/yellow/{state 3},
    1/gray/{state 4}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .