1

i tried to configure my own custom y-axis for a little more advanced axis (norm probability plot, for the result look at the linked png) :

http://img5.fotos-hochladen.net/uploads/labelmisaligned2cd86m4qov.png

the tick mode is set to 'manual'. I want the tick lines to direct inwards, which looks sometimes a little more 'professional' in plots for scientific topics). so i set the TickLength property to -0.5 (but the issue does not depend on the direction). there is no "inwards" property, at least i couldnt find one, so i tried this idea, which worked for the tick lines. With this configuration the tick labels are not anymore properly aligned with the axis (see image). so i played a little with the anchor and position properties. the position property of an individual tick is set by

    tick.Label.Position = new Vector3(2f, 0, 0);

The problem is, this property has no effect. so i searched in the original source code for the code that causes this problem and i found it. the position property is overwritten all the time the axis is constructed by some values that only depend on the origins of the "world" and the positions of the tick lines. the custom position setting is erased.

so my question is:

  • is this behaviour intended or a bug?
  • and if it is no bug, how can i allign my axis tick label so that it is well alligned with the axis line ?

To wrap it up: The position property of the ticks label has no effect. The automatic text alignment is 'ok' when i use the standard tick direction (although it would be nice to have the ability to control the text to axis distance and the right/left alignment of the text itself (text block alignment) even for this case). If i want to change the label to axis position it does not work. I think for professional looking plots those formating features are essential.

ConfigureAxis method in ILAxis.cs overwrites all label positions in the following foreach block:

    foreach (ILTick tick in Ticks) {
                float curVal = tick.Position - min; 
                Vector3 curPos = startWorld + a * curVal;
                tickPosArr[i++] = curPos.X; tickPosArr[i++] = curPos.Y; tickPosArr[i++] = curPos.Z;
                if (Ticks.TickLength < 0)
                    tick.Label.Position = curPos;
                curPos += (tickDirWorldStartLines + ticka * curVal);
                tickPosArr[i++] = curPos.X; tickPosArr[i++] = curPos.Y; tickPosArr[i++] = curPos.Z;
                if (Ticks.TickLength >= 0)
                    tick.Label.Position = curPos;

cheers,

andré

edit:

as mentioned in my comments i found a "work around" by using the anchor property

http://www.fotos-hochladen.net/uploads/unbenanntcs7kreytib.png

André L.
  • 21
  • 2

1 Answers1

1

The first part of your question addresses the issue http://ilnumerics.net/mantis/view.php?id=168 which will be fixed in the next version. In general, the ticks are automatically positioned on user interaction like rotation. Depending on the relative position of the tick labels regarding the axis, the tick labels position and anchor are constantly adjusted. A fixed value would be helpful in rare situations only.

However, you can configure your own setup with custom tick labels, if you do not want to rely on the automatic settings. You may use ‘ILAxis.Ticks.Mode = TickMode.Manual’ and add individual ticks. Each tick may have its individual label which is not overwritten within the axis configuration function.

See: Everything about axis + ticks configuration: http://ilnumerics.net/axis-configuration.html

numbers303
  • 376
  • 1
  • 4
  • Thanks, i am already using the manual mode (as mentioned in my original post). i need a labeling and tick configuration for a non-linear axis and i did it by setting the mode to manual and by adjusting the labels and tick positions according to the normal probability (the png i linked is the result of that work with an ilnumeric plot). so, everything works well except the label positioning. i am looking forward to the next version :) – André L. Feb 11 '14 at 18:48
  • anyways, for now, i was able to make it work as expected by adjusting the label's anchor property depending on it's string size. all is well aligned now even with negative tick sizes but's a little bit "hacky" and not the best solution – André L. Feb 11 '14 at 19:04
  • Glad you solved it, Andre! The next release should make it a lot easier. – Haymo Kutschbach Feb 11 '14 at 20:25