当前位置:网站首页>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();边栏推荐
- ECCV 2022 | FPN错位对齐,实现高效半监督目标检测(PseCo)
- 入选爱分析·银行数字化厂商全景报告,网易数帆助力金融数字化场景落地
- Day018 Inheritance
- win10 uwp MVVM 轻量框架
- Defaced Fingerprint Recovery and Identification
- Jmeter - Heap配置原因报错Invalid initial heap size: -Xms1024m -Xmx2048mError
- TikTok如何为独立站引流?
- 直播回顾|7 月 Pulsar 中文开发者与用户组会议
- win10 uwp ping
- 如何理解 SAP UI5 的 sap.ui.define 函数
猜你喜欢
随机推荐
我的四周年创作纪念日
JS: 数组和树的相互转换
Notepad++更改显示背景
openharmony代码框架初识(2)
开篇-开启全新的.NET现代应用开发体验
02 ts 变量定义,类型
Finger Vein Recognition-matlab
VPC2187/8 电流模式 PWM 控制器 4-100VIN 超宽压启动、高度集成电源控制芯片推荐
03 ts类型缩小,函数
正畸MIA微种植体支抗技术中国10周年交流会在沈举办
Kubernetes之list-watch机制
WPF 元素裁剪 Clip 属性
STP实验
IDEA 自动导入的配置(Auto import)
GBase8s存储过程
Regular expression is incomplete
基于YOLOV5行人跌倒检测实验
The Development and Current Situation of Object Detection
ELECTRA:Pre-training Text Encoders as Discriminators Rather Than Generators
EuROC dataset format and related codes









