Plot coordinates vs. device coordinates

30 views
Skip to first unread message

Craig Hockenberry

unread,
Jan 31, 2011, 3:02:33 PM1/31/11
to coreplot-discuss
While working with axes, I found it confusing that some of the
properties are based on device coordinates (e.g. titleOffset) while
others are in plot space coordinates (e.g. titleLocation.)

Using device coordinates for positioning elements can be limiting: you
can't have a Y title offset that aligns with the right-hand edge of
the graph, for example. For drawing, device coordinates are
appropriate (e.g. a 1 pixel line width or a 10 pixel corner radius on
a bar.)

Plot coordinates for positioning also have the nice side effect of
keeping the placement relative to the data itself.

Thoughts?

-ch

Drew McCormack

unread,
Feb 1, 2011, 3:44:53 AM2/1/11
to coreplot...@googlegroups.com
I think you hit the nail on the head when you said 'device coordinates are appropriate for drawing'. We use device coords for anything that has to do with appearance and positioning, and plot coordinates for data related things. Positioning a title in plot coordinates would be a bad idea, because it would move when the axis scales changed.

We do have annotations, which are labels. These can be attached either to an anchor point on a layer (think OmniGraffle), or to a particular plot coordinate, moving with the data. Rather than using the title of the graph, why not create a CPPlotSpaceAnnotation and attach that to a particular plot coordinate, or use a CPLayerAnnotation and position it relative to an anchor on the plot area?

Drew

> --
> You received this message because you are subscribed to the Google Groups "coreplot-discuss" group.
> To post to this group, send email to coreplot...@googlegroups.com.
> To unsubscribe from this group, send email to coreplot-discu...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/coreplot-discuss?hl=en.
>

Reply all
Reply to author
Forward
0 new messages