haskell-chart icon indicating copy to clipboard operation
haskell-chart copied to clipboard

`scaledAxis` does not honor bounds

Open dschrempf opened this issue 4 years ago • 1 comments

Hi,

when creating a plot with layout_y_axis . laxis_generate .= scaledAxis def (3, 28), the resulting plot has a y range from 0 to 30. I guess this is because the ticks are at 0 and 30. How can I create a plot with a specific axis range?

Thanks!

dschrempf avatar Mar 04 '20 07:03 dschrempf

Ive done it manually with code like:

degreeAxis = const AxisData
  { _axis_visibility = def
  , _axis_viewport   = linMap id (0, 360)
  , _axis_tropweiv   = invLinMap id id (0, 360)
  , _axis_ticks      = [ (i, 5) | i <- cardinals ]
                         <> [ (i + 45, 3) | i <- cardinals, i < 360 ]
  , _axis_grid       = [0, 90, 180, 270, 360]
  , _axis_labels     = [ [ (0.0, "North")
                         , (90 , "East")
                         , (180, "South")
                         , (270, "West")
                         , (360, "North")
                         ]
                       ]
  }

cardinals = [0, 90, 180, 270, 360]

joehealy avatar Apr 01 '20 06:04 joehealy