TeX - LaTeX Asked by CharlesAntoine on February 19, 2021
I am trying to fill a radar plot (also called spiderweb) with a shading fill, just like what can be seen with the colorbar feature in 3Dplot.
The radar plot assesses 3 dimensions, that are rated from 0 to 5 (0= none, 1= very bad, … 5= very good) ; and 5 color have also been defined, corresponding to each of theses ratings.
I would like to color the inside of the shape depending on the distance of each point from the origin using the grading color scale with a shade for colors transitions.
Is this feasible with the colorbar function or any or function of TikZ?
The code of the radar plot and color:
documentclass{report}
usepackage[utf8]{inputenc}
usepackage[french]{babel}
usepackage{color}
usepackage{tikz}
usepackage{pgfplots}
definecolor{green-dark}{rgb}{0,0.2,0}
definecolor{very-good}{RGB}{25,125,90}
definecolor{good}{RGB}{90,170,130}
definecolor{neutral}{RGB}{240,170,50}
definecolor{bad}{RGB}{180,120,110}
definecolor{very-bad}{RGB}{160,50,40}
begin{document}
%% Spider chart
%% ------------
newcommand{axisrated}{3} % dimensions
newcommand{scale}{5} % rating scale for each dimension
newdimenINsize
INsize=3.5cm
newdimenOUTsize
OUTsize=4.5cm
% Angle between rated dimensions
newcommand{Aradar}{360/axisrated}
begin{tikzpicture}
% Draw the spider web
foreach Xradar in {1,...,axisrated}{
draw (Xradar*Aradar:0) -- (Xradar*Aradar:INsize);
}
foreach Yradar in {0,...,scale}{
% Axis
foreach Xradar in {1,...,axisrated}{
path (Xradar*Aradar:Yradar*INsize/scale) coordinate (PXradar-Yradar);
fill (PXradar-Yradar) circle (1pt);
};
% Grid
draw [opacity=0.2] (0:Yradar*INsize/scale)
foreach Xradar in {1,...,axisrated}{
-- (Xradar * Aradar : Yradar*INsize/scale)
} -- cycle;
% Axis labels
path (1*Aradar:OUTsize) node (L1) {Axis 1};
path (2*Aradar:OUTsize) node (L2) {Axis 2};
path (3*Aradar:OUTsize) node (L3) {Axis 3};
}
% Draw the result
draw [color=green-dark,line width=1.5pt,opacity=0.7]
(P1-1) --
(P2-5) --
(P3-3) -- cycle;
end{tikzpicture}
end{document}
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP