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
(6) |
Oct
(3) |
Nov
(2) |
Dec
|
|
From: Ethan A M. <eam...@gm...> - 2018-11-10 19:27:12
|
On Saturday, 10 November 2018 20:14:53 theozh wrote: > Thank you again! > I am not familiar with Win Powershell... would take a while to figure out. > > But do you have an idea why Method2 gets this space at the beginning of the line? "with table" places a " " character at the front of every field. This insures that the fields can be distinguish even if you mess up in specifying a field separator. Ethan > > ### Read file to datablock > reset session > FILE = "Test.dat" > set datafile separator "\n" > set datafile commentschar "" > > # Method2 > set table $Data2 > plot FILE u (stringcolumn(1)) with table > unset table > print $Data2 > > > Am 10.11.2018 um 19:30 schrieb Ethan A Merritt: > > On Saturday, 10 November 2018 19:02:12 theozh wrote: > >> Thanks, in priciple a nice idea. > >> But probably works only under Linux?! > >> I guess 'cat' doesn't exists in a simple Win7 system. > >> I tried with 'type' instead, but no success. > > > > I can't help with Windows. > > A quick bit of googling suggests that the equivalent of > > "cat" in the Windows PowerShell is "get-content". But I > > do not know whether that works from inside gnuplot. > > > > Ethan > > > > > > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info |
|
From: theozh <th...@gm...> - 2018-11-10 19:15:04
|
Thank you again!
I am not familiar with Win Powershell... would take a while to figure out.
But do you have an idea why Method2 gets this space at the beginning of the line?
### Read file to datablock
reset session
FILE = "Test.dat"
set datafile separator "\n"
set datafile commentschar ""
# Method2
set table $Data2
plot FILE u (stringcolumn(1)) with table
unset table
print $Data2
Am 10.11.2018 um 19:30 schrieb Ethan A Merritt:
> On Saturday, 10 November 2018 19:02:12 theozh wrote:
>> Thanks, in priciple a nice idea.
>> But probably works only under Linux?!
>> I guess 'cat' doesn't exists in a simple Win7 system.
>> I tried with 'type' instead, but no success.
>
> I can't help with Windows.
> A quick bit of googling suggests that the equivalent of
> "cat" in the Windows PowerShell is "get-content". But I
> do not know whether that works from inside gnuplot.
>
> Ethan
>
|
|
From: Ethan A M. <eam...@gm...> - 2018-11-10 18:30:39
|
On Saturday, 10 November 2018 19:02:12 theozh wrote: > Thanks, in priciple a nice idea. > But probably works only under Linux?! > I guess 'cat' doesn't exists in a simple Win7 system. > I tried with 'type' instead, but no success. I can't help with Windows. A quick bit of googling suggests that the equivalent of "cat" in the Windows PowerShell is "get-content". But I do not know whether that works from inside gnuplot. Ethan > > On Saturday, 10 November 2018 07:05:46 theozh wrote: > > Hi, I would like to read a file (as is) into a datablock. > > I basically found two ways to do this. See code below. > > I would do something very different. > > set print "head" > print "$Data1 << EOD" > set print "tail" > print "EOD" > unset print > > load "< cat head Test.dat tail" > print $Data1 > > Ethan |
|
From: theozh <th...@gm...> - 2018-11-10 18:02:29
|
Thanks, in priciple a nice idea. But probably works only under Linux?! I guess 'cat' doesn't exists in a simple Win7 system. I tried with 'type' instead, but no success. On Saturday, 10 November 2018 07:05:46 theozh wrote: > Hi, I would like to read a file (as is) into a datablock. > I basically found two ways to do this. See code below. I would do something very different. set print "head" print "$Data1 << EOD" set print "tail" print "EOD" unset print load "< cat head Test.dat tail" print $Data1 Ethan |
|
From: theozh <th...@gm...> - 2018-11-10 06:06:06
|
Hi, I would like to read a file (as is) into a datablock.
I basically found two ways to do this. See code below.
First question:
My concern is that in Method1 the file has to be read/accessed (row)-times from disk whereas Method2 only once. If I have a file with several thousands or million rows on a very slow network connection this probably would take rather long, correct? I currently cannot test.
Can anybody comment on this?
Second question:
When reading the file via Method2 the datablock contains a space at every beginning of the line.
Can anybody explain why and how to avoid? Bug or feature?
Assuming the file "Test.dat" looks for example like the following:
# Test.dat
# Some test data
# more comments
1 2 3
4 5 6
7 8 9
Here is the code:
### Read file to datablock
reset session
FILE = "Test.dat"
set datafile separator "\n"
set datafile commentschar ""
# Method1
stats FILE u 0 nooutput
set print $Data1
set table $Dummy
do for [row=0:STATS_records-1] {
plot FILE u (a=stringcolumn(1),a) every ::row::row with table
print a
}
unset table
set print
print $Data1
# Method2
set table $Data2
plot FILE u (stringcolumn(1)) with table
unset table
print $Data2
### end of code
|
|
From: Ethan M. <eam...@gm...> - 2018-11-08 22:07:10
|
On Thu, Nov 8, 2018 at 12:17 PM theozh <th...@gm...> wrote:
> Thank you, Ethan
> very interesting construct!
> For certain types of data it works.
>
> However, what I couldn't yet get to work is how to plot row data of the
> following type:
>
> $Data <<EOD
> # spectral data as function of time in rows
> Wav 400 500 600 700 800
> t01 1.1 1.2 1.3 1.4 1.5
> t02 2.1 2.2 2.3 2.4 2.5
> t03 3.1 3.2 3.3 3.4 3.5
> EOD
>
I have scripts that I use to plot *.csv files similar to this that are
generated
by a piece of equipment in the lab.
I agree that it would be nice to have an automatic "transpose" button or
command since opening up each *.csv file to do it in Excel is an annoying
detour. My gnuplot scripts, although ugly, can handle the raw files.
Your case is a little worse because the first column is non-numeric.
Nevertheless here is a modified version of one of my scripts that plots
your data by rows. Unfortunately the non-numeric 1st column causes it to
print warning messages.
Ugly? You bet. But it works, except for extracting labels from the row
headers.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$Data <<EOD
# spectral data as function of time in rows
Wav 400 500 600 700 800
t01 1.1 1.2 1.3 1.4 1.5
t02 2.1 2.2 2.3 2.4 2.5
t03 3.1 3.2 3.3 3.4 3.5
EOD
array xval[10]
stats $Data matrix using 1:(xval[$1+1]=$0,$0) every :::0::0 nooutput
cols = STATS_records
rows = |$Data| - 2
print cols, " X values: ", xval
set xrange [xval[2] : xval[cols]]
show xrange
set style data linespoints
plot for [row=1:rows] $Data matrix using (xval[$1+1]):($3) every
:::row::row title sprintf("Row %d",row)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
From: theozh <th...@gm...> - 2018-11-08 20:16:58
|
Thank you, Ethan very interesting construct! For certain types of data it works. However, what I couldn't yet get to work is how to plot row data of the following type: $Data <<EOD # spectral data as function of time in rows Wav 400 500 600 700 800 t01 1.1 1.2 1.3 1.4 1.5 t02 2.1 2.2 2.3 2.4 2.5 t03 3.1 3.2 3.3 3.4 3.5 EOD If the data was transposed, it would be very easy to plot. $Data <<EOD # spectra in columns Wav t01 t02 t03 400 1.1 2.1 3.1 500 1.2 2.2 3.2 600 1.3 2.3 3.3 700 1.4 2.4 3.4 800 1.5 2.5 3.5 EOD plot for [i=2:4] $Data u 1:i w lp So, a handy transpose function would be very helpful. Theo. |
|
From: Ethan A M. <eam...@gm...> - 2018-11-07 19:05:40
|
On Wednesday, 07 November 2018 08:13:40 theozh wrote:
> sometimes, data curves are available in rows and since gnuplot requires data in columns you would have to transpose your data, correct?
>
> Of course, you can transpose your data with external tools (Python, awk, ...), however, in some cases it might be easier to do this in gnuplot.
> I am not aware of a function in gnuplot which plots rows or a function which transposes data.
Obscure commands
================
plot nth row of data in a file
plot 'rowdata' matrix using 1:0 every :::n::n
store row n to an array, then plot it
array row_n[10]
stats 'rowdata' matrix using 1:(row_n[$1+1]=$0,$0) every :::n::n
plot row_n
These commands arose unintentionally out of the way "every" interacts with
"matrix". So far as I know they are undocumented, but the behavior is not
likely to change.
cheers,
Ethan
> So, I created the script below.
> I think it is neither very elegant nor efficient, but is seems to work.
> However, if you have to load the data from a file and transpose it this file needs to be loaded "Rows x Cols" times for every datapoint. Is it like that or will the file be kept in memory? This will be problematic if you have to load the data from a slow network drive.
> If anybody has a better solution please let me know.
>
> The script below will 1) create some dummy data 2) print the data 3) transpose it 4) print the transposed data
>
> ### transpose data
> reset session
>
> # create some dummy data
> Rows = 5
> Cols = 7
> set print $Data
> LINE = sprintf("%gx%g\t",Rows,Cols)
> # create header columns
> do for [j=1:Cols] {
> LINE = LINE.sprintf("x[%g]",j)
> if (j<Cols) {LINE = LINE."\t"}
> }
> print LINE
> do for [i=1:Rows] {
> LINE = ""
> do for [j=1:Cols] {
> LINE = LINE.sprintf("%g", (i-1)*Cols + j)
> if (j<Cols) {LINE = LINE."\t"}
> }
> LINE = sprintf("t[%g]\t",i).LINE
> print LINE
> }
> set print
> print $Data
> # end dummy data
>
> # transpose data
> set autoscale # autoscale before stats
> stats $Data u 0 nooutput
> set table $Dummy
> set print $Transposed
> do for [i=1:STATS_columns] {
> LINE = ""
> do for [j=0:STATS_records-1] {
> plot $Data u (a=stringcolumn(i),i) every ::j::j with table
> LINE = LINE.sprintf("%s", a)
> if (j < STATS_records-1) {LINE = LINE."\t"}
> }
> print LINE
> }
> set print
> unset table
> print $Transposed
> # end transpose data
|
|
From: theozh <th...@gm...> - 2018-11-07 07:14:02
|
sometimes, data curves are available in rows and since gnuplot requires data in columns you would have to transpose your data, correct?
Of course, you can transpose your data with external tools (Python, awk, ...), however, in some cases it might be easier to do this in gnuplot.
I am not aware of a function in gnuplot which plots rows or a function which transposes data.
So, I created the script below.
I think it is neither very elegant nor efficient, but is seems to work.
However, if you have to load the data from a file and transpose it this file needs to be loaded "Rows x Cols" times for every datapoint. Is it like that or will the file be kept in memory? This will be problematic if you have to load the data from a slow network drive.
If anybody has a better solution please let me know.
The script below will 1) create some dummy data 2) print the data 3) transpose it 4) print the transposed data
### transpose data
reset session
# create some dummy data
Rows = 5
Cols = 7
set print $Data
LINE = sprintf("%gx%g\t",Rows,Cols)
# create header columns
do for [j=1:Cols] {
LINE = LINE.sprintf("x[%g]",j)
if (j<Cols) {LINE = LINE."\t"}
}
print LINE
do for [i=1:Rows] {
LINE = ""
do for [j=1:Cols] {
LINE = LINE.sprintf("%g", (i-1)*Cols + j)
if (j<Cols) {LINE = LINE."\t"}
}
LINE = sprintf("t[%g]\t",i).LINE
print LINE
}
set print
print $Data
# end dummy data
# transpose data
set autoscale # autoscale before stats
stats $Data u 0 nooutput
set table $Dummy
set print $Transposed
do for [i=1:STATS_columns] {
LINE = ""
do for [j=0:STATS_records-1] {
plot $Data u (a=stringcolumn(i),i) every ::j::j with table
LINE = LINE.sprintf("%s", a)
if (j < STATS_records-1) {LINE = LINE."\t"}
}
print LINE
}
set print
unset table
print $Transposed
# end transpose data
|
|
From: Ethan M. <eam...@gm...> - 2018-11-05 21:24:12
|
n Mon, Nov 5, 2018 at 1:01 PM Ronaldo Mercado <r_m...@sk...> wrote: > Hello, > > I would like to test gnuplot as built for fedora. > https://bugzilla.redhat.com/show_bug.cgi?id=1476616 > > How would I verify whether the libcerf functions are working as expected? > Run the scripts complex_trig.dem and cerf.dem provided in the demo directory. Compare the output to the on-line demo collection http://gnuplot.sourceforge.net/demo_5.3/complex_trig.html http://gnuplot.sourceforge.net/demo_5.3/cerf.html Thank you. > > Ronaldo > > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > Membership management via: > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > |
|
From: Ronaldo M. <r_m...@sk...> - 2018-11-05 21:01:06
|
Hello, I would like to test gnuplot as built for fedora. https://bugzilla.redhat.com/show_bug.cgi?id=1476616 How would I verify whether the libcerf functions are working as expected? Thank you. Ronaldo |
|
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 -- |