[pstricks] How to use a csv-file for draw a piechart with package pstricks-add

Herbert Voss Herbert.Voss at fu-berlin.de
Sun Nov 20 22:05:38 CET 2022



Am 20.11.22 um 18:47 schrieb José Jesús Rosell Escolar:
> Hello every one
> I usually use the packages pst-plot  for plotting bar diagram from a csv file.
> In this moment I really want to plot a piechart, and the package pstricks-add has the command \psChart, but it is necessary to write the values by hand.
> My question is: is it possible to use a csv file for drawing a piechart within the command \psChart?

The latest version of pst-plot (http://hvoss.org/pst-plot.tex)
knows the key outDelimiter toi definie the delimiter _after_ reading the
csv data. It is by defafult \space, but \psChart expects a comma.
I'll upload this version tomorrow to CTAN.


\begin{filecontents}[force]{Datitos.csv}
%Dato Frecuencia
1,4
2,7
3,5
4,1
5,4
6,6
\end{filecontents}

\documentclass{article}
\usepackage{pst-plot}

\begin{document}
\psreadDataColumn[ignoreLines=1,outDelimiter={,\space}]{2}{,}{\dada}{Datitos.csv}

\begin{pspicture}(-4,-4)(4,4)
     \expandafter\psChart\expandafter{\dada}{}{4}
\end{pspicture}
\end{document}

Herbert

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirm?foto 2022-11-20 um 22.04.00.png
Type: image/png
Size: 21850 bytes
Desc: not available
URL: <https://tug.org/pipermail/pstricks/attachments/20221120/873184c5/attachment-0001.png>


More information about the PSTricks mailing list.