answerstu

pgfplotstable - Applying and doing math on two functions read from a file using pgf - TeX

I'm trying to read two functions of x from a file, and then get the result of f(8) / g(8) using pgfmathparse.Here is a minimal (not) working example: \begin{filecontents}{data.dat}f(x) g(x)x x+1\end{filecontents}\documentclass{article}\usepackage{xstring,pgfplotstable,filecontents}\begin{document}\newcommand{\getfx}[1]{ \pgfplotstablegetelem{#1}{f(x)}\of{data.dat}}\newcommand{\getgx}[1]{ \pgfplotstablegetelem{#1}{g(x)}\of{data.dat}}\def\feight{ \getfx{0} \StrSubstitute[0]{\pgfplotsretval}{x}{8}}\def\geight{ \getgx{0} \StrSubstitute[0]{...Read more

pgfplotstable: two columns into one but removing text (keeping numbers) from new column - TeX

Question: This is a followup up to pgfplotstable: Two columns into one with numeric data, but can't round. Except this time, I have some text throughout the mean and sd column and would like to remove it before the \pgfmathprintnumber outputs the new column. I have tried including a string replace* throughout various places in the code, but none seems to work. How do I get \pgfmathprintnumber to not scan the text and print the 'NaN (NaN)'?\documentclass{standalone}\usepackage{pgfplotstable}\begin{document}\pgfplotstableread[row sep=\\,col s...Read more

pgfplotstable - Issue with "string type" format column in pgfplottable - TeX

