From 2757ca4fbee5026dfea5359e7a56a6958e1ae327 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Mon, 23 Sep 2024 17:55:01 -0700 Subject: [PATCH] Make sure label is formatted for Choice --- gtsam/discrete/DecisionTree-inl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gtsam/discrete/DecisionTree-inl.h b/gtsam/discrete/DecisionTree-inl.h index 06161c2e1..27e98fcde 100644 --- a/gtsam/discrete/DecisionTree-inl.h +++ b/gtsam/discrete/DecisionTree-inl.h @@ -91,7 +91,7 @@ namespace gtsam { void dot(std::ostream& os, const LabelFormatter& labelFormatter, const ValueFormatter& valueFormatter, bool showZero) const override { - std::string value = valueFormatter(constant_); + const std::string value = valueFormatter(constant_); if (showZero || value.compare("0")) os << "\"" << this->id() << "\" [label=\"" << value << "\", shape=box, rank=sink, height=0.35, fixedsize=true]\n"; @@ -306,7 +306,8 @@ namespace gtsam { void dot(std::ostream& os, const LabelFormatter& labelFormatter, const ValueFormatter& valueFormatter, bool showZero) const override { - os << "\"" << this->id() << "\" [shape=circle, label=\"" << label_ + const std::string label = labelFormatter(label_); + os << "\"" << this->id() << "\" [shape=circle, label=\"" << label << "\"]\n"; size_t B = branches_.size(); for (size_t i = 0; i < B; i++) {