Proportional axes?

12 views
Skip to first unread message

Bjorn Buckwalter

unread,
Jan 6, 2011, 2:51:50 PM1/6/11
to Haskell Charts
Hi,

Can chart render proportional axes, i.e. use the same scale for both
axes? E.g. the TestParametric example would benefit from such
functionality, IMO.

Similarily, is it possible to make an axis always include zero in a
straight-forward way?

Thanks,
Bjorn

Tim Docker

unread,
Jan 6, 2011, 3:04:23 PM1/6/11
to haskell...@googlegroups.com

> Can chart render proportional axes, i.e. use the same scale for both
> axes? E.g. the TestParametric example would benefit from such
> functionality, IMO.

Well you can create the two axes manually, but I'm assuming you mean
have the axes automatically scaled but with this extra constraint?
There's
no function to do this yet.

> Similarily, is it possible to make an axis always include zero in a
> straight-forward way?

The easiest way is to add (0,0) as a hidden plotted point, using the

Graphics.Rendering.Chart.Plot.PlotHidden

data type.

Cheers,

Tim

Bjorn Buckwalter

unread,
Jan 12, 2011, 8:07:01 AM1/12/11
to haskell-charts
On Thu, Jan 6, 2011 at 21:04, Tim Docker <t...@dockerz.net> wrote:
>
>> Can chart render proportional axes, i.e. use the same scale for both
>> axes? E.g. the TestParametric example would benefit from such
>> functionality, IMO.
>
> Well you can create the two axes manually, but I'm assuming you mean
> have the axes automatically scaled but with this extra constraint? There's
> no function to do this yet.

I've been digging around and haven't found a straight-forward way of
approaching this given how axes are currently created. Specifically,
information on both the display geometry and the data range of the
other (proportional) axis/axes are needed when creating the axis. But
both of these are not available as input to an AxisFn or any other
obviously useful place (for these purposes), as far as I can tell.

Frankly it doesn't look like this kind of inter-relationship between
axes is easily supported but the rendering model. That being said I'm
interested enough in this functionality that I'll take a shot at it
anyway. Do you have any suggestions for where would be a good place to
start? It looks like I would have to muck around at the level of
gridToRenderable...??

Also, regarding creating the axes manually, it isn't clear to me how I
would do that either??


>> Similarily, is it possible to make an axis always include zero in a
>> straight-forward way?
>
> The easiest way is to add (0,0) as a hidden plotted point, using the
>
>    Graphics.Rendering.Chart.Plot.PlotHidden
>
> data type.

Thanks! This also did the job for me:

layout1_left_axis ^: laxis_generate ^= autoAxis . (0:)

-Bjorn

Tim Docker

unread,
Jan 12, 2011, 4:51:33 PM1/12/11
to haskell...@googlegroups.com

> Frankly it doesn't look like this kind of inter-relationship between
> axes is easily supported but the rendering model. That being said I'm
> interested enough in this functionality that I'll take a shot at it
> anyway. Do you have any suggestions for where would be a good place to
> start?

I haven't got time to think about this much right now - I'm about to
go on holidays for two weeks. Having said that, I suspect that the
most straightforward approach would be to create a new Layout type
which only has a single type parameter - I don't think having separate
types for X & Y makes sense for proportional axes. This new type would
reuse existing code where appropriate, but would also arrange the co-
ordination between the X and Y axes.

Cheers,

Tim

Reply all
Reply to author
Forward
0 new messages