-
Notifications
You must be signed in to change notification settings - Fork 40
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
add export table data to file #315
base: master
Are you sure you want to change the base?
Conversation
That can be generalized to the various types of plots very easily. |
Can you please explain the use case? Yes, the |
Discussed a bit in #223. |
Two purposes:
1) avoiding 10000 lines file (e.g. multiple subplots with multiple data
easily reach that mark. yes that can reduced by curating data but that
defies the purpose of an efficient plotting routine) that makes any manual
edit to the axis and tikzpicture very painful
2) allow to add/update data to the tikz figure without updating the tikz
file itself (e.g want to add a curve on a subplot or f= in the data)
…On Fri, Apr 14, 2023 at 12:20 AM Kristoffer Carlsson < ***@***.***> wrote:
Discussed a bit in #223
<#223>.
—
Reply to this email directly, view it on GitHub
<#315 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEESMZBQIYCVYJYOBSHH2A3XBD3CVANCNFSM6AAAAAAW54ZIJQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I don't really like this whole new The steps I am thinking are:
That way, the only change a user has to do when exporting with separate data files is to add the |
I agree with the general idea.
The way it is working now is the following :
- a temp file is created for each table data.
- those temp files are moved (could be copied) once the export2tikz is
called toward the chosen path
Could we use external_data with savefig directly? This is the most
practical feature for beginners.
…On Fri, Apr 14, 2023 at 11:54 AM Kristoffer Carlsson < ***@***.***> wrote:
I don't really like this whole new export2tikz function. I think it
should be possible to implement this as an argument to pgfsave.
The steps I am thinking are:
- Each data source that can use an external file (for example Table)
needs a modification to print_tex that allows it to save the data to a
file.
- When a file is saved to .tex with the external_data=true keyword
argument:
-- We set a global flag that we are currently saving with external
data (and to what folder it is being saved)
-- The data sources look at that global flag and instead of just
printing the tex output, it also creates the data file.
-- The naming of the data files is $(filename)_data_$(n).tsv where $n
is a global counter.
-- Before saving the file, all previous files of that name pattern
above are removed (need to be a bit careful here, should probably add a
header or something to do file which is checked so we don't remove user
files).
That way, the only change a user has to do when exporting with separate
data files is to add the ; external_data=true keyword to pgfsave.
—
Reply to this email directly, view it on GitHub
<#315 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEESMZE3SHII4IEAZXFRAWLXBGMMLANCNFSM6AAAAAAW54ZIJQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
alternatively, is it possible to make a dispatch for pgfsave that
accommodates plot types from Plots.jl
e.g.:
using Plots()
pgfplotsx()
p=plot()
pgfsave("filename.tikz",p)
On Fri, Apr 14, 2023 at 12:00 PM Jerome Guterl ***@***.***>
wrote:
… I agree with the general idea.
The way it is working now is the following :
- a temp file is created for each table data.
- those temp files are moved (could be copied) once the export2tikz is
called toward the chosen path
Could we use external_data with savefig directly? This is the most
practical feature for beginners.
On Fri, Apr 14, 2023 at 11:54 AM Kristoffer Carlsson <
***@***.***> wrote:
> I don't really like this whole new export2tikz function. I think it
> should be possible to implement this as an argument to pgfsave.
>
> The steps I am thinking are:
>
> - Each data source that can use an external file (for example Table)
> needs a modification to print_tex that allows it to save the data to
> a file.
> - When a file is saved to .tex with the external_data=true keyword
> argument:
> -- We set a global flag that we are currently saving with external
> data (and to what folder it is being saved)
> -- The data sources look at that global flag and instead of just
> printing the tex output, it also creates the data file.
> -- The naming of the data files is $(filename)_data_$(n).tsv where $n
> is a global counter.
> -- Before saving the file, all previous files of that name pattern
> above are removed (need to be a bit careful here, should probably add a
> header or something to do file which is checked so we don't remove user
> files).
>
> That way, the only change a user has to do when exporting with separate
> data files is to add the ; external_data=true keyword to pgfsave.
>
> —
> Reply to this email directly, view it on GitHub
> <#315 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AEESMZE3SHII4IEAZXFRAWLXBGMMLANCNFSM6AAAAAAW54ZIJQ>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
Not really, but |
so far, it seems to me that savefig is only a wrapper for MIME writing
methods. That's why I ended up with a export2tikz function that is actually
using the same MIME writing method as Plots.jl.
…On Fri, Apr 14, 2023 at 12:10 PM Kristoffer Carlsson < ***@***.***> wrote:
Not really, but Plots allows you to get the underlying object which could
be passed to pgfsave for example. Or savefig (or whatever Plots uses to
save plots) could pass keywords down to the backend (maybe it already does).
—
Reply to this email directly, view it on GitHub
<#315 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEESMZHI3O3UHIV4XNRX5JLXBGOH7ANCNFSM6AAAAAAW54ZIJQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This is a proposition to permit export of table data to file and shorten tikz files.
Usage:
p=plot()
x = collect(0:0.001:1.0)
y = @. 1-sqrt(1-x^2)
plot!(y,x,ylabel="Δq/qᵤ", xlabel="q_rad/qᵤ")
path = "/yourpath/here/"
Plots.PGFPlotsX.export2tikz(path * "delta_q.tex",p;relpath="figures")