GNUPLOT Plotting 5 Day Financial Week

I've been looking for a while to find out how to remove days of the week from a financial plot without success.

I need a plot to just include the days of the week and skip the weekend altogether so that there is no two day gap in the financial card.

I have data in CSV format Open / Low / Close / High and it is missing weekend data, it works great but I cant find how not to show weekend, any help would be really appreciated.

I would like to say that M / T / W / T / F / M / T / W / T / F on X, not M / T / W / T / F / S / S / M, etc.

Greetings,

Chris.

+3


source to share


4 answers


As far as I know, this cannot be done with gnuplot - you need to bring the file to your desired shape earlier. If you are on Linux, this can be done with

awk '{if( index( $1, "S" ) == 0 ) print $0 >> "new.dat"}' old.dat

      



where old.dat

is your original file and new.dat

new file without days off. I assumed your data file has the day of the week as the first entry on each line.

This will work under Windows too, but you need to install Gawk for Windows first .

+1


source


The data is not displayed in the file, the file only works on weekdays and skips weekends. If you print the data you get those 2 day gaps on the weekend, so I want to remove those spaces. It more realistically has to do with the x-axis having weekends to make it linear.

Here's an example of part of a file:



2006-03-23T16: 59 1.7470 1.7324 1.7471 1.7344 0.0000 0.0000 0.0000 0.0000
2006-03-24T16: 59 1.7346 1.7308 1.7441 1.7428 0.0000 0.0000 0.0000 0.0000
2006-03-27T17: 59 1.7424 1.7415 1.7492 1.7459 0.0000 0.0000 0.0000 0.0000
2006-03-28T17 : 59 1.7462 1.7422 1.7537 1.7424 0.0000 0.0000 0.0000 0.0000

If you look at the dates, there are spaces in the file. There must be spaces because there is no data these days. However, the graph should work without spaces, which is exactly what I want to achieve.

0


source


Using some external tool (I would write for example a bash or a python script, it shouldn't be hard) you can insert weekend strings (one line per day) into your data file, like:

2006-03-26T00:00 NaN NaN NaN NaN NaN NaN NaN NaN

      

(or you can just add these NaN

for output at the end of the data file and use the keyword unique

)

and then write down, say, the first data with using 1:($2) with linespoints

, notusing 1:2 ...

This should work for you.

0


source


I just came across set xdtics

today. I doubt you are still working on this, but maybe it will be helpful for someone else ... (see help xdtics

)

0


source







All Articles