You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(2) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(3) |
Feb
(1) |
Mar
(2) |
Apr
(22) |
May
(52) |
Jun
(43) |
Jul
(36) |
Aug
(59) |
Sep
(37) |
Oct
(55) |
Nov
(39) |
Dec
(36) |
| 2005 |
Jan
(64) |
Feb
(40) |
Mar
(62) |
Apr
(58) |
May
(256) |
Jun
(77) |
Jul
(80) |
Aug
(39) |
Sep
(56) |
Oct
(36) |
Nov
(113) |
Dec
(68) |
| 2006 |
Jan
(43) |
Feb
(64) |
Mar
(69) |
Apr
(60) |
May
(71) |
Jun
(53) |
Jul
(63) |
Aug
(63) |
Sep
(76) |
Oct
(85) |
Nov
(82) |
Dec
(73) |
| 2007 |
Jan
(75) |
Feb
(82) |
Mar
(84) |
Apr
(104) |
May
(67) |
Jun
(101) |
Jul
(107) |
Aug
(138) |
Sep
(128) |
Oct
(106) |
Nov
(112) |
Dec
(112) |
| 2008 |
Jan
(94) |
Feb
(87) |
Mar
(146) |
Apr
(169) |
May
(75) |
Jun
(26) |
Jul
(26) |
Aug
(7) |
Sep
(18) |
Oct
(53) |
Nov
(42) |
Dec
(19) |
| 2009 |
Jan
(43) |
Feb
(39) |
Mar
(18) |
Apr
(45) |
May
(66) |
Jun
(87) |
Jul
(56) |
Aug
(41) |
Sep
(56) |
Oct
(139) |
Nov
(98) |
Dec
(88) |
| 2010 |
Jan
(81) |
Feb
(79) |
Mar
(83) |
Apr
(97) |
May
(124) |
Jun
(84) |
Jul
(53) |
Aug
(85) |
Sep
(89) |
Oct
(50) |
Nov
(98) |
Dec
(78) |
| 2011 |
Jan
(97) |
Feb
(74) |
Mar
(68) |
Apr
(54) |
May
(63) |
Jun
(59) |
Jul
(65) |
Aug
(58) |
Sep
(37) |
Oct
(40) |
Nov
(59) |
Dec
(35) |
| 2012 |
Jan
(16) |
Feb
(56) |
Mar
(63) |
Apr
(25) |
May
(48) |
Jun
(58) |
Jul
(20) |
Aug
(13) |
Sep
(43) |
Oct
(35) |
Nov
(20) |
Dec
(17) |
| 2013 |
Jan
(22) |
Feb
(11) |
Mar
(51) |
Apr
(34) |
May
(57) |
Jun
(27) |
Jul
(70) |
Aug
(30) |
Sep
(38) |
Oct
(53) |
Nov
(40) |
Dec
(25) |
| 2014 |
Jan
(26) |
Feb
(35) |
Mar
(60) |
Apr
(12) |
May
(17) |
Jun
(15) |
Jul
(9) |
Aug
(18) |
Sep
(46) |
Oct
(18) |
Nov
(19) |
Dec
(15) |
| 2015 |
Jan
(17) |
Feb
(28) |
Mar
(21) |
Apr
(54) |
May
(36) |
Jun
(8) |
Jul
(30) |
Aug
(13) |
Sep
(3) |
Oct
(28) |
Nov
(3) |
Dec
(3) |
| 2016 |
Jan
(11) |
Feb
(9) |
Mar
(29) |
Apr
(10) |
May
(8) |
Jun
(5) |
Jul
(50) |
Aug
(57) |
Sep
(13) |
Oct
(5) |
Nov
(17) |
Dec
(11) |
| 2017 |
Jan
(3) |
Feb
(23) |
Mar
(16) |
Apr
(7) |
May
(15) |
Jun
(12) |
Jul
(48) |
Aug
(15) |
Sep
(3) |
Oct
(20) |
Nov
(28) |
Dec
(21) |
| 2018 |
Jan
(13) |
Feb
(21) |
Mar
(21) |
Apr
(7) |
May
(3) |
Jun
(7) |
Jul
(27) |
Aug
(38) |
Sep
(4) |
Oct
(30) |
Nov
(22) |
Dec
|
| 2019 |
Jan
(5) |
Feb
(16) |
Mar
(1) |
Apr
(9) |
May
(7) |
Jun
(20) |
Jul
(13) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(2) |
Dec
(4) |
| 2020 |
Jan
(6) |
Feb
(11) |
Mar
(1) |
Apr
(18) |
May
(4) |
Jun
(5) |
Jul
(12) |
Aug
(1) |
Sep
(3) |
Oct
(7) |
Nov
(1) |
Dec
(17) |
| 2021 |
Jan
(1) |
Feb
(11) |
Mar
(16) |
Apr
(6) |
May
(5) |
Jun
(1) |
Jul
(1) |
Aug
(2) |
Sep
(8) |
Oct
(10) |
Nov
(4) |
Dec
(4) |
| 2022 |
Jan
(9) |
Feb
(35) |
Mar
(4) |
Apr
|
May
(3) |
Jun
(49) |
Jul
(11) |
Aug
|
Sep
(5) |
Oct
(2) |
Nov
(16) |
Dec
(13) |
| 2023 |
Jan
|
Feb
(8) |
Mar
(3) |
Apr
|
May
(8) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(2) |
| 2024 |
Jan
(6) |
Feb
(9) |
Mar
|
Apr
(26) |
May
(24) |
Jun
|
Jul
(4) |
Aug
(2) |
Sep
(1) |
Oct
(10) |
Nov
(9) |
Dec
|
| 2025 |
Jan
|
Feb
(22) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(4) |
| 2026 |
Jan
|
Feb
(24) |
Mar
(20) |
Apr
(18) |
May
(2) |
Jun
(2) |
Jul
(2) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: ivana r. <iva...@mf...> - 2018-11-04 22:33:26
|
Hi Jon, the more powerfull gnuplot command than `` you are looking for, is named "system" good luck Iva On 04/11/2018, Jon <dev...@gm...> wrote: > Dear All, > > I would like to define a variable and then use it in the linux command > within a gnuplot script, how to successfully do that? An example is > provided below > > ========================== > set macro > pos=2 > tgt="`ls ../../.. | head -n pos | tail -n 1`" > set term pngcairo transparent color solid > set out @tgt.'_file.png' > p sin(x) > set out > ========================== > > note pos is the variable I would like to define in the script to be used in > the linux command > > ls ../../.. | head -n pos | tail -n 1 > > but it cannot be sent over. Is there way to realize the like functionality > within gnuplot? > > Thanks, > > Sincerely, > Jon > > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > Membership management via: > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > |
|
From: Jon <dev...@gm...> - 2018-11-04 21:22:47
|
Dear All, I would like to define a variable and then use it in the linux command within a gnuplot script, how to successfully do that? An example is provided below ========================== set macro pos=2 tgt="`ls ../../.. | head -n pos | tail -n 1`" set term pngcairo transparent color solid set out @tgt.'_file.png' p sin(x) set out ========================== note pos is the variable I would like to define in the script to be used in the linux command ls ../../.. | head -n pos | tail -n 1 but it cannot be sent over. Is there way to realize the like functionality within gnuplot? Thanks, Sincerely, Jon |
|
From: theozh <th...@gm...> - 2018-10-29 07:08:14
|
> > That is strange unexpected. > Are you sure you ran the new executable rather than the old one? > Strange. I was pretty sure I was running 5.2.5, it showed: Version 5.2 patchlevel 5 last modified 2018-10-06 Maybe, I had some other strange/special prior settings. If I can reproduce, I will post. Anyway, seems to work now :-) Thanks! |
|
From: Ethan A M. <eam...@gm...> - 2018-10-29 00:55:47
|
On Sunday, 28 October 2018 21:54:21 theozh wrote: > Thank you for your suggestions. > >> ad 4. if I use plot for [i=2:*] $Data... gnuplot get's stuck and does not respond anymore. Why? How to solve? > > > > That was a bug in the original 5.2 release. Fixed in 5.2.1 > > If you are stuck with 5.2.0 then a work-around would be to determine > > the number of columns first and use that explicitly rather than using *. > > > I just downloaded gnuplot 5.2.5 ... same issue! gnuplot blocked... when using plot for [i=2:*] ... That is strange unexpected. Are you sure you ran the new executable rather than the old one? When I run that series of commands on 5.2.5 I get a plot and no errors. When I run it on 5.2.2 or 5.2.3 I get the correct plot but it prints an informational message: Ending * iteration at 5 Ethan |
|
From: theozh <th...@gm...> - 2018-10-28 22:19:30
|
ok... you can get get the number of columns via stats $Data and STATS_columns.
The following code does what I intended to do.
(as long as there is only one headerline...)
### gnuplot code
reset session
$Data <<EOD
xxxx ColA ColB ColC ColD
Row1 1.10 1.20 1.30 1.40
Row2 2.10 2.20 2.30 2.40
Row3 3.10 3.20 3.30 3.40
Row4 4.10 4.20 4.30 4.40
EOD
stats $Data u 0 nooutput
ColCount = STATS_columns
RowCount = STATS_records
set xrange[-0.5:ColCount-1.5]
set yrange[-0.5:RowCount-1.5]
plot for [j=2:ColCount] \
$Data using (j-2) \
: ($0-1) \
: (column(j)/10.) \
: ytic(1) \
: xtic(columnhead(j)) with circles notitle,\
for [j=2:ColCount] \
$Data using (j-2):($0-1):(stringcolumn(j)) with labels notitle
### end code
|
|
From: theozh <th...@gm...> - 2018-10-28 20:54:30
|
Thank you for your suggestions. >> ad 4. if I use plot for [i=2:*] $Data... gnuplot get's stuck and does not respond anymore. Why? How to solve? > > That was a bug in the original 5.2 release. Fixed in 5.2.1 > If you are stuck with 5.2.0 then a work-around would be to determine > the number of columns first and use that explicitly rather than using *. > I just downloaded gnuplot 5.2.5 ... same issue! gnuplot blocked... when using plot for [i=2:*] ... How would you actually determine the number of columns of a datafile? |
|
From: Ethan A M. <eam...@gm...> - 2018-10-28 20:09:01
|
On Sunday, 28 October 2018 12:53:35 theozh wrote:
> It should be a rather simple task, but I have several problems (using gnuplot 5.2rc4, Win7)
> Imagine the following data:
>
$Data <<EOD
xxxx ColA ColB ColC ColD
Row1 1.10 1.20 1.30 1.40
Row2 2.10 2.20 2.30 2.40
Row3 3.10 3.20 3.30 3.40
Row4 4.10 4.20 4.30 4.40
EOD
>
> The tasks and questions are:
> 1. plot circles with size which correspond to the datanumber and at a position which correspond to the number of col and row of datafield
So you want column# for x and row# for y?
set key autotitle columnhead # Tells gnuplot the first row is not data
unset key # But we aren't really using it for the key
set xrange [0:5]; set yrange [0:5]
plot for [j=2:5] $Data using (real(j-1)):($0+1):(column(j)/10.) with circles
> 2. take ytics from the first column
Same plot command but add :ytic(1)
> 3. take xtics from the first row
Same plot but add :xtic(columnhead(j))
> 4. the number of columns can depend on the datafile. How to autmatically account for this?
set key autotitle columnhead
unset key
set style data circles
set xrange [0:5]; set yrange [0:5]
plot for [j=2:*] $Data using (real(j-1)) \
: (column(0)+1) \
: (column(j)/10.) \
: ytic(1) \
: xtic(columnhead(j))
> 5. how to adjust the right xrange and yrange (i.e., such that the Row1 and Row2 ytics are not at the very edge of the graph.
>
> ad 1. ok
> ad 2. ok
> ad 3. how do I put columnheader not as key but as xtics? Had no success with columnhead(x)
> ad 4. if I use plot for [i=2:*] $Data... gnuplot get's stuck and does not respond anymore. Why? How to solve?
That was a bug in the original 5.2 release. Fixed in 5.2.1
If you are stuck with 5.2.0 then a work-around would be to determine
the number of columns first and use that explicitly rather than using *.
Ethan
> ad 5. maybe there is a way without doing stats $Data first?
>
> I tried with the code below. Thank you for hints.
>
>
> ### gnuplot code
> reset session
>
> $Data <<EOD
> xxxx ColA ColB ColC ColD
> Row1 1.10 1.20 1.30 1.40
> Row2 2.10 2.20 2.30 2.40
> Row3 3.10 3.20 3.30 3.40
> Row4 4.10 4.20 4.30 4.40
> EOD
>
> stats $Data u 0 nooutput
> set yrange[STATS_min-0.5:STATS_max-0.5]
>
> plot for [i=2:5] $Data u (i-2):0:(column(i)/10.):ytic(1) every ::1 with circles notitle
> ### end code
|
|
From: theozh <th...@gm...> - 2018-10-28 18:24:25
|
... in the meantime I think I have found a way to display the columnheaders as xtics.
A pretty strange workaround, and I am pretty sure there must be a simpler way.
Still, the issue with
plot for [i=2:*] $Data u ...
remains. Gnuplot will be blocked...
# put the columnheaders into xtics
...
set xtics ("" 0) # remove all tics
set table $Nowhere
do for [i=2:5] {
plot $Data u (head=stringcolumn(i),0) every ::0::0 with table
set xtics add (head i-2)
}
unset table
...
###
|
|
From: theozh <th...@gm...> - 2018-10-28 11:53:48
|
It should be a rather simple task, but I have several problems (using gnuplot 5.2rc4, Win7) Imagine the following data: $Data <<EOD xxxx ColA ColB ColC ColD Row1 1.10 1.20 1.30 1.40 Row2 2.10 2.20 2.30 2.40 Row3 3.10 3.20 3.30 3.40 Row4 4.10 4.20 4.30 4.40 EOD The tasks and questions are: 1. plot circles with size which correspond to the datanumber and at a position which correspond to the number of col and row of datafield 2. take ytics from the first column 3. take xtics from the first row 4. the number of columns can depend on the datafile. How to autmatically account for this? 5. how to adjust the right xrange and yrange (i.e., such that the Row1 and Row2 ytics are not at the very edge of the graph. ad 1. ok ad 2. ok ad 3. how do I put columnheader not as key but as xtics? Had no success with columnhead(x) ad 4. if I use plot for [i=2:*] $Data... gnuplot get's stuck and does not respond anymore. Why? How to solve? ad 5. maybe there is a way without doing stats $Data first? I tried with the code below. Thank you for hints. ### gnuplot code reset session $Data <<EOD xxxx ColA ColB ColC ColD Row1 1.10 1.20 1.30 1.40 Row2 2.10 2.20 2.30 2.40 Row3 3.10 3.20 3.30 3.40 Row4 4.10 4.20 4.30 4.40 EOD stats $Data u 0 nooutput set yrange[STATS_min-0.5:STATS_max-0.5] plot for [i=2:5] $Data u (i-2):0:(column(i)/10.):ytic(1) every ::1 with circles notitle ### end code |
|
From: Ethan A M. <eam...@gm...> - 2018-10-20 18:58:30
|
On Saturday, 20 October 2018 10:18:54 theozh wrote:
> Thank you, Ethan, for your hint.
> ah, once again the powerful ternary operator ;-)
> Theo.
>
> The first example gets the first x value where y(x) is above the threshold and the last x value where y(x) is still below the threshold.
> Actually, this method could also be used to find FWHM of spectral data (see second example). However, if the spectrum is a Gaussian or Lorentzian or whatever peak, fitting with appropriate parameters might probably give better results.
I have been thinking about the possibility of somehow providing a window
into the sequence of data points, always centered about the "current" point
when plotting. I don't know how this would work exactly, but I am imagining
something like a reserved array name "window" that could only be accessed
only from inside a smoothing function.
For example to produce a running average over 5 points:
Avg(N) = 1/N * sum [i=1:N] window[i]
plot 'data' using 1:2 smooth window Avg(5)
Your case is a bit more complicated, but having the local data
points in an array rather than in a mess of separate variables
maintained by the ternary operator seems like it would be a win.
Thoughts or suggestions welcome.
Ethan
> First example:
>
> ### find x range when data passes a certain threshold
> # getting the first x value where y(x) is above the threshold
> # and the last x value wher y(x) is below the threshold
> reset session
> # generate some dummy data
> set print $Data
> do for [i=1:100] {
> print sprintf("%g %.3f",i*2+rand(0), rand(0)*20+i)
> }
> set print
>
> Threshold = 50
>
> set table $Dummy
> plot $Data u 1:($2<Threshold ? ($2) : NaN):($2>=Threshold ? ($2) : NaN) with table
> unset table
> # print $Dummy
>
> stats $Dummy u 1:3 nooutput
> Min_x = STATS_min_x
> stats $Dummy u 1:2 nooutput
> Max_x = STATS_max_x
>
> set label sprintf("min: %.1f, max: %.1f", Min_x, Max_x) at Min_x, Threshold+20 center
>
> set key top left
> plot $Data using 1:2 with lp lt 6, \
> Threshold w l,\
> $Dummy u 1:2 w impulse lc rgb "green",\
> $Dummy u 1:3 w impulse lc rgb "red"
> ### end of code
>
>
> Second example:
> ### find Full Width at Half Maximum (FWHM)
> reset session
> # generate some dummy data
> set print $Data
> Intensity = rand(0)*100
> Position = rand(0)*200+480
> Width = rand(0)*50+50
> do for [i=380:780] {
> print sprintf("%g %.3f",i, Intensity*exp(-((i-Position)/Width)**2)+rand(0)*Intensity*0.1)
> }
> set print
>
> stats $Data nooutput
> Int_max = STATS_max_y
> set table $Dummy
> plot $Data u (Peak=$1,$1) every ::STATS_index_max_y::STATS_index_max_y with table
> unset table
> Threshold = 0.5*Int_max
>
> set table $FWHM
> plot $Data u ($2>=Threshold ? ($1) : NaN):($2>=Threshold ? Threshold : NaN) with table
> unset table
> stats $FWHM nooutput
> FWHM = STATS_max_x - STATS_min_x
>
> reset
> set label 1 sprintf("Peak %.1f", Peak) at Peak*1.1, Int_max*0.95 center boxed
> set label 2 sprintf("FWHM %.1f", FWHM) at Peak, Threshold*1.1 center boxed
> set arrow 1 nohead from Peak,graph 0 to Peak,Int_max
> set yrange[*:*]
>
> plot $Data using 1:2 with l lc rgb "red" t "Spectrum", \
> $FWHM using 1:2 w l lc rgb "blue" not
>
> ### end of code
|
|
From: theozh <th...@gm...> - 2018-10-20 08:19:08
|
Thank you, Ethan, for your hint.
ah, once again the powerful ternary operator ;-)
Theo.
The first example gets the first x value where y(x) is above the threshold and the last x value where y(x) is still below the threshold.
Actually, this method could also be used to find FWHM of spectral data (see second example). However, if the spectrum is a Gaussian or Lorentzian or whatever peak, fitting with appropriate parameters might probably give better results.
First example:
### find x range when data passes a certain threshold
# getting the first x value where y(x) is above the threshold
# and the last x value wher y(x) is below the threshold
reset session
# generate some dummy data
set print $Data
do for [i=1:100] {
print sprintf("%g %.3f",i*2+rand(0), rand(0)*20+i)
}
set print
Threshold = 50
set table $Dummy
plot $Data u 1:($2<Threshold ? ($2) : NaN):($2>=Threshold ? ($2) : NaN) with table
unset table
# print $Dummy
stats $Dummy u 1:3 nooutput
Min_x = STATS_min_x
stats $Dummy u 1:2 nooutput
Max_x = STATS_max_x
set label sprintf("min: %.1f, max: %.1f", Min_x, Max_x) at Min_x, Threshold+20 center
set key top left
plot $Data using 1:2 with lp lt 6, \
Threshold w l,\
$Dummy u 1:2 w impulse lc rgb "green",\
$Dummy u 1:3 w impulse lc rgb "red"
### end of code
Second example:
### find Full Width at Half Maximum (FWHM)
reset session
# generate some dummy data
set print $Data
Intensity = rand(0)*100
Position = rand(0)*200+480
Width = rand(0)*50+50
do for [i=380:780] {
print sprintf("%g %.3f",i, Intensity*exp(-((i-Position)/Width)**2)+rand(0)*Intensity*0.1)
}
set print
stats $Data nooutput
Int_max = STATS_max_y
set table $Dummy
plot $Data u (Peak=$1,$1) every ::STATS_index_max_y::STATS_index_max_y with table
unset table
Threshold = 0.5*Int_max
set table $FWHM
plot $Data u ($2>=Threshold ? ($1) : NaN):($2>=Threshold ? Threshold : NaN) with table
unset table
stats $FWHM nooutput
FWHM = STATS_max_x - STATS_min_x
reset
set label 1 sprintf("Peak %.1f", Peak) at Peak*1.1, Int_max*0.95 center boxed
set label 2 sprintf("FWHM %.1f", FWHM) at Peak, Threshold*1.1 center boxed
set arrow 1 nohead from Peak,graph 0 to Peak,Int_max
set yrange[*:*]
plot $Data using 1:2 with l lc rgb "red" t "Spectrum", \
$FWHM using 1:2 w l lc rgb "blue" not
### end of code
|
|
From: Ethan M. <eam...@gm...> - 2018-10-18 21:48:42
|
On Thu, Oct 18, 2018 at 12:51 PM theozh <th...@gm...> wrote:
>
> you're right, I wasn't clear. There are several possibilities. I'll try
> again.
> Actually, I had in mind either a point or range where you would say it
> "passes" the threshold.
> Assuming, as in the example, increasing (noisy) data values.
>
> a) range between two values:
> the first x1 value where y(x1) is above the threshold and the last value
> x2>x1 where y(x2) is below the threshold
>
> b) one value:
> where your "eye would say" this x value is the "crossing" of the threshold
> line.
> This probably would be a linear interpolation around the threshold value.
> > 4) for what x values is y(x) closer to threshold than both y(x-1) and
> y(x+1)?> Solutions to that do not necessarily involve crossing the
> threshold value at all.you're right, I assumed that a crossing exists.
>
> One value (version b) or a two values (version a) would be enough.
>
Here is a proof-of-principle example based on running_avg.dem.
set key fixed right center vertical Left reverse autotitle box
set key invert samplen 4 spacing 1
set xtics 10
set ytics
set title "Demonstrate use of assignment and serial evaluation
operators\nto accumulate statistics as su
ccessive data lines are read in\n"
set xrange [ 0.00000 : 57.0000 ] noreverse nowriteback
filter(this) = (prev < threshold) && (this >= threshold)
prev = 999.
threshold = 4.4
datafile = "silver.dat"
plot datafile using 0:3 with lp, \
'' using 0:(filter($3) ? ($3) : NaN) : (prev=$3) with impulse, \
threshold with lines
#
# Now save them to a table
#
prev = 999.
set table $HITS
plot datafile using 0:(filter($3) ? ($3) : NaN) : (prev=$3) with impulse
unset table
print $HITS
|
|
From: theozh <th...@gm...> - 2018-10-18 19:51:18
|
you're right, I wasn't clear. There are several possibilities. I'll try again. Actually, I had in mind either a point or range where you would say it "passes" the threshold. Assuming, as in the example, increasing (noisy) data values. a) range between two values: the first x1 value where y(x1) is above the threshold and the last value x2>x1 where y(x2) is below the threshold b) one value: where your "eye would say" this x value is the "crossing" of the threshold line. This probably would be a linear interpolation around the threshold value. > 4) for what x values is y(x) closer to threshold than both y(x-1) and y(x+1)?> Solutions to that do not necessarily involve crossing the threshold value at all.you're right, I assumed that a crossing exists. One value (version b) or a two values (version a) would be enough. |
|
From: Ethan A M. <eam...@gm...> - 2018-10-18 19:08:53
|
On Thursday, 18 October 2018 20:45:18 theozh wrote: > Hi, > I would like to find the x-value of some data when its y-value passes a certain threshold. Not clear. Do you want one of these? 1) a list of all x values for which y(x) > threshold 2) an interpolated y value for each pair of x, x+1 where y(x) and y(x+1) are on opposite sides of the threshold 3) only the leading edge where y(x) < threshold and y(x+1) > threshold > The curves can be very different, so I think that fitting to a certain function is probably not a solution. > I know gnuplot is probably not made for that and other tools should be used. However, sometimes it is very convenient if there is a pure gnuplot solution. > The basic idea is: > Subtracting the threshold from the data, take the square of this and look for the minimum. I doubt that is what you really want. It answers yet another question: 4) for what x values is y(x) closer to threshold than both y(x-1) and y(x+1)? Solutions to that do not necessarily involve crossing the threshold value at all. > Maybe, I am trying way too complicated? If there are better ways please let me know. It depends on what do you want to do with a value when you find it. Do you need all points that satisfy your criterion or would any single point suffice? Ethan -- |
|
From: theozh <th...@gm...> - 2018-10-18 19:00:26
|
sorry, there were errors in the code.
This should work now...
### finding thresholds with gnuplot
reset
# generate some dummy data
set print $Data
do for [i=1:100] {
print sprintf("%g %.3f",i*2+rand(0), rand(0)*10+i)
}
set print
print $Data
THRESHOLD = 60
set multiplot layout 2,1
set key top left
# $Dummy holds (difference to threshold) squared
set table $Dummy
plot $Data u 1:(($2-THRESHOLD)**2) with table
unset table
set logscale y
plot $Dummy u 1:2 w l
# find minimum with stats
stats $Dummy u 1:2 nooutput
MINIMUM = STATS_index_min_y
# find x and y value of $Data
set table $Dummy
plot $Data u (MIN_X=$1,$1):(MIN_Y=$2,$2) every ::MINIMUM::MINIMUM with table
unset table
set label 1 sprintf("Value %g at %g",MIN_Y, MIN_X) at graph 0.5, graph 0.9
set arrow 1 from first MIN_X, graph 0 to first MIN_X, THRESHOLD
unset logscale y
plot $Data u 1:2, THRESHOLD w l
unset multiplot
### end gnuplot code
|
|
From: theozh <th...@gm...> - 2018-10-18 18:45:32
|
Hi,
I would like to find the x-value of some data when its y-value passes a certain threshold.
The curves can be very different, so I think that fitting to a certain function is probably not a solution.
I know gnuplot is probably not made for that and other tools should be used. However, sometimes it is very convenient if there is a pure gnuplot solution.
The basic idea is:
Subtracting the threshold from the data, take the square of this and look for the minimum.
Maybe, I am trying way too complicated? If there are better ways please let me know.
Thanks, Theo.
The following sample generates some simple dummy data to illustrate.
### finding thresholds with gnuplot
reset
# generate some dummy data
set print $Data
do for [i=1:100] {
print sprintf("%g %.3f",i*2+rand(0), rand(0)*10+i)
}
set print
print $Data
THRESHOLD = 60
# $Data2 holds (difference to threshold) squared
set table $Dummy
plot $Data u 1:(($2-THRESHOLD)**2) with table
unset table
# find minimum with stats
stats $Data2 u 1:2 nooutput
MINIMUM = STATS_index_min_y
# find x and y value of $Data
set table $Dummy
plot $Data u (MIN_X = $1,1):(MIN_Y=$2,$2) every ::MINIMUM::MINIMUM with table
unset table
set key top left
set multiplot layout 2,1
set label 1 sprintf("Value %g at %g",MIN_Y, MIN_X) at graph 0.5, graph 0.9
set arrow 1 from first MIN_X, graph 0 to first MIN_X, THRESHOLD
unset logscale y
plot $Data u 1:2, THRESHOLD w l
set logscale y
plot $Data2 u 1:2 w l
unset multiplot
### end gnuplot code
|
|
From: Patrick D. <pd...@gm...> - 2018-10-14 06:14:57
|
>
> On Sunday, 14 October 2018 05:34:59 Patrick Dupre wrote:
> > >
> > > On Sunday, 14 October 2018 03:39:38 Patrick Dupre wrote:
> > > > y_lin(x,a) = a * x
> > > > set table "tmp.asc" ; plot [-10:10] '+' u 1:(y_lin (x,2)) with table ; unset table
> > > > set table "tmp.asc" ; plot [-10:10] '+' u (sprintf("%g",$1)):(y_lin (x,2)) with table ; unset table
> > >
> > > Those both produce the same output for me when tested with
> > > versions 5.2.0 5.2.5 (current) and development version 5.3
> > >
> > > I do see NaN output fields when testing with version 5.0.7
> > >
> > > So if you are running 5.0 I think the answer is that "with table" didn't
> > > gain the ability to handle string data columns until version 5.2
> > > If you are running 5.2 please tell us the precise gnuplot version
> > > and operating system environment you are running.
> > >
> > > Ethan
> > >
> > I am running 5.0.6 from the fedora 28 distribution
> > It looks like than even fedora 29 comes with the version 5.0.6
>
> Huh. I had the impression that Fedora was known for "bleeding edge"
> software versions.
>
> Since gnuplot 5.2 came out more than a year ago I would have thought
> it would have been picked up by now. FWIW Ubuntu and Mageia are both
> on 5.2.2 for their "upcoming release" spins, and OpenSUSE is fully current
> at 5.2.5. Maybe it would be worth poking the Fedora packaging team?
>
> Ethan
https://bugzilla.redhat.com/show_bug.cgi?id=1457252
https://bugzilla.redhat.com/show_bug.cgi?id=1476616
|
|
From: Ethan A M. <eam...@gm...> - 2018-10-14 04:15:56
|
On Sunday, 14 October 2018 05:34:59 Patrick Dupre wrote:
> >
> > On Sunday, 14 October 2018 03:39:38 Patrick Dupre wrote:
> > > y_lin(x,a) = a * x
> > > set table "tmp.asc" ; plot [-10:10] '+' u 1:(y_lin (x,2)) with table ; unset table
> > > set table "tmp.asc" ; plot [-10:10] '+' u (sprintf("%g",$1)):(y_lin (x,2)) with table ; unset table
> >
> > Those both produce the same output for me when tested with
> > versions 5.2.0 5.2.5 (current) and development version 5.3
> >
> > I do see NaN output fields when testing with version 5.0.7
> >
> > So if you are running 5.0 I think the answer is that "with table" didn't
> > gain the ability to handle string data columns until version 5.2
> > If you are running 5.2 please tell us the precise gnuplot version
> > and operating system environment you are running.
> >
> > Ethan
> >
> I am running 5.0.6 from the fedora 28 distribution
> It looks like than even fedora 29 comes with the version 5.0.6
Huh. I had the impression that Fedora was known for "bleeding edge"
software versions.
Since gnuplot 5.2 came out more than a year ago I would have thought
it would have been picked up by now. FWIW Ubuntu and Mageia are both
on 5.2.2 for their "upcoming release" spins, and OpenSUSE is fully current
at 5.2.5. Maybe it would be worth poking the Fedora packaging team?
Ethan
|
|
From: Patrick D. <pd...@gm...> - 2018-10-14 04:01:43
|
> >
> > On Sunday, 14 October 2018 03:39:38 Patrick Dupre wrote:
> > > y_lin(x,a) = a * x
> > > set table "tmp.asc" ; plot [-10:10] '+' u 1:(y_lin (x,2)) with table ; unset table
> > > set table "tmp.asc" ; plot [-10:10] '+' u (sprintf("%g",$1)):(y_lin (x,2)) with table ; unset table
> >
> > Those both produce the same output for me when tested with
> > versions 5.2.0 5.2.5 (current) and development version 5.3
> >
> > I do see NaN output fields when testing with version 5.0.7
> >
> > So if you are running 5.0 I think the answer is that "with table" didn't
> > gain the ability to handle string data columns until version 5.2
> > If you are running 5.2 please tell us the precise gnuplot version
> > and operating system environment you are running.
> >
> > Ethan
> >
> I am running 5.0.6 from the fedora 28 distribution
> It looks like than even fedora 29 comes with the version 5.0.6
>
Actually, I had to recompile the version of the distribution to get the cwerf function.
I guess that I have to do the same with the version 5.2
> _______________________________________________
> gnuplot-info mailing list
> gnu...@li...
> Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>
|
|
From: Patrick D. <pd...@gm...> - 2018-10-14 03:35:09
|
>
> On Sunday, 14 October 2018 03:39:38 Patrick Dupre wrote:
> > y_lin(x,a) = a * x
> > set table "tmp.asc" ; plot [-10:10] '+' u 1:(y_lin (x,2)) with table ; unset table
> > set table "tmp.asc" ; plot [-10:10] '+' u (sprintf("%g",$1)):(y_lin (x,2)) with table ; unset table
>
> Those both produce the same output for me when tested with
> versions 5.2.0 5.2.5 (current) and development version 5.3
>
> I do see NaN output fields when testing with version 5.0.7
>
> So if you are running 5.0 I think the answer is that "with table" didn't
> gain the ability to handle string data columns until version 5.2
> If you are running 5.2 please tell us the precise gnuplot version
> and operating system environment you are running.
>
> Ethan
>
I am running 5.0.6 from the fedora 28 distribution
It looks like than even fedora 29 comes with the version 5.0.6
|
|
From: Ethan A M. <eam...@gm...> - 2018-10-14 03:01:27
|
On Sunday, 14 October 2018 03:39:38 Patrick Dupre wrote:
> y_lin(x,a) = a * x
> set table "tmp.asc" ; plot [-10:10] '+' u 1:(y_lin (x,2)) with table ; unset table
> set table "tmp.asc" ; plot [-10:10] '+' u (sprintf("%g",$1)):(y_lin (x,2)) with table ; unset table
Those both produce the same output for me when tested with
versions 5.2.0 5.2.5 (current) and development version 5.3
I do see NaN output fields when testing with version 5.0.7
So if you are running 5.0 I think the answer is that "with table" didn't
gain the ability to handle string data columns until version 5.2
If you are running 5.2 please tell us the precise gnuplot version
and operating system environment you are running.
Ethan
|
|
From: Patrick D. <pd...@gm...> - 2018-10-14 01:39:48
|
===========================================================================
Patrick DUPRÉ | | email: pd...@gm...
Laboratoire de Physico-Chimie de l'Atmosphère | |
Université du Littoral-Côte d'Opale | |
Tel. (33)-(0)3 28 23 76 12 | | Fax: 03 28 65 82 44
189A, avenue Maurice Schumann | | 59140 Dunkerque, France
===========================================================================
> Sent: Saturday, October 13, 2018 at 7:16 PM
> From: "Ethan A Merritt" <eam...@gm...>
> To: gnu...@li...
> Cc: "Patrick Dupre" <pd...@gm...>
> Subject: Re: [Gnuplot-info] sprintf
>
> On Friday, 12 October 2018 03:08:49 Patrick Dupre wrote:
> > Hello,
> >
> > When I use:
> > set table "0f_Lor_fitted.asc" ; plot [x_min:x_max] '+' u 1:(ampl*Lor_D(x-x0,W)+offset+y_lin(x-x0,slope)) with table ; unset table
> >
> > I get a proper file.
> > But, when I do (to get more control on the data format)
> >
> > set table "0f_Lor_fitted.asc" ; plot [x_min:x_max] '+' u (sprintf("%g,$1)):(ampl*Lor_D(x-x0,W)+offset+y_lin(x-x0,slope)) with table ; unset table
> >
> > I get:
> > nan
> > instead of the expected value.
> >
> > I thought that I did like it is described in the manual.
> > What did I miss?
>
> When I try to reproduce this problem I get an error because
> there is a missing quote to terminate "%g". If I add the
> quote, then it works with no error. But I had to invent
> functions and constants fro ampl Lor_D W and so on.
> Can you either provide the full script or reduce the problem
> to a stand-alone command?
Here is an example
y_lin(x,a) = a * x
set table "tmp.asc" ; plot [-10:10] '+' u 1:(y_lin (x,2)) with table ; unset table
set table "tmp.asc" ; plot [-10:10] '+' u (sprintf("%g",$1)):(y_lin (x,2)) with table ; unset table
|
|
From: theozh <th...@gm...> - 2018-10-13 22:21:05
|
Thank you for your comments. @John > Does this help? > https://stackoverflow.com/questions/17791828/gnuplot-date-time-in-x-axis No, not helpful in my case. @Alan well, in my 5.2 manual there is %U and %w but no %u. I'm not sure if it can be used for what I want to achieve. My current solution looks like the following (see example below). If it can be done simpler, I would be happy to learn about it. Disadvantage: I have to set xtics manually and don't see how to set mxtics. ### plot as a function of weekday reset $BirthData <<EOD # "%a" "%d.%m.%Y" "%H:%M:%S" "SomeValue" "time in s from 1.1.1970" Mon 13.02.1922 12:34:34 85.3 -1511004326.0 Tue 15.5.1962 04:12:18 73.1 -240868062.0 Wed 11.08.1948 09:12:56 97.3 -675010024.0 Thu 01.01.1970 00:00:00 32.7 0.0 Fri 31.12.1999 09:09:09 5.3 946631349.0 Sat 13.10.2018 18:45:01 45.2 1539456301.0 Sun 15.5.1966 04:12:18 17.4 -114637662.0 EOD set multiplot layout 2,1 set xdata time set format x "%Y" plot $BirthData u (timecolumn(2,"%d.%m.%Y")):4 lt 6 lc rgb "blue" # define formula Weekdaytime(t) = (floor(t/86400. + 3.)%7 + 7)%7 + t/86400. - floor(t/86400.) # 86400 seconds per day # 0=Mon, 1=Tue, 2=Wed, 3=Thu, 4=Fri, 5=Sat, 6=Sun # (... %7+7)%7 to account for negative time before 1.1.1970 # add 3 days because time=0 is 1.1.1970 and was a Thursday set xdata set format "%g" set xrange[0:7] set xtics ("Mon" 0, "Tue" 1, "Wed" 2, "Thu" 3, "Fri" 4, "Sat" 5, "Sun" 6) plot $BirthData u (Weekdaytime(timecolumn(2,"%d.%m.%Y %H:%M:%S"))):4 lt 6 lc rgb "red" not unset multiplot ### end of code |
|
From: Ethan A M. <eam...@gm...> - 2018-10-13 18:16:49
|
On Saturday, 13 October 2018 19:19:29 Gunter Königsmann wrote: > Many compilers nowadays output warnings on encountering sprintf instead of an snprintf... This particular "sprintf" is a gnuplot internal function that does type checking of the gnuplot user variables and then wraps calls to a C library snprintf. Ethan |
|
From: Gunter K. <gu...@pe...> - 2018-10-13 17:19:42
|
Many compilers nowadays output warnings on encountering sprintf instead of an snprintf... -- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet. |