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

Save plot data in external file (feature) #223

Open
jebej opened this issue May 8, 2020 · 4 comments
Open

Save plot data in external file (feature) #223

jebej opened this issue May 8, 2020 · 4 comments

Comments

@jebej
Copy link
Contributor

jebej commented May 8, 2020

It can be convenient to save the plot data in an external file that is read in with table.

This option could be passed as a keyword argument to pgfsave.

@tpapp
Copy link
Collaborator

tpapp commented May 8, 2020

Sorry I don't understand. Can you please clarify with an example?

@KristofferC
Copy link
Owner

I think the request is to upon saving to .tex transform e.g.

table[row sep={\\}, x={Dof}, y={Err}]
{
    Dof  Err  \\
    1.0  2.0  \\
    2.0  1.0  \\
    4.0  0.1  \\
}

into

table[row sep={\\}, x={Dof}, y={Err}]
{
 data.dat
}

where data.dat would contain the data

    Dof  Err 
    1.0  2.0  
    2.0  1.0  
    4.0  0.1  

Would make for smaller .tex files.

@jebej
Copy link
Contributor Author

jebej commented May 8, 2020

Yes, exactly. The same as is implemented in matlab2tikz.

The only thing is to make sure to allow for a relative directory option, because latex will always read in files from the directory of the main file. Thus, if the tikz files are stored in another directory (e.g. /figures), we need to add that path to table[], even if the data files are in the same directory as the tikz files.

@jguterl
Copy link

jguterl commented Dec 20, 2022

Any chance this will be looked at? That would prevent having massive blocks of tikzpictures.
This would require to add a method print_tex to dump table data into an external text file and print the path toward that file
example:
addplot[ybar interval, fill=red, fill opacity=0.2, draw=none, area legend] table[] {data_001.tsv};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants