Plot data from external file with floating numbersFind a extremal value in external data file with pgfplotPostprocessing floating point numbersPut from external file?Barchart, Boxplot Data Table PGF Math Errors from mixed format inline dataPGF plot color map contour plot from matrix datacreating scatter plot from data file with missing values (sparse matrix)pgfplots: percentage in matrix plotProblem to plot data with dates using an external fileCreating a tube plot from external data with pgfplots and tikzReading data from hdf5 file to plot a graph
Why other Westeros houses don't use wildfire?
Why do games have consumables?
How can the Zone of Truth spell be defeated without the caster knowing?
How to solve constants out of the internal energy equation?
A Strange Latex Symbol
Why does processed meat contain preservatives, while canned fish needs not?
Error message with tabularx
Are Boeing 737-800’s grounded?
How to reduce LED flash rate (frequency)
Why is it that the natural deduction method can't test for invalidity?
Was there a shared-world project before "Thieves World"?
How to make a pipeline wait for end-of-file or stop after an error?
Was there a Viking Exchange as well as a Columbian one?
What language was spoken in East Asia before Proto-Turkic?
How would one muzzle a full grown polar bear in the 13th century?
How could Tony Stark make this in Endgame?
Why does nature favour the Laplacian?
Why isn't the definition of absolute value applied when squaring a radical containing a variable?
Will a top journal at least read my introduction?
How to have a sharp product image?
A Note on N!
How to creep the reader out with what seems like a normal person?
How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?
How to type a section sign (§) into the Minecraft client
Plot data from external file with floating numbers
Find a extremal value in external data file with pgfplotPostprocessing floating point numbersPut from external file?Barchart, Boxplot Data Table PGF Math Errors from mixed format inline dataPGF plot color map contour plot from matrix datacreating scatter plot from data file with missing values (sparse matrix)pgfplots: percentage in matrix plotProblem to plot data with dates using an external fileCreating a tube plot from external data with pgfplots and tikzReading data from hdf5 file to plot a graph
I found yesterday this beautiful simple code:
documentclassarticle
usepackagepgfplotstable
usepackagepgfplots
pagestyleempty
begindocument
%pgfplotstabletypesetdata.dat
vspace1cm
begintikzpicture
beginaxis[
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
endaxis
endtikzpicture
enddocument
which works well with the external file
P $Q_A$ $Q_B$ $Q_D$
10 5 7 12
8 8 10 18
6 12 16 28
Yet, if I have more comlicated numbers in the file, for example
P $Q_A$ $Q_B$ $Q_D$
10 14.2*10^2 7 12
8 8 10 18
6 12 16 28
the code crashes.
How do I have to adapt the code or data to work?
Thx in advance
pgfplotstable external-files
add a comment |
I found yesterday this beautiful simple code:
documentclassarticle
usepackagepgfplotstable
usepackagepgfplots
pagestyleempty
begindocument
%pgfplotstabletypesetdata.dat
vspace1cm
begintikzpicture
beginaxis[
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
endaxis
endtikzpicture
enddocument
which works well with the external file
P $Q_A$ $Q_B$ $Q_D$
10 5 7 12
8 8 10 18
6 12 16 28
Yet, if I have more comlicated numbers in the file, for example
P $Q_A$ $Q_B$ $Q_D$
10 14.2*10^2 7 12
8 8 10 18
6 12 16 28
the code crashes.
How do I have to adapt the code or data to work?
Thx in advance
pgfplotstable external-files
I think the purpose of reading external files is that those external files are generated by a script that can not contain any "uncalculated" numbers.
– JouleV
Apr 20 at 10:13
So my best bet is just writing the number in full? Speicifically 1,3*10^5 -> 1300000.
– Andreas
Apr 20 at 11:02
You can do that of course, but I can't be sure whether it would be the best option.
– JouleV
Apr 20 at 11:03
add a comment |
I found yesterday this beautiful simple code:
documentclassarticle
usepackagepgfplotstable
usepackagepgfplots
pagestyleempty
begindocument
%pgfplotstabletypesetdata.dat
vspace1cm
begintikzpicture
beginaxis[
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
endaxis
endtikzpicture
enddocument
which works well with the external file
P $Q_A$ $Q_B$ $Q_D$
10 5 7 12
8 8 10 18
6 12 16 28
Yet, if I have more comlicated numbers in the file, for example
P $Q_A$ $Q_B$ $Q_D$
10 14.2*10^2 7 12
8 8 10 18
6 12 16 28
the code crashes.
How do I have to adapt the code or data to work?
Thx in advance
pgfplotstable external-files
I found yesterday this beautiful simple code:
documentclassarticle
usepackagepgfplotstable
usepackagepgfplots
pagestyleempty
begindocument
%pgfplotstabletypesetdata.dat
vspace1cm
begintikzpicture
beginaxis[
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
endaxis
endtikzpicture
enddocument
which works well with the external file
P $Q_A$ $Q_B$ $Q_D$
10 5 7 12
8 8 10 18
6 12 16 28
Yet, if I have more comlicated numbers in the file, for example
P $Q_A$ $Q_B$ $Q_D$
10 14.2*10^2 7 12
8 8 10 18
6 12 16 28
the code crashes.
How do I have to adapt the code or data to work?
Thx in advance
pgfplotstable external-files
pgfplotstable external-files
edited Apr 20 at 10:06
JouleV
16.1k22667
16.1k22667
asked Apr 20 at 10:04
AndreasAndreas
384
384
I think the purpose of reading external files is that those external files are generated by a script that can not contain any "uncalculated" numbers.
– JouleV
Apr 20 at 10:13
So my best bet is just writing the number in full? Speicifically 1,3*10^5 -> 1300000.
– Andreas
Apr 20 at 11:02
You can do that of course, but I can't be sure whether it would be the best option.
– JouleV
Apr 20 at 11:03
add a comment |
I think the purpose of reading external files is that those external files are generated by a script that can not contain any "uncalculated" numbers.
– JouleV
Apr 20 at 10:13
So my best bet is just writing the number in full? Speicifically 1,3*10^5 -> 1300000.
– Andreas
Apr 20 at 11:02
You can do that of course, but I can't be sure whether it would be the best option.
– JouleV
Apr 20 at 11:03
I think the purpose of reading external files is that those external files are generated by a script that can not contain any "uncalculated" numbers.
– JouleV
Apr 20 at 10:13
I think the purpose of reading external files is that those external files are generated by a script that can not contain any "uncalculated" numbers.
– JouleV
Apr 20 at 10:13
So my best bet is just writing the number in full? Speicifically 1,3*10^5 -> 1300000.
– Andreas
Apr 20 at 11:02
So my best bet is just writing the number in full? Speicifically 1,3*10^5 -> 1300000.
– Andreas
Apr 20 at 11:02
You can do that of course, but I can't be sure whether it would be the best option.
– JouleV
Apr 20 at 11:03
You can do that of course, but I can't be sure whether it would be the best option.
– JouleV
Apr 20 at 11:03
add a comment |
3 Answers
3
active
oldest
votes
You can replace *10^
by e
P $Q_A$ $Q_B$ $Q_D$
10 14.2e2 7 12
8 8 10 18
6 12 16 28
add a comment |
You can load the data in a macro and then preprocess the data. I'm assuming here that your values are in a format the fpeval
from expl3/xfp can handle (but your example value is rather large compared to the rest, so the plot looks odd):
documentclassarticle
usepackagepgfplotstable
usepackagepgfplots,xfp
pagestyleempty
begindocument
pgfplotstablereaddata.datdata
pgfplotstablecreatecol[create col/expr=fpevalthisrow$Q_A$]$Q_A$data
vspace1cm
begintikzpicture
beginaxis[
xlabel=Q Series,
ylabel=P Values]
addplot table [y=P, x=$Q_A$]data;
addlegendentry$Q_A$ series
addplot table [y=P, x=$Q_B$]data;
addlegendentry$Q_B$ series
addplot table [y=P, x=$Q_D$]data;
addlegendentry$Q_D$ series
endaxis
endtikzpicture
enddocument
add a comment |
You only need to tell pgfplots that these are expressions. That is, instead of
addplot table [y=P, x=$Q_A$]data.dat;
you only need
addplot table [y=P, x expr=thisrow$Q_A$]data.dat;
MWE:
documentclassarticle
usepackagefilecontents
beginfilecontents*data.dat
P $Q_A$ $Q_B$ $Q_D$
10 14.2*10^2 7 12
8 8 10 18
6 12 16 28
endfilecontents*
%usepackagepgfplotstable
usepackagepgfplots
pgfplotssetcompat=1.16
pagestyleempty
begindocument
%pgfplotstabletypesetdata.dat
vspace1cm
begintikzpicture
beginaxis[
xlabel=Q Series,
ylabel=P Values]
addplot table [y=P, x expr=thisrow$Q_A$]data.dat;
addlegendentry$Q_A$ series
addplot table [y=P, x expr=thisrow$Q_B$]data.dat;
addlegendentry$Q_B$ series
addplot table [y=P, x expr=thisrow$Q_D$]data.dat;
addlegendentry$Q_D$ series
endaxis
endtikzpicture
enddocument
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f485720%2fplot-data-from-external-file-with-floating-numbers%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can replace *10^
by e
P $Q_A$ $Q_B$ $Q_D$
10 14.2e2 7 12
8 8 10 18
6 12 16 28
add a comment |
You can replace *10^
by e
P $Q_A$ $Q_B$ $Q_D$
10 14.2e2 7 12
8 8 10 18
6 12 16 28
add a comment |
You can replace *10^
by e
P $Q_A$ $Q_B$ $Q_D$
10 14.2e2 7 12
8 8 10 18
6 12 16 28
You can replace *10^
by e
P $Q_A$ $Q_B$ $Q_D$
10 14.2e2 7 12
8 8 10 18
6 12 16 28
answered Apr 20 at 11:07
David CarlisleDavid Carlisle
501k4211481897
501k4211481897
add a comment |
add a comment |
You can load the data in a macro and then preprocess the data. I'm assuming here that your values are in a format the fpeval
from expl3/xfp can handle (but your example value is rather large compared to the rest, so the plot looks odd):
documentclassarticle
usepackagepgfplotstable
usepackagepgfplots,xfp
pagestyleempty
begindocument
pgfplotstablereaddata.datdata
pgfplotstablecreatecol[create col/expr=fpevalthisrow$Q_A$]$Q_A$data
vspace1cm
begintikzpicture
beginaxis[
xlabel=Q Series,
ylabel=P Values]
addplot table [y=P, x=$Q_A$]data;
addlegendentry$Q_A$ series
addplot table [y=P, x=$Q_B$]data;
addlegendentry$Q_B$ series
addplot table [y=P, x=$Q_D$]data;
addlegendentry$Q_D$ series
endaxis
endtikzpicture
enddocument
add a comment |
You can load the data in a macro and then preprocess the data. I'm assuming here that your values are in a format the fpeval
from expl3/xfp can handle (but your example value is rather large compared to the rest, so the plot looks odd):
documentclassarticle
usepackagepgfplotstable
usepackagepgfplots,xfp
pagestyleempty
begindocument
pgfplotstablereaddata.datdata
pgfplotstablecreatecol[create col/expr=fpevalthisrow$Q_A$]$Q_A$data
vspace1cm
begintikzpicture
beginaxis[
xlabel=Q Series,
ylabel=P Values]
addplot table [y=P, x=$Q_A$]data;
addlegendentry$Q_A$ series
addplot table [y=P, x=$Q_B$]data;
addlegendentry$Q_B$ series
addplot table [y=P, x=$Q_D$]data;
addlegendentry$Q_D$ series
endaxis
endtikzpicture
enddocument
add a comment |
You can load the data in a macro and then preprocess the data. I'm assuming here that your values are in a format the fpeval
from expl3/xfp can handle (but your example value is rather large compared to the rest, so the plot looks odd):
documentclassarticle
usepackagepgfplotstable
usepackagepgfplots,xfp
pagestyleempty
begindocument
pgfplotstablereaddata.datdata
pgfplotstablecreatecol[create col/expr=fpevalthisrow$Q_A$]$Q_A$data
vspace1cm
begintikzpicture
beginaxis[
xlabel=Q Series,
ylabel=P Values]
addplot table [y=P, x=$Q_A$]data;
addlegendentry$Q_A$ series
addplot table [y=P, x=$Q_B$]data;
addlegendentry$Q_B$ series
addplot table [y=P, x=$Q_D$]data;
addlegendentry$Q_D$ series
endaxis
endtikzpicture
enddocument
You can load the data in a macro and then preprocess the data. I'm assuming here that your values are in a format the fpeval
from expl3/xfp can handle (but your example value is rather large compared to the rest, so the plot looks odd):
documentclassarticle
usepackagepgfplotstable
usepackagepgfplots,xfp
pagestyleempty
begindocument
pgfplotstablereaddata.datdata
pgfplotstablecreatecol[create col/expr=fpevalthisrow$Q_A$]$Q_A$data
vspace1cm
begintikzpicture
beginaxis[
xlabel=Q Series,
ylabel=P Values]
addplot table [y=P, x=$Q_A$]data;
addlegendentry$Q_A$ series
addplot table [y=P, x=$Q_B$]data;
addlegendentry$Q_B$ series
addplot table [y=P, x=$Q_D$]data;
addlegendentry$Q_D$ series
endaxis
endtikzpicture
enddocument
answered Apr 20 at 12:59
Ulrike FischerUlrike Fischer
201k9310695
201k9310695
add a comment |
add a comment |
You only need to tell pgfplots that these are expressions. That is, instead of
addplot table [y=P, x=$Q_A$]data.dat;
you only need
addplot table [y=P, x expr=thisrow$Q_A$]data.dat;
MWE:
documentclassarticle
usepackagefilecontents
beginfilecontents*data.dat
P $Q_A$ $Q_B$ $Q_D$
10 14.2*10^2 7 12
8 8 10 18
6 12 16 28
endfilecontents*
%usepackagepgfplotstable
usepackagepgfplots
pgfplotssetcompat=1.16
pagestyleempty
begindocument
%pgfplotstabletypesetdata.dat
vspace1cm
begintikzpicture
beginaxis[
xlabel=Q Series,
ylabel=P Values]
addplot table [y=P, x expr=thisrow$Q_A$]data.dat;
addlegendentry$Q_A$ series
addplot table [y=P, x expr=thisrow$Q_B$]data.dat;
addlegendentry$Q_B$ series
addplot table [y=P, x expr=thisrow$Q_D$]data.dat;
addlegendentry$Q_D$ series
endaxis
endtikzpicture
enddocument
add a comment |
You only need to tell pgfplots that these are expressions. That is, instead of
addplot table [y=P, x=$Q_A$]data.dat;
you only need
addplot table [y=P, x expr=thisrow$Q_A$]data.dat;
MWE:
documentclassarticle
usepackagefilecontents
beginfilecontents*data.dat
P $Q_A$ $Q_B$ $Q_D$
10 14.2*10^2 7 12
8 8 10 18
6 12 16 28
endfilecontents*
%usepackagepgfplotstable
usepackagepgfplots
pgfplotssetcompat=1.16
pagestyleempty
begindocument
%pgfplotstabletypesetdata.dat
vspace1cm
begintikzpicture
beginaxis[
xlabel=Q Series,
ylabel=P Values]
addplot table [y=P, x expr=thisrow$Q_A$]data.dat;
addlegendentry$Q_A$ series
addplot table [y=P, x expr=thisrow$Q_B$]data.dat;
addlegendentry$Q_B$ series
addplot table [y=P, x expr=thisrow$Q_D$]data.dat;
addlegendentry$Q_D$ series
endaxis
endtikzpicture
enddocument
add a comment |
You only need to tell pgfplots that these are expressions. That is, instead of
addplot table [y=P, x=$Q_A$]data.dat;
you only need
addplot table [y=P, x expr=thisrow$Q_A$]data.dat;
MWE:
documentclassarticle
usepackagefilecontents
beginfilecontents*data.dat
P $Q_A$ $Q_B$ $Q_D$
10 14.2*10^2 7 12
8 8 10 18
6 12 16 28
endfilecontents*
%usepackagepgfplotstable
usepackagepgfplots
pgfplotssetcompat=1.16
pagestyleempty
begindocument
%pgfplotstabletypesetdata.dat
vspace1cm
begintikzpicture
beginaxis[
xlabel=Q Series,
ylabel=P Values]
addplot table [y=P, x expr=thisrow$Q_A$]data.dat;
addlegendentry$Q_A$ series
addplot table [y=P, x expr=thisrow$Q_B$]data.dat;
addlegendentry$Q_B$ series
addplot table [y=P, x expr=thisrow$Q_D$]data.dat;
addlegendentry$Q_D$ series
endaxis
endtikzpicture
enddocument
You only need to tell pgfplots that these are expressions. That is, instead of
addplot table [y=P, x=$Q_A$]data.dat;
you only need
addplot table [y=P, x expr=thisrow$Q_A$]data.dat;
MWE:
documentclassarticle
usepackagefilecontents
beginfilecontents*data.dat
P $Q_A$ $Q_B$ $Q_D$
10 14.2*10^2 7 12
8 8 10 18
6 12 16 28
endfilecontents*
%usepackagepgfplotstable
usepackagepgfplots
pgfplotssetcompat=1.16
pagestyleempty
begindocument
%pgfplotstabletypesetdata.dat
vspace1cm
begintikzpicture
beginaxis[
xlabel=Q Series,
ylabel=P Values]
addplot table [y=P, x expr=thisrow$Q_A$]data.dat;
addlegendentry$Q_A$ series
addplot table [y=P, x expr=thisrow$Q_B$]data.dat;
addlegendentry$Q_B$ series
addplot table [y=P, x expr=thisrow$Q_D$]data.dat;
addlegendentry$Q_D$ series
endaxis
endtikzpicture
enddocument
answered Apr 21 at 1:06
marmotmarmot
122k6159297
122k6159297
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f485720%2fplot-data-from-external-file-with-floating-numbers%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I think the purpose of reading external files is that those external files are generated by a script that can not contain any "uncalculated" numbers.
– JouleV
Apr 20 at 10:13
So my best bet is just writing the number in full? Speicifically 1,3*10^5 -> 1300000.
– Andreas
Apr 20 at 11:02
You can do that of course, but I can't be sure whether it would be the best option.
– JouleV
Apr 20 at 11:03