# Add axes etc to TGLParametricEquation

Hi all,

I’ve recently (today) found TGLParametricEquation. Very nice. My small question is if there is a simple way
to add axes and a “color code” to a plot? I hope the images I include says more than my 100 words…

I also include the very short script needed to reproduce the unmodified figure

cheers

Joa

glparametric.C (653 Bytes)

I think, I can add axes, but color palette is not interesting for you, since I calculate color not from your data, but from surface normals (there are several color schemes, which you can change by pressing ‘s’ or ‘S’ - this was done because I like such colored surfaces )

Hi again,

as for the palette, I didn’t really thinking… What I want to plot is the Phi component of field as a function of the r (spherical coordinates). The distance to origin in my plot is of course the magnitude of the Phi component, but it would be nice to color code the sign (i.e. two colors). That is, if it is parallel or anti parallel with the Phi basis vector. This would of course require an additional function. Or I’m just not thinking again…

cheers

Joa

[quote=“joa”]Hi again,

as for the palette, I didn’t really thinking… What I want to plot is the Phi component of field as a function of the r (spherical coordinates). The distance to origin in my plot is of course the magnitude of the Phi component, but it would be nice to color code the sign (i.e. two colors). That is, if it is parallel or anti parallel with the Phi basis vector. This would of course require an additional function. Or I’m just not thinking again…

cheers

Joa[/quote]

Can you, please, give your equations? And also describe how you want to select the color, according to this equation. I’ll try to make a generic solution for user-defined color palette.

Hi again,

this morning I tried to fix the color thing, see included patches, a script to test it and figure

cheers

Joa

glparametric.C (961 Bytes)
diffsrc.txt (3.81 KB)
diffinc.txt (1.32 KB)

You said, you want 2 colors, but there are more colors here.

Hi again,

yes, but I made a more general solution. If my color function is a sign function I get two colors… if I chose
a good color scheme with ‘S’

cheers

Joa
glparametric.C (1.06 KB)

[quote=“joa”]Hi again,

yes, but I made a more general solution. If my color function is a sign function I get two colors… if I chose
a good color scheme with ‘S’

cheers

Joa[/quote]

Ok, so you have colors you need

Yes, the colors are fine. If you give me a hint I could add axes as well, because I still need them. A palette might be thrown in while I’m at it

cheers

Joa

Hi again,

small modification to deal with situations where one has a function that always has the same sign

cheers

Joa
diffsrc.txt (3.88 KB)

I’ve added axes for parametric plot, it’s in trunk of ROOT now.