C# code for labeling paper

I’ve finally had time to pull the labeling algorithm out of my much larger visualization package. It’s now up on github: https://github.com/jtalbot/Labeling. This implements all parts of the labeling paper, including the formatting variations.

Let me know if you run into any problems with it or have any suggestions for improvement.

4 thoughts on “C# code for labeling paper

  1. Justin Talbot Post author

    Perhaps so. I was learning C# while writing this and I may have overused that language feature. Let me know if I can clarify anything.

  2. Claudia

    Hi Justin. I have a question regarding the actual usage of your algorithm in two specific cases:

    1) When using datasets that are both positive and negative, I want to somehow force the zero value on the y axis to be displayed as a label. Right now, this depends on the many settings available to you, but if you could give me a hint on how to force the zero value to be displayed, independent on the other settings, and from there on, calculate the rest of the labels.

    2) When using a bar chart, many times the least value is displayed as a bar that’s not visible. Take for example a data set that goes from 5 to 10. The y axis could potentially be defined by labels going from 5 through 10, which would render the smallest bar (with a value of 5) as non visible. Ideally in the case of bars, I would like to see all bars that are greater than zero. In this case the labels could potentially go from 2 through 10 or something similar, giving the smallest bar some space. For this situation, I would like to have a way to force the first label be lesser than the smallest value.

    Maybe these two cases are properly handled by your algorithm, but I haven’t been able to find how to predictively handle this, without prior knowledge of the data.

    If these cases are not handled, I would love if you could either give me hints on how this can be implemented or maybe add these two functionalities to the algorithm, so that bar charts can be implemented with the labeling being adjusted to these two conditions.

  3. Justin Talbot Post author

    On part 2 of you question, it sounds like you want to force external labels. You can make this happen by simply checking if the minimum and maximum labels are outside the range of the data in the optimization search. The R implementation I provided has an option to do this check already. Look there for more details.

Leave a Reply

Your email address will not be published.