Closed sbinet closed 1 year ago
^^ @mrceyhun
WDYT ? (and the related PR #987)
@sbinet thanks for the heads up.
I tried your PR, it works fine and saves json.
However, my intention is to use JsROOT to draw histogram JSON instead of gonum plot JSON. And JsROOT expects TBufferJSON.ToJSON(hist)
kind of JSON, AFAIK. Please consider my limited ROOT knowledge. If there is a possibility to draw this JSON output with JsROOT, it can be useful.
// findObj() just opens the file and returns the ROOT TH1F object
obj := findObj("./dqm.root", "DQMData/Run 366713/EcalPreshower/Run summary/ESRecoSummary/recHits_ES_energyMax")
rh1 := rootcnv.H1D(obj.(rhist.H1))
p := hplot.New()
h := hplot.NewH1D(rh1)
p.Add(h)
err := hplot.Save(p, 10*vg.Centimeter, 20*vg.Centimeter, "plot.json")
if err != nil {
panic(err)
}
my go.mod:
...
require go-hep.org/x/hep v0.33.0
replace go-hep.org/x/hep v0.33.0 => github.com/sbinet-hep/hep v0.26.1-0.20230905171538-4b6630c113c5
...
ok, let's track that in https://github.com/go-hep/hep/issues/991
out of curiosity, why do you prefer JsROOT over hplot
?
is it b/c of interactivity ? aesthetics ?
something else ?
Yes, interactive plots is our users' requirement.
Thanks.
this is a follow-up from https://github.com/go-hep/hep/issues/982.
we could consider adding a JSON backend to
hplot.Save
, that is: