当前位置:网站首页>QCustomPlot 坐标轴间隔显示刻度标签
QCustomPlot 坐标轴间隔显示刻度标签
2022-08-04 19:13:00 【老赵的博客】
1. 可直接使用,使用场景:画散点图时,需要显示多个点,但是横坐标标签全部显示的话,就会拥挤,故事用这个方法
//设置坐标
QVector<QString>xLable;
QVector<double>xpos;
int num = 10;
xLable.resize(num);
xpos.resize(num);
int xmin = m_freValue_list.time_t_vector.first();
int xmax = m_freValue_list.time_t_vector.last();
double xspan = (xmax+1 - xmin)/num;
for(int i=0;i<num;i++)
{
xpos.append(xmin+i*xspan);
xLable.append(QString::number(xmin+i*xspan));
}
QSharedPointer<QCPAxisTickerText> xaixsTicker = QSharedPointer<QCPAxisTickerText>(new QCPAxisTickerText);
xaixsTicker->addTicks(xpos,xLable);
ui->widget_freqStatisticsPlot->xAxis->setTicker(xaixsTicker);
ui->widget_freqStatisticsPlot->xAxis->setRange(m_FreScatterNum-MAX_POINT_NUM+1,m_FreScatterNum+1);
ui->widget_freqStatisticsPlot->replot();
边栏推荐
- Storage resource activation system to help new infrastructure
- 【AI+医疗】斯坦福大学最新博士论文《深度学习在医学影像理解中的应用》,205页pdf
- 哈佛架构 VS 冯·诺依曼架构
- GBase8s存储过程
- 测试/开发程序员男都秃头?女都满脸痘痘?过好我们“短暂“的一生......
- 在表格数据集上训练变分自编码器 (VAE)示例
- 当前最快的实例分割模型:YOLACT 和 YOLACT++
- Highlights of some performance tests
- Yuanguo chain game system development
- 如何理解 SAP UI5 的 sap.ui.define 函数
猜你喜欢
随机推荐
SOA面向服务架构:服务、服务实例、ARXML、服务接口调用以及各参与方
当前最快的实例分割模型:YOLACT 和 YOLACT++
正则表达式未完
如何进行自动化测试?
Kubernetes之list-watch机制
[Latest Information] 2 new regions will announce the registration time for the soft exam in the second half of 2022
机器学习之支持向量机实例,线性核函数 多项式核函数 RBF高斯核函数 sigmoid核函数
win10 uwp MetroLog 入门
目标检测的发展与现状
重构指标之如何监控代码圈复杂度
VPC2187/8 current mode PWM controller 4-100VIN ultra-wide voltage startup, highly integrated power control chip recommended
lc marathon 8.3
Spark提交参数说明和常见优化
网络运维管理从基础到实战-自用笔记(1)构建综合园区网、接入互联网
win10 uwp json
”元宇宙“必须具备这些特点
从零开始实现一个简单的CycleGAN项目
猜数字游戏
作业8.3 线程同步互斥机制条件变量
【最新资讯】2022下半年软考新增2个地区公布报名时间