rocketlaunchr / dataframe-go

DataFrames for Go: For statistics, machine-learning, and data manipulation/exploration
Other
1.19k stars 95 forks source link

nothing for Xaxis and Yaxis #32

Closed beaquant closed 4 years ago

beaquant commented 4 years ago

I copy the followed code from readme, but the chart haven't value in a Xaxis and Yaxis

import (
    chart "github.com/wcharczuk/go-chart"
    "github.com/rocketlaunchr/dataframe-go/plot"
    wc "github.com/rocketlaunchr/dataframe-go/plot/wcharczuk/go-chart"
)

sales := dataframe.NewSeriesFloat64("sales", nil, 50.3, nil, 23.4, 56.2, 89, 32, 84.2, 72, 89)
cs, _ := wc.S(ctx, sales, nil, nil)

graph := chart.Chart{Series: []chart.Series{cs}}

plt, _ := plot.Open("Monthly sales", 450, 300)
graph.Render(chart.SVG, plt)
plt.Display()
<-plt.Closed
pjebs commented 4 years ago

The plot package leverages any third party plotting package that has the capability to write to a io.Writer (which is probably all plotting packages).

In the example I use github.com/wcharczuk/go-chart package. If you read the documentation in there, you'll see how to add the XAxis and YAxis. I didn't write it in the example to keep the Readme short. It is getting too long.

I think the graph variable has a property you can adjust.

See: https://godoc.org/github.com/wcharczuk/go-chart

beaquant commented 4 years ago

thanks, it works now :)