Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug or inaccurate documentation about .csv files with data visualization #1112

Closed
quark67 opened this issue Dec 19, 2021 · 2 comments · Fixed by #1117
Closed

Bug or inaccurate documentation about .csv files with data visualization #1112

quark67 opened this issue Dec 19, 2021 · 2 comments · Fixed by #1117

Comments

@quark67
Copy link
Contributor

quark67 commented Dec 19, 2021

Version: 3.1.9a

In pgf/doc/generic/pgf/pgfmanual-en-dv-main.tex (https://github.com/pgf-tikz/pgf/blob/28b9756fef06fc59ebee7241261ebd0e51d83c21/doc/generic/pgf/pgfmanual-en-dv-main.tex), lines 370-372, we read:

\datavisualization ...
  data [read from file=file1.csv]
  data [read from file=file2.csv];

This is false (or bugged). This don't work if the .csv file has an header (see https://tex.stackexchange.com/questions/627516/how-to-plot-function-from-a-csv-file-in-tikz-the-csv-file-created-from-the-ex).

If the bug is not corrected, the documentation must be updated with this precision:

The .csv file must not contain an header (e.g. : the first line must not be x,y).

And the lines 371-372 must be replaced by:

  data [headline={x, y},read from file=file1.csv]
  data [headline={x, y},read from file=file2.csv];

Edit: alternatives options:
Removing commas in the csv file, replacing it with spaces, while keeping the header, and replace lines 371-372 with:

  data [separator=\space,read from file=file1.csv]
  data [separator=\space,read from file=file2.csv];
@quark67 quark67 added the manual label Dec 19, 2021
@quark67 quark67 changed the title Bug or inaccurate documentation about .csv files with data visualisation Bug or inaccurate documentation about .csv files with data visualization Dec 19, 2021
@hmenke
Copy link
Member

hmenke commented Dec 19, 2021

This is a bug in datavisualization. There should be no difference between handling of inline data and data read from a file.

@muzimuzhi
Copy link
Member

When reading from a file line by line, each line is appended a space derived from the line end. So the read in headline would be x,<space>y<space> and the second recognized attribute would be y<space>, which is different from the expected y. This difference causes the reported problem.

Using option headline={x, y} avoids the trailing space hence avoids the problem. To show it's not the use of option headline, but the value parsed to it that works around the problem, one can play with data[headline={x, y } , ...], note the space after y and the one between } and ,.

I'll provide a PR.

muzimuzhi added a commit to muzimuzhi/pgf that referenced this issue Dec 20, 2021
muzimuzhi added a commit to muzimuzhi/pgf that referenced this issue Dec 20, 2021
DominikPeters added a commit to DominikPeters/pgf-tikz-html-manual that referenced this issue Dec 24, 2021
commit b508f8219017f5418be8c27ef639647ea2be0530
Merge: 60c5fad af5107d
Author: Dominik Peters <[email protected]>
Date:   Fri Dec 24 02:56:05 2021 +0100

    Merge remote-tracking branch 'upstream/master' into incoming-2021-12-24

commit af5107d
Merge: 8ec2edb 9cd4037
Author: Henri Menke <[email protected]>
Date:   Wed Dec 22 20:10:40 2021 +0100

    Merge pull request pgf-tikz#1117 from muzimuzhi/dv-line-end

    fix(dv): Suppress white space at line end

commit 8ec2edb
Author: Henri Menke <[email protected]>
Date:   Wed Dec 22 20:08:15 2021 +0100

    docs: add read-only link to Matrix channel

    Signed-off-by: Henri Menke <[email protected]>

commit 9cd4037
Author: muzimuzhi <[email protected]>
Date:   Mon Dec 20 09:54:20 2021 +0800

    fix(dv): Suppress white space at line end pgf-tikz#1112

    Signed-off-by: muzimuzhi <[email protected]>

commit 1ad8f6e
Author: Henri Menke <[email protected]>
Date:   Sun Dec 19 16:04:47 2021 +0100

    fix(tests): set \showbox parameters explicitly

    Signed-off-by: Henri Menke <[email protected]>

commit 2bff7c6
Merge: 5125df8 5fa45b6
Author: Henri Menke <[email protected]>
Date:   Sun Dec 19 10:58:10 2021 +0100

    Merge pull request pgf-tikz#1114 from muzimuzhi/archive-failed

    feat(ci): Archive failed test output

commit 5125df8
Merge: cefe1dc 7c1cbda
Author: Henri Menke <[email protected]>
Date:   Sun Dec 19 10:57:45 2021 +0100

    Merge pull request pgf-tikz#1111 from muzimuzhi/job-names

    style(ci): Use descriptive job ids

commit 5fa45b6
Author: muzimuzhi <[email protected]>
Date:   Sun Dec 19 09:37:36 2021 +0800

    feat(ci): Archive failed test output

    Signed-off-by: muzimuzhi <[email protected]>

commit 7c1cbda
Author: muzimuzhi <[email protected]>
Date:   Sat Dec 18 21:15:43 2021 +0800

    style(ci): Use descriptive job ids

    Signed-off-by: muzimuzhi <[email protected]>

commit cefe1dc
Merge: 065c015 99cd9eb
Author: Henri Menke <[email protected]>
Date:   Sat Dec 18 13:07:31 2021 +0100

    Merge pull request pgf-tikz#1100 from hmenke/l3build

    Adapt the repo to new l3build infrastructure

commit 99cd9eb
Author: Henri Menke <[email protected]>
Date:   Fri Dec 17 18:13:34 2021 +0100

    docs: mention CHANGELOG in PR template

    Signed-off-by: Henri Menke <[email protected]>

commit 16b22cf
Author: Henri Menke <[email protected]>
Date:   Fri Dec 17 17:37:55 2021 +0100

    refactor(ci): use GitHub Script to upload release assets

    Signed-off-by: Henri Menke <[email protected]>

commit c4de62c
Author: Henri Menke <[email protected]>
Date:   Fri Dec 17 13:48:49 2021 +0100

    refactor(ci): generate RELEASE_NOTES.md from CHANGELOG.md

    Signed-off-by: Henri Menke <[email protected]>

commit 663534a
Author: Henri Menke <[email protected]>
Date:   Fri Dec 17 12:08:01 2021 +0100

    refactor: use the “Keep a Changelog” format

    Signed-off-by: Henri Menke <[email protected]>

commit addcd67
Author: Henri Menke <[email protected]>
Date:   Thu Dec 16 20:24:34 2021 +0100

    refactor(ci): use uploadconfig.note_file

    Signed-off-by: Henri Menke <[email protected]>

commit e81f96c
Author: Henri Menke <[email protected]>
Date:   Wed Dec 15 20:22:15 2021 +0100

    refactor(tests): more format agnostic constructs

    Signed-off-by: Henri Menke <[email protected]>

commit cfc4c1d
Author: Henri Menke <[email protected]>
Date:   Wed Dec 15 20:05:03 2021 +0100

    chore: remove unused scripts

    Signed-off-by: Henri Menke <[email protected]>

commit 9efb7e4
Author: Henri Menke <[email protected]>
Date:   Wed Dec 15 19:26:19 2021 +0100

    refactor(ci)!: use l3build tagfiles

    BREAKING CHANGE: \pgfversiondatetime and \pgfrevisiondatetime have been removed.
    BREAKING CHANGE: \pgfversiondate and \pgfrevisiondate now use the format YYYY-MM-DD
    BREAKING CHANGE: \pgfrevision{,date} and \pgfversion{,date} are now synonyms

    Signed-off-by: Henri Menke <[email protected]>

commit cb61a38
Author: Henri Menke <[email protected]>
Date:   Mon Dec 13 21:46:21 2021 +0100

    refactor(ci): use l3build CTAN upload

    Signed-off-by: Henri Menke <[email protected]>

commit ac109f3
Author: Henri Menke <[email protected]>
Date:   Sun Dec 12 17:12:19 2021 +0100

    refactor(ci): use IoT Docker image

    Signed-off-by: Henri Menke <[email protected]>

commit 379196c
Author: Henri Menke <[email protected]>
Date:   Sun Dec 12 15:36:48 2021 +0100

    refactor(doc): mention l3build instead of build.lua [ci skip]

    Signed-off-by: Henri Menke <[email protected]>

commit 50267ec
Author: Henri Menke <[email protected]>
Date:   Sat Dec 11 20:56:39 2021 +0100

    refactor(ci): split workflows

    Signed-off-by: Henri Menke <[email protected]>

commit 065c015
Merge: a46375c 4b1d5b7
Author: Henri Menke <[email protected]>
Date:   Fri Dec 17 17:07:08 2021 +0100

    Merge pull request pgf-tikz#1110 from jkugelman/manual-typo

    fix(docs): unswap x/y coordinates in description

commit 4b1d5b7
Author: John Kugelman <[email protected]>
Date:   Fri Dec 17 10:51:48 2021 -0500

    fix(docs): unswap x/y coordinates in description

    Signed-off-by: John Kugelman <[email protected]>

commit a46375c
Author: Henri Menke <[email protected]>
Date:   Thu Dec 16 10:47:36 2021 +0100

    chore: remove experiments/ folder

    Signed-off-by: Henri Menke <[email protected]>

commit 475b536
Merge: 28b9756 5d099a8
Author: Henri Menke <[email protected]>
Date:   Thu Dec 16 08:11:55 2021 +0100

    Merge pull request pgf-tikz#1108 from hmenke/flatten

    Flatten the loading hierarchy

commit 5d099a8
Author: Henri Menke <[email protected]>
Date:   Wed Dec 15 21:40:48 2021 +0100

    refactor(pgfcore): replace nested \protect by \protected\def

    Signed-off-by: Henri Menke <[email protected]>

commit 17352e2
Author: Henri Menke <[email protected]>
Date:   Wed Dec 15 21:39:20 2021 +0100

    refactor: Simplify loading by delegating to top-level files

    Signed-off-by: Henri Menke <[email protected]>

commit 28b9756
Author: Gábor Braun <[email protected]>
Date:   Sat Nov 27 17:52:38 2021 +0100

    fix(docs): some extra, missing or misspelled words in documentation.

    Signed-off-by: Gábor Braun <[email protected]>

commit 724f452
Author: Gábor Braun <[email protected]>
Date:   Sun Nov 28 19:49:15 2021 +0100

    fix(docs): Update Debian installation instructions.

    Signed-off-by: Gábor Braun <[email protected]>

commit 0b05234
Author: Gábor Braun <[email protected]>
Date:   Sat Nov 27 16:58:56 2021 +0100

    fix(docs): Emacs local variables in manual.

    Specify main file with no path (meaning in the same directory),
    which is independent of developer's environment.

    Remove wrong encoding specification.

    Signed-off-by: Gábor Braun <[email protected]>

commit e6a9a78
Merge: c8ee2d9 b30b657
Author: Henri Menke <[email protected]>
Date:   Tue Dec 14 10:07:04 2021 +0100

    Merge pull request pgf-tikz#1099 from muzimuzhi/no-missing-char

    Resolve all `Missing character` reports in manual

commit b30b657
Author: muzimuzhi <[email protected]>
Date:   Sun Dec 12 23:29:48 2021 +0800

    style: Comment has to go after the correct set of braces

    Co-authored-by: Henri Menke <[email protected]>

commit 01aedc4
Author: muzimuzhi <[email protected]>
Date:   Sun Dec 12 21:39:18 2021 +0800

    docs: Promote `Missing character` to errors

    Signed-off-by: muzimuzhi <[email protected]>

commit 1e202a6
Author: muzimuzhi <[email protected]>
Date:   Sun Dec 12 21:38:34 2021 +0800

    docs: Remove superfluous `;` and `]`

    Signed-off-by: muzimuzhi <[email protected]>

commit 6d90ef5
Author: muzimuzhi <[email protected]>
Date:   Sun Dec 12 21:34:00 2021 +0800

    fix(shapes): Wrap box content in `\pgfinterruptpicture`

    This eliminates "Missing character" reports for `logicgates` shapes when
    their gate symbols are typeset in text mode, e.g.,
        nand gate IEC symbol=\color{black!30}\char`\&
    in engines other than LuaTeX.

    Signed-off-by: muzimuzhi <[email protected]>

commit cec1ee1
Author: muzimuzhi <[email protected]>
Date:   Sun Dec 12 21:28:12 2021 +0800

    fix(shapes): Remove superfluous `;` for shape `arrow box`

    Signed-off-by: muzimuzhi <[email protected]>

commit e138ac7
Author: muzimuzhi <[email protected]>
Date:   Sun Dec 12 21:25:38 2021 +0800

    fix(animations): Remove superfluous `/utils/exec`

    This eliminates "Missing character" reports for `/utils/exec`, char by char.

    Signed-off-by: muzimuzhi <[email protected]>

commit b65eddd
Author: muzimuzhi <[email protected]>
Date:   Sun Dec 12 21:20:58 2021 +0800

    fix(animations): Gobble `\pgf@stop` when parsing finishes

    This eliminates "Missing character" reports for `pgf@stop`, char by char.

    Signed-off-by: muzimuzhi <[email protected]>

commit 81f63ab
Author: muzimuzhi <[email protected]>
Date:   Sun Dec 12 21:19:58 2021 +0800

    fix(sys): Add missing `\pgf@sys@tonumber` before `<dimen>`

    Signed-off-by: muzimuzhi <[email protected]>

commit 00ef2e1
Author: muzimuzhi <[email protected]>
Date:   Sat Dec 11 04:08:01 2021 +0800

    fix(animations): Add missing `\pgf@sys@tonumber` before `<dimen>`

    "Private" implementations of `pgfmath` functions only accept unit-less
    numbers as their arguments, e.g.,
        \pgfmathadd@{1.0}{1.0}
    So every dimension used as their argument must be prefixed by a `\pgf@sys@tonumber`, e.g.,
        \pgfmathadd@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}

    This eliminates "Missing character" reports for `p` and `t`.

    Signed-off-by: muzimuzhi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants