Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
MetalBlueberry committed Aug 21, 2024
1 parent ba200ef commit 076dc90
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,35 @@ The good thing about this package is that it's **automatically generated** based
package main

import (
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
"github.com/MetalBlueberry/go-plotly/pkg/offline"
"github.com/MetalBlueberry/go-plotly/pkg/types"
)

func main() {
fig := &grob.Fig{
Data: grob.Traces{
&grob.Bar{
Type: grob.TraceTypeBar,
X: []float64{1, 2, 3},
Y: []float64{1, 2, 3},
},
},
Layout: &grob.Layout{
Title: &grob.LayoutTitle{
Text: "A Figure Specified By Go Struct",
},
},
}

offline.Show(fig)
/*
fig = dict({
"data": [{"type": "bar",
"x": [1, 2, 3],
"y": [1, 3, 2]}],
"layout": {"title": {"text": "A Figure Specified By Python Dictionary"}}
})
*/
fig := &grob.Fig{
Data: []types.Trace{
&grob.Bar{
X: []float64{1, 2, 3},
Y: []float64{1, 2, 3},
},
},
Layout: &grob.Layout{
Title: &grob.LayoutTitle{
Text: "A Figure Specified By Go Struct",
},
},
}

offline.Show(fig)
}
```

Expand Down

0 comments on commit 076dc90

Please sign in to comment.