2

There are several of issues with the CSV parser that is included in PGFPlots.
This isn't surprising, writing a CSV parser is well-known to be unexpectedly difficult.
A big one for me being that it doesn't handle quoting correctly.

I know there are several other packages for loading CSVs, though I've never used them.

I have grown to like using pgfplots and pgfplotstables to handle the actual display of my tables and plots.

So I am wondering if I can use some other command from another package, to replace it for the

\pgfplotstableread{inputdata.txt}\mydata;`

part of my document, while still using

\addplot [mark=*] table [x expr=..., y expr=... ] {\mydata};

for displaying it.

I see in this answer there is a "format" that PGFplots uses internally, so it seems possibly to data-mung anything into that format, in theory.


For purposes of demonstrating a package that can be used, which does handle CSVs correctly. The following data could be used:

age, Name, Country
37,"Natalie Portman","Israel/USA"
46,"Dwayne ""The Rock"" Johnson", USA
1,"Line
breakerson", Linebreakville

Full working example and details on why that is infact a legal CSV can be found here.

  • You can take a look on ctan.org/pkg/datatool – flav Sep 10 '18 at 4:49
  • 1
    Can you add a minimal working example that gives a csv file that pgfplots does not handle correctly? – Andrew Sep 10 '18 at 5:07
  • @Andrew that isn't really the question. I worry that would distract from the question of, "Can I use PGFPlots, while using another package to do that loading.". But I can do so and will make one up, though I'm not sure I should add it. – Lyndon White Sep 10 '18 at 5:16
  • I can believe that such a data set might distract from the point of the question. If that's the case it would still be good i you can add a minimal working example that people could use for proof-of-concept. – Andrew Sep 10 '18 at 5:39
  • @Andrew perhaps. Here is a MWE gist.github.com/oxinabox/d8074781c78ed308e1948df42a7c83d1 (Well a little more since it has an explanation of what is going wrong). – Lyndon White Sep 10 '18 at 5:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.