[Chart] Equal scale on both axes

Tim Docker tim at dockerz.net
Fri Nov 1 05:48:56 GMT 2013


I've pushed a few changes to Layout that makes it hopefully a little 
easier to understand. I don't think its makes the equal axis scaling 
much easier to implement.

The current algorithm for drawing a graph is roughly:

     1) Work out the range of the data in each axis
     2) Auto-generate an AxisData value for each axis (which has the 
labels, ticks and everything)
     3) Allocate space in the output window for the title, axes, legend, 
etc. The space allocated here will depend on the actual data being 
plotted, as the physical size of the axis labels depend on the data.
     4) Plot the actualy data in the space left over in the output window.

What would the equivalent algorithm be for your equal axis mode? It's 
not clear to me...

Tim



On 26/10/13 17:43, Tim Docker wrote:
>
> Unfortunately I don't think the situation has really changed since you 
> asked before. The current structure of the layout code assumes the 
> axes have independent types with independent algorithms for scaling.
>
> My advised approach would still be the same - create a new layout type 
> with a single axis type and an appropriate algorithm for scaling both 
> axes together. It will take a bit of effort, I think to reorganise the 
> existing code to get reuse.
>
> Tim
>
> On 24 Oct 2013 09:53, "Bjorn Buckwalter" <bjorn at buckwalter.se 
> <mailto:bjorn at buckwalter.se>> wrote:
>
>     For the record this feature is high on my wish list too. Do you
>     have any ideas of where to start if one wanted to implement it?
>
>     I'll admit that I asked about this 2011-01 as well[1] but never
>     took it anywhere. I'm hoping the answer/right approach may be more
>     obvious now with the recent rework.
>
>     [1]:
>     https://groups.google.com/forum/#!topic/haskell-charts/o_GMvJxndS4
>     <https://groups.google.com/forum/#%21topic/haskell-charts/o_GMvJxndS4>
>
>     Thanks,
>     Bjorn
>
>
>     On Wed, Oct 23, 2013 at 9:45 PM, Tim Docker <tim at dockerz.net
>     <mailto:tim at dockerz.net>> wrote:
>
>         Hi,
>
>         Welcome to the list.
>
>         There is currently no way to lock the aspect ratio in this way.
>
>         Setting the chart size sets the outputs size of the canvas.
>         This includes not just the plot area, but also the title, axis
>         labels, legend, etc.
>
>         I think you will have to this manually, by choosing the aspect
>         ratio of the output image by setting its size, and then
>         manually setting the range for each axis to give you the
>         desired aspect ratio in plot coordinates.
>
>         Cheers,
>
>         Tim
>
>         On 23 Oct 2013 01:24, "Triwanto Simanjuntak"
>         <simanjuntak.triwanto at gmail.com
>         <mailto:simanjuntak.triwanto at gmail.com>> wrote:
>
>             I just subscribed this mailing list, so hello to all of you.
>
>             Previously I asked the following question,
>
>                 [I'm a newbiee Haskell user and after have been toying
>                 with available plotting packages, I found that
>                 haskell-chart is the most reliable. So thanks for all
>                 the hard work!
>
>                 I have a small problem. Making the axes to be in
>                 logarithmic scale was easily done but I still can't
>                 manage to make both axes have equal scale. I'd be very
>                 happy to hear any suggestion on how to achieve it or
>                 where to look for solution.]
>
>
>             and  then Tim replied,
>
>                 [By both axes, do you mean both Y axes, or the X and Y
>                 axes?]
>
>
>             To clarify my question:
>             I meant the latter one, X and Y axes of  a single plot to
>             have equal scale (aspect ratio), [as for comparison for
>             python-matplotlib, see http://goo.gl/gP7Sr4]
>
>             Does simply invoking the chart's size to have equal
>             lengths (square shape),
>             e.g. renderableToPDFFile chartFoo 320 320 "chartFoo.pdf"
>             the resulted chart will have equal aspect ratio?
>             or the declared chart size is basically the size of the
>             canvas
>             ?
>
>             Thanks,
>
>
>             Triwanto
>
>
>
>             _______________________________________________
>             Chart mailing list
>             Chart at projects.haskell.org <mailto:Chart at projects.haskell.org>
>             http://projects.haskell.org/cgi-bin/mailman/listinfo/chart
>
>
>         _______________________________________________
>         Chart mailing list
>         Chart at projects.haskell.org <mailto:Chart at projects.haskell.org>
>         http://projects.haskell.org/cgi-bin/mailman/listinfo/chart
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://projects.haskell.org/pipermail/chart/attachments/20131101/bae52596/attachment.htm>


More information about the Chart mailing list