Partager via


FSharpChart for Valentines Day

As I have not posted anything about FSharpChart for a while I thought I would do a quick post, one that befits Valentines Day:

image

Plotting the heart was surprisingly easy to do:

[ for x in -1.1 .. 0.001 .. 1.0 do
    let y1 = abs(x)+sqrt(1.0-x**2.0)
    let y2 = abs(x)-sqrt(1.0-x**2.0)
    yield (x, y1)
    yield (x, y2)]
|> FSharpChart.Line
|> FSharpChart.WithSeries.Style(Color = Color.Red, BorderWidth = 2)
|> FSharpChart.WithTitle("Happy Valentines Day", TextStyle = TextStyle.Frame, Font = new Font("Arial", 28.0f))
|> FSharpChart.WithMargin(0.0f, 15.0f, 3.0f, 1.0f)
|> FSharpChart.WithArea.AxisX(MajorGrid = Grid(LineColor = Color.White))
|> FSharpChart.WithArea.AxisY(MajorGrid = Grid(LineColor = Color.White))

Happy Valentines Day!

Comments

  • Anonymous
    February 22, 2012
    nice!