[Chart] How do I create inverted plots or log plots?

Tim Docker tim at dockerz.net
Mon Jun 24 02:57:49 BST 2013


To show a log plot, all you need to to is to wrap your values with a 
LogValue constructor. See this example:

     https://github.com/timbod7/haskell-chart/wiki/example%204

By "inverse plot" do you mean with the axis directions reversed (ie 
smallest number at the top or right)?

In that case you just need to set  laxis_reverse to true. (see tests 4b 
and 4c in the distribution).

Tim



On 24/06/13 09:37, Eric Schug wrote:
> I'm trying to create inverse plots and log plots, but I can't seem to 
> figure out which defaults to override.
>
> It seems like something like this should work for invers
>
> axisInv       :: AxisData Double -> AxisData Double
> axisInv ad     = ad {
>     axis_viewport_ =  (\r x ->  negate $ (axis_viewport_ ad) (snd r, 
> fst r) (id x))
>     -- , axis_tropweiv_ = (axis_tropweiv_ ad)
>     }
> ...
>
> layout1_bottom_axis^:laxis_override ^= axisInv
>
> but I can't figure out how which should be negated the value or the 
> result and how the range
> should be modified. I would expect I would need to do something 
> similar to axis_tropweiv_.
> The mapping just does not seem easily composable.
> Looking at vmap and linMap do not help because I don't know how to 
> obtain the extra parameters
> for these.
>
>
> _______________________________________________
> Chart mailing list
> Chart at projects.haskell.org
> http://projects.haskell.org/cgi-bin/mailman/listinfo/chart




More information about the Chart mailing list