How draw a contour view on the top(or bottom) use TGraph2D?

void surf() {
gStyle->SetPalette(1);
TCanvas *c = new TCanvas(“c”,“Graph2D example”,600,600);

TGraph2D *g = new TGraph2D(“ja.txt”);

g->Draw(“tri1 p0 z”);
g->Draw(“same cont1”);
}
i want to draw a contour view on the top (or bottom) in TGraph2D,but it doesn’t work.
Why don’t run?>
Thanks!
surf.c (209 Bytes)
ja.txt (624 Bytes)

The way you do it can not work. That’s not implemented that way. I guess the best you can do is something like:

g->Draw("surf3 z");

[quote=“couet”]The way you do it can not work. That’s not implemented that way. I guess the best you can do is something like:

g->Draw("surf3 z"); [/quote]
i have used g->Draw(“surf3 z”);,but it still draw a rectangle plane in which no data, so i want to draw is all the data point connect a plane which is not a rectangle plane.
Why “surf3” draw a rectangle plane when there is no data?
When there is no data , i want root do not to draw the plane?

The macro you wrote is correct the contour are drawn in 3D.
If you want to draw the contour on top the only way is to use SURF3.
But SURF3 generate an histogram and draw the histogram that is why it appears that way.

Now you have to choose between 1) your macro , or 2 ) SURF3.

There is no other way for the time being.

[quote=“couet”]The macro you wrote is correct the contour are drawn in 3D.
If you want to draw the contour on top the only way is to use SURF3.
But SURF3 generate an histogram and draw the histogram that is why it appears that way.

Now you have to choose between 1) your macro , or 2 ) SURF3.

There is no other way for the time being.[/quote] :wink:

BUT, my macro is not work!
g->Draw(“tri1 p0 z”); works

g->Draw(“same cont1”); doesn’t works

No way to solve it ?
My God!

As I said in your macro the contour are not on top but they are drawn CORRECTLY in 3D…
Ok … ?
To Draw the contour on top use SURF3. I agre that is no exactly what you want but that is the only way to Draw on contours on top right now.

You CANNOT draw triangles AND contours on top.

[quote=“couet”]As I said in your macro the contour are not on top but they are drawn CORRECTLY in 3D…
Ok … ?
To Draw the contour on top use SURF3. I agre that is no exactly what you want but that is the only way to Draw on contours on top right now.

You CANNOT draw triangles AND contours on top.[/quote]

[color=blue]but they are drawn [size=150]CORRECTLY[/size] in 3D…[/color]
why they cann’t display?
It is strange!

Yes when you use the option SAME with the option CONT after a plot with option TRI the contours are drawn in 3D and there is no option to put them on top.