Labeling Points

Q&A for Visual Basic, Visual Basic .NET, and PowerBasic developers using DPlot

Moderator: DPlotAdmin

Post Reply
markt
Posts: 2
Joined: Wed Jul 28, 2004 6:23 am
Location: Orlando, FL

Labeling Points

Post by markt »

I am using DPLOTLIB.DLL to generate my plots in VB6. I am trying to label the curves and have run into two different problems with my LOG-LOG plots.

1) Using the D.Label method, I get labels that I cannot control the size, location, or rotation of. As a result, they are overlapping and unreadable.

2) I switched to using TextPointLabel similar to this to label the last (top) point of my curves:

"[SelectCurve(" & CStr(j) & ")]"
"[TextPointLabel(" & CStr(lNumberPoints(j)) & ",-100,-300,0,0,8," & Chr$(34) & sLabel(j) & Chr$(34) & ")]"

I have to build the strings in a loop to handle multiple curves. The problem is the LOG-LOG graph does not handle the XY offset well at all - I get labels on the curves to the right, but the curves to the left are off the plot. It appears that I may need to generate custom absolute points, but I would like to try to avoid that.

My problem: With #1, I get labels that are mostly perfect, but I have no control over for size, location, or rotation. With #2, I cannot get consistent locations because of the LOG-LOG plot. Also with #2, I must have the label within the plot when I really want it outside next to the last data point.

Can I get more control of the labels in case #1?
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

I'll add an options flag for TextPointLabel that says X and Y are physical offsets in... say... hundredths of inches rather than plot-space values. This won't cure wanting to place labels off the plot, though. I'll have to give that one some more thought.

For log-log scales you can get a consistent offset for all labels with the current version with

X=exp(log(Xpt)+log(Xoff))
Y=exp(log(Ypt)+log(Yoff))

where Xpt, Ypt are the coordinates of the labelled point, Xoff, Yoff are absolute values of the offsets. Use - log(Xoff) if you want the label to the left of the point.
Can I get more control of the labels in case #1?
No, that's a different animal than labels created with TextPointLabel.
Visualize Your Data
support@dplot.com
markt
Posts: 2
Joined: Wed Jul 28, 2004 6:23 am
Location: Orlando, FL

Post by markt »

OK. I assume that D.Label was a quick thing that was never intended to allow options. If you allow escaped control characters in the label to control the rotation though....

D.Label = "^LMylabel" ' Rotate label 90 degrees CCW
D.Label = "^RMylabel" ' Rotate label 90 degrees CW

Just a thought.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Nice idea, with the benefit that it won't break existing plots. I'll add something along these lines for sure. Thanks for the suggestion.
Visualize Your Data
support@dplot.com
Post Reply