{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import (\n", " \"os\"\n", " \"path/filepath\"\n", " \n", " \"go-hep.org/x/hep/hbook/rootcnv\"\n", " \"go-hep.org/x/hep/rootio\"\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fname := filepath.Join(os.Getenv(\"GOPATH\"), \"src\", \"go-hep.org/x/hep/rootio/testdata/graphs.root\")\n", "f, err := rootio.Open(fname)\n", "if err != nil {\n", " panic(err)\n", "}\n", "defer f.Close()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "printf(\"keys: %v\\n\", f.Keys())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "obj, err := f.Get(\"tge\")\n", "if err != nil {\n", " panic(err)\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "s2, err := rootcnv.S2D(obj.(rootio.Graph))\n", "if err != nil {\n", " panic(err)\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import (\n", " \"image/color\"\n", " \"go-hep.org/x/hep/hplot\"\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "p := hplot.New()\n", "p.Title.Text = \"Graph\"\n", "h := hplot.NewS2D(s2, hplot.WithYErrBars)\n", "h.Color = color.RGBA{R:0xff, A:0xff}\n", "p.Add(h)\n", "p.Add(hplot.NewGrid())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "hplot.Show(p, 640, -1, \"png\")" ] } ], "metadata": { "kernelspec": { "display_name": "Go", "language": "go", "name": "go" }, "language_info": { "codemirror_mode": "go", "file_extension": ".go", "mimetype": "", "name": "go", "nbconvert_exporter": "", "pygments_lexer": "go", "version": "unreleased" } }, "nbformat": 4, "nbformat_minor": 2 }