使用boost::histogram::axis::option::growth_t进行轴增长的测试程序
在直方图绘制中,轴是一个非常关键的概念。轴的增长方式对直方图的生成有很大的影响,而boost::histogram::axis::option::growth_t则提供了一种便捷的实现方式。下面我们将通过一个测试程序来演示如何使用boost::histogram::axis::option::growth_t进行轴增长的操作。
测试程序分为两个部分,首先我们需要定义一个boost::histogram::axis::regular对象作为基础轴,然后再通过boost::histogram::axis::option::growth_t对其进行扩展。代码如下:
#include <boost/histogram.hpp>
#include <iostream>
using namespace boost::histogram;
int main() {
// 定义一个最小值为0,最大值为1000,bin个数为10的regular轴
auto base_axis = axis::regular<>(10, 0.0, 1000.0);
// 对轴进行指数增长,底数为2
auto growth = axis::option::growth_t::exponential(2);
auto axis = base_axis.option(growth);
// 输出轴信息
std::cout <&l