it helps some times Add the palette option to your plot The palette option will automatically assign the color value from the current palette according to the value of the last column of your datafile (in this case it is the 7th column, where in ordinary function plots it will be the 3rd).
plot ... palette
set palette model RGB defined ( 0 "white", 1 "red")
plot[0:4][0:2] 'data.txt' w boxxy fs solid palette
it should still fix some issue I solve the problem using "set @Input" to trigger a function run once when I choose the third tab, instead of using ngOnInit(). Because inside Mat Tab, ngOnInit() function was executed while the components are not created yet.