TProfile: make lines connect to only non-empty bins

Hello,

I wish to make a TProfile that connects the bins with lines, but ignores the empty bins between filled bins. I am using a TProfile as I am plotting in log space, and want the higher x values to be averaged into bins in that log space. A simplified macro of my issue is below.

vector<int> vX = {1,2,3};
vector<int> vY = {3,25,33};

TProfile* p = new TProfile("","",10,log10(1),log10(4));
for (int i =0; i<3; i++) {
	p->Fill(log10(vX[i]), log10(vY[i]));
}
p->Draw("hist l");

I have also attached the output of the above macro.

How can I have lines without them connecting to empty bins?

Thanks for the help,
Jason
1.pdf (13.3 KB)

The best is to collect the X and Y values of the non empty bins in two vectors (X and Y) and make a TGraph with them.