Using pgfplotstable library to define a table from a data file containing numeric and alphanumeric values, I get this error "! Package PGF Math Error: Could not parse input 'B' as a floating point number, "while compiling this short MWE example .. don't understand what's wrong with this example.\documentclass{article}%\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}\usepackage{pgfplots,pgfplotstable,makecell,booktabs}\begin{document} \begin{table} \pgfplotstabletypeset[% columns/0/.style={column name=\makecell{Col1\\{}}, st...Read more

pgfplotstable - rotated header and dec sep align - TeX

I have the following code, adapted from here.\documentclass{standalone}\usepackage{pgfplotstable}\pgfplotsset{compat=1.16}\begin{document}\pgfplotstabletypeset[col sep=comma, every head row/.style={ typeset cell/.code={ \ifnum\pgfplotstablecol=0 \pgfkeyssetvalue{/pgfplots/table/@cell content}{&}% \else \ifnum\pgfplotstablecol=\pgfplotstablecols \pgfkeyssetvalue{/pgfplots/table/@cell content}{\rotatebox{90}{##1}\\}% \else \pgfkeyssetvalue{/pgfplots/table/@cell content}{\rotatebox{90}{##1}&}% ...Read more

pgfplotstable - Latex reformat text structure - TeX

Say I have a file of abbreivations.txt&Estimated &Time of &Arrival&North, &East, &West, &South&Special &Weapons &And &Tactics&W&ireless &F&idelityand the latex \abbrtable{abbreivations.txt}I want this command to generate the following a table containing two coloums equivalent to the regexColoum 1: [^&]*&(\w)[^&]* -> \1Coloum 2: &(\w) -> \\textbf{\1}I.e. for the sample file this would be:\begin{longtable}{ll} \textbf{ETA} & \textbf{E}stimated \textbf{T}ime of \tex...Read more

pgfplotstable - Plot data from external file with floating numbers - TeX

I found yesterday this beautiful simple code:\documentclass{article}\usepackage{pgfplotstable}\usepackage{pgfplots}\pagestyle{empty}\begin{document}%\pgfplotstabletypeset{data.dat}\vspace{1cm}\begin{tikzpicture}\begin{axis}[ xlabel=Q Series, ylabel=P Values]\addplot table [y=P, x=$Q_A$]{data.dat};\addlegendentry{$Q_A$ series}\addplot table [y=P, x=$Q_B$]{data.dat};\addlegendentry{$Q_B$ series}\addplot table [y=P, x=$Q_D$]{data.dat};\addlegendentry{$Q_D$ series}\end{axis}\end{tikzpicture}\end{document}which works well with the external fileP $...Read more

pgfplotstable - Add vertical lines in PGF Plots table - TeX

I am using "pgf-plots-table" to create tables from a csv file. Multicolumn option is used to get different alignment for the head row. The issue is, the table does not have vertical lines in the header, hence it looks ugly.Please help to add vertical lines in the head row.My code is:\documentclass{article}\usepackage{pgfplotstable}\begin{filecontents*}{jobname.csv}M,0.4,0.7,1.0,1.30.201,1.001,1.801,4.601,3.4010.200,1.000,1.800,2.600,3.400\end{filecontents*}\begin{document}\pgfplotstabletypeset[ multicolumn names, col sep= comma, % the se...Read more

pgfplotstable - Creating a unique list from two tables read from filecontents - TeX

I have two tables.. one contains attributes with values e.g. Name percentageAtr1 80Atr2 20Atr3 50and the other one contains tools for that attributeAttribute ToolAtr1 SKAtr1 SLAtr2. UPAtr3 SKI need to have a list of tools from the top two attributes in table 1, but the list has to be unique in case that there is the same tool for each attribute.Tools from top two attributes in first table (Atr1 and Atr3) areSKSLSKI need to remove extra SK so that the list would look like thisSKSLHere is what I got so far..\documentclass{a...Read more

pgfplotstable - \pgfplotstablegetelem problem - TeX

I am trying to access values from a file one by one, and using the following code to do it:\nextgroupplot[ width=0.3*\plotwidth,] \foreach \i in {1,...,10}{ \foreach \j in {0,...,9}{ \ifnum\i>\j \pgfplotstablegetelem{\i}{\j}\of{\first}; %\let\param\pgfplotsretval; %\node at (axis cs:1.5, 0.5) {\pgfplotsretval}; \addplot [draw=none, mark=, fill=blue, fill opacity=1] coordinates {(0.5+\j, -0.5+\i)} node[pos=0.1] {\pgfplotsretval}; \else \f...Read more

pgfplotstable - Postprocessing floating point numbers - TeX

A computed column, columnWithFloatingPointNumbers, is added to the table, \table. Then I am trying to compute geometric mean of this newly-added column.However I get this error:! Package PGF Math Error: Unknown operator `Y' or `Y1' (in '1Y1.1328e1]').If I use \pgfmathprintnumberto, I get this error:! Package PGF Math Error: Could not parse input '$11.33$' as a floating point number, sorry. The unreadable part was near '$11.33$'..Here is MWE:\documentclass{article}\usepackage{pgfplotstable}\usepackage{multirow}\begin{filecontents}{table.txt}cA ...Read more

pgfplotstable - Reading quoted csv - TeX

I would like to read in data from a CSV file into a plot. Unfortunately, the data contains commas itself:Name, Description, Datahello, "hello, world", 1Note that the data is quoted using quotation marks, which is quite common when it comes to CSV files. I read in the file using the following:\pgfplotstableread[col sep=comma]{data.csv}{\datatable}Problem is: the pgfplotstable package does not seem to be able to handle quotes, specifically, I get an error message because there are apparently too many entries in the second row. I edited the file i...Read more

Styling a Single Element in a Pgfplotstable - TeX

According to the manual of pgfplotstable it is fairly easy to set the color of a whole row or a whole column of a table. However, I would like to style only one element located in a certain row and column.There is \pgfplotstablegetelem{<row>}{<col>}\of{<table>} for accessing table elements.I can style elements determined by their signs: columns/account1/.style={fonts by sign={}{\color{red}}}.How can I style 22 in the following example identified by its row-columns-coordinates (colB,2)? This feature makes sense, if I load data ...Read more

Create a contingency table using pgfplotstable - TeX

I'm trying to create a general pgfplotstable style for displaying contingency tables (the below example is taken from Wikipedia) of any sort but I am having trouble computing the totals for each row and column and adding them to the table on the fly.I am aware that totaling up the row will involve creating a column and using \pgfmathaccuma, while the totals row should be done via \pgfplotstablevertcat but the particulars seem to be beyond me even after repeated reading of the documentation.The solution should work for different tables with diff...Read more

pgfplotstable missing error and strig type - TeX

I have searched for solution to my problem on using pgfplotstable, but I didn't find nothing useful.I'm using pgfplotstable to import csv data into my latex code. My table has four columns. The first one is has string data and the others has numeric values.I indicated the column type for the first column string, then get the following message - error(1):! Missing $ inserted. $l.17 ]{teste.csv}The data are in the file teste.csvIf I remove the string type style from the first column, I get the following error (2):! Package PGF Mat...Read more

pgfplotstable - Histogram: different color for each bar - TeX

I have the following code.\documentclass[a4paper,twoside,12pt]{article}\usepackage[T1]{fontenc}\usepackage[utf8x]{inputenc}\usepackage[english]{babel}\usepackage{pgfplotstable}\definecolor{color1}{rgb}{0.98, 0.81, 0.69}\definecolor{color2}{rgb}{0.55, 0.71, 0.0}\definecolor{color3}{rgb}{1.0, 0.6, 0.4}\definecolor{color4}{rgb}{0.29, 0.59, 0.82}\pgfplotscreateplotcyclelist{mycolor}{{fill=color1!80, draw=color1},{fill=color2!80, draw=color2},{fill=color3!80, draw=color3},{fill=color4!80, draw=color4},}\begin{filecontents*}{coefficienti.dat}T ...Read more