Gnuplot : plot data from file using expressions fails - expression

I am plotting some data (https://jpst.it/23X01) with gnuplot and I am having a weird problem when combining "using" with an expression on the columns.
The basic command
gnuplot> plot "test.dat" u 1:4 w l
works just fine and displays the following graph
complete curve with gnuplot
But if I use an expression instead
gnuplot> plot "test.dat" u 1:($4) w l
, some data is discarded.
curve with missing points
The discarded points seem to coincide with low y-values. The problem was observed with both v4.6 patchlevel 6 and v5.0 patchlevel 5.
Am I getting something wrong ? I have used this functionality of gnuplot several times in the past but never had this problem before. Thanks in advance.

I thought of deleting my question as I found my problem and it is silly, but since others might make the same mistake, I am leaving it for now.
My datafile was not formatted correctly and some columns were "jammed" together (I am amazed gnuplot managed to plot it with the first command). For example:
1415.8510073.5710065.88 61.32 61.58
instead of
1415.85 10073.57 10065.88 61.32 61.58
After I separated the columns correctly, everything went back in order.

Related

Graphviz with nodes and edges in Russian: edge label has offset and Node is enlarged

I'm drawing diagram with graphviz. I set node and edge labels in Russian. Nodes with Russian labels are much larger than nodes with English labels with the same length. Also edge labels in Russian have offset that labels in English doesn't have.
I tried to use different graphviz tools such as: viz-js.com, Atom editor with graphviz plugin, gvedit. Only gvedit provides correct result, but I can't use it.
Here is sample code:
digraph D {
Anton -> Антон [label="Метка"]
Anton -> Bob [label="Label"]
}
Result is:
Not really an solution / answer but some observations and it is a bit long for a comment.
I tried the given file directly with dot version 2.38.0 (20140413.2041) and got as result:
I also tried with version version 2.40.1 (20161225.0304) and got the same result.
So I think the underlying dot program is working correct.
I also tried http://www.webgraphviz.com/ but here I get the message:
Warning: :3: string ran past end of line Error: :3: syntax error near line 3
and the resulting image is even worse:
So here it looks like the used input encoding is not correct, this might also be the case with the tools OP used.

MATLAB -Exponential (exp2) curve fitting function not giving the same output as the plot graph when using the fit values in the original equation

my brain is pickled with this one. Below are the two graphs I have plotted with exp2 function. The points do not match the curve, and this is ultimately changing my entire answer, as it is giving the wrong values out, and I cannot understand why?
enter image description here
enter image description here
Here is the code I am using, both graphs plot a concentration against time, but yet give different results:
CH4_fit = fit(Res_time, CH4_exp, 'exp2'); CH4_coeff =
coeffvalues(CH4_fit);
%Co-efficient values for exponential fitting CH4_pred
=(CH4_coeff(1)*exp(CH4_coeff(2)*Res_time)) + ...
(CH4_coeff(3)*exp(CH4_coeff(4)*Res_time)); plot(Res_time,CH4_exp, Res_time, CH4_pred);
Can I just added that the exact same data was run on different computers, and it gave the same equation co-efficients exactly (to 4.dp) and the same times, but yet still outputs different concentrations on my version? I have the R2018b, and I have just used default settings (don't know how to change anything, so I definitely haven't).

Syntax of animating in gnuplot using 'blocks' in a single file

I have a data file of two column, ten row ‘blocks’, with two lines of whitespace between each block. Each frame of the animation I want the ten points in the successive block to be plotted, until the end of the data file.
I've searched for how to do this for ages but can't appropriate any of the examples I've found to my case as I don't understand the syntax and can't find an explanation of it anywhere.
How would the example here or here be extended to blocks of x rows?
E.g., in the second example, pasted below for easy reference
n=10 # n present here the number of blocks in your file
plot "output.dat" using 1:2 every :::i::i
i=i+1
if i<n reread
What do the number of colons in every :::i::i mean? Is that three data lines, then two whitespace lines? (Appropriating assuming that doesn't work.)
(If this question seems too obvious, I assure you it is due to my lack of knowledge, not my lack of effort in researching. I would very gladly accept being pointed towards the place in the documentation where this is covered.)
This is not an answer regarding the syntax of every, but a way to achieve this animated plot that is scalable for future users in my position.
A datablock, or block, is x consecutive lines of data, separated by exactly two lines of whitespace.
The plot command option index can be used to access each of these blocks.
For example, plot "datafile.dat" using 1:2 index 1 would plot only the points in the first dataset (block of data).
A loop can be used to animate your data. The stats command can be used to find the number of datasets/blocks in your file, to use in the loop.
set terminal x11
stats 'bdata.txt' nooutput
set xrange [0:10]
set yrange [0:10]
do for [a = 1: int(STATS_blocks - 1)] {
plot "bdata.txt" using 1:2 index a
pause 0.1
}

get points of listplot in mathematica

I have a few graphs which took quite some time for calculations. I would like to extract the data of those plots instead of recalculing a list. I found the command pts=Cases[(*I paste graph here*),x_Line:>First#x,Infinity];, which works fine for my line plots but not for listplots. How can I do the same for listplots?
It is essentially the same except for a scatter plot you use point:
Cases[(*pasted graphic*), x_Point :> First#x, Infinity]
It may be instructive to do
(*paste*)//FullForm
Of course you really ought to just save the data before generating the plot..

How can I visualize the 3D results from Femlab in Octave / Gnuplot?

I have some data from model in Femlab. Because I would like to work on the results more, I would like to use Octave / Gnuplot as well to visualize the computed data. I have exported the data from Femlab into a txt file in form "x y z value" (4 columns). Everything unsorted - than can I do. But how to get this into gnuplot? I can choose one of the variables to fix it(let's be it x) and plot the rest y,z and value by splot. But, I have thousand and thousand of numbers and this is not possible, than Femlab doesn't keep the variables fixed (so you sort it along x and find out that there are no two x values the same).
I know about Femlab / Matlab interface, but unfortunately I havent Matlab.
Thank you in advance!
Have you tried scilab? It is a matlab clone like octave and seems to support some FEM stuff: http://wiki.scilab.org/Finite%20Elements%20in%20Scilab.
See also http://www.utc.fr/lrm/giens05/CDROM/CDROM/lo01.pdf a paper where they interface Scilab and OpenFEM.

Resources