一、新建一个widget工程

二、将Qcustomplot文件复制到项目下

三、右键qt项目增加已存在的文件

四、在.pro中添加

QT += widgets printsupport

五、在.h中添加声明

private:
QCustomPlot *myPlot;

六、在.cpp中的构造函数中添加

    myPlot = new QCustomPlot(this);

    this->resize(,);
myPlot->resize(,); // generate some data:
QVector<double> x(), y(); // initialize with entries 0..100
for (int i=; i<; ++i)
{
x[i] = i/50.0 - ; // x goes from -1 to 1
y[i] = 0.75; // let's plot a quadratic function
}
// create graph and assign data to it:
myPlot->addGraph();
myPlot->graph()->setData(x, y);
// give the axes some labels:
myPlot->xAxis->setLabel("x");
myPlot->yAxis->setLabel("y");
// set axes ranges, so we see all data:
myPlot->xAxis->setRange(-, );
myPlot->yAxis->setRange(, );

就画出来一条直线了~

简单的使用Qt的QCustomplot画图的更多相关文章

  1. Qt之QCustomPlot(图形库)

    简述 QCustomPlot是一个基于Qt C++的图形库,用于绘制和数据可视化 - 制作漂亮的2D图 - 曲线图.趋势图.坐标图.柱状图等,并为实时可视化应用程序提供高性能服务.它没有进一步的依赖关 ...

  2. Qt之QCustomPlot绘图(一)配置和第一个例子

    最近一个用Qt开发的项目需要绘制坐标曲线,我在老师的指点下使用了QCustomPlot这个插件,使用方法简单,功能还算不错. 可是在网上找了很多资料和博文都只是将官方提供的例子演示一遍,没有系统全面的 ...

  3. Qt使用QCustomPlot开发

    一.入门 1.下载源文件http://www.qcustomplot.com/: 2.把.cpp和.h放在工程目录下,并将cpp和h加入工程: 3.在.pro中:QT += printsupport: ...

  4. Qt:QCustomPlot使用教程(三)——用户交互

    0.说明 本节翻译总结自:Qt Plotting Widget QCustomPlot - User Interactions 本节内容是使用QCustomPlot实现绘图和用户交互功能. 本文代码中 ...

  5. Qt:QCustomPlot使用教程(二)——基本绘图

    0.说明 本节翻译总结自:Qt Plotting Widget QCustomPlot - Basic Plotting 本节内容是使用QCustomPlot进行基本绘图. 本节教程都使用custom ...

  6. Qt:QCustomPlot使用教程(一)——安装与配置

    0.说明 本节翻译总结自:Qt Plotting Widget QCustomPlot - Setting Up 本节的内容是讲如何配置QCustomPlot,而QCustomPlot的具体用法可以看 ...

  7. QT之QCustomPlot(二)

    怎么设置X,Y轴位置 Manages a single axis inside a QCustomPlot. Usually doesn't need to be instantiated exter ...

  8. QT之QCustomPlot(一)

    QDetectPlot::QDetectPlot(QWidget *parent) : QCustomPlot(parent) { QVector<), y(); // initialize w ...

  9. 如何写一个简单的基于 Qt 框架的 HttpServer ?

    httpserver.h #ifndef HTTPSERVER_H #define HTTPSERVER_H #include <QObject> #include <QtCore& ...

随机推荐

  1. springbootboot 语句

    -- ------------------------------ Table structure for `user`-- ----------------------------DROP TABL ...

  2. 阿里云HBase推出普惠性高可用服务,独家支持用户的自建、混合云环境集群

    HBase可以支持百TB数据规模.数百万QPS压力下的毫秒响应,适用于大数据背景下的风控和推荐等在线场景.阿里云HBase服务了多家金融.广告.媒体类业务中的风控和推荐,持续的在高可用.低延迟.低成本 ...

  3. OC学习篇之---数组对象的引用计数问题和自动释放池的概念

    之前一片文章中我们介绍了OC中的两个关键字@property和@synthesize的使用的使用: http://blog.csdn.net/jiangwei0910410003/article/de ...

  4. Linux下用户-组权限配置

    cat /etc/group cat /etc/ashadow 一.用户管理 1.添加用户 #useradd 用户名 useradd php100;用cat /etc/passwd查看 分析:php1 ...

  5. VS2013 MFC基于对话框编程

    前言一直利用Qt库做Ui设计,但针对于一些MFC项目,掌握一些必要的MFC开发技巧还是很有必要的.这篇博客里就将自己所学的一些MFC浅显知识记录一下,方便今后的学习.博客里只记录关键步骤. 一.新建M ...

  6. Android的Context && 安卓常用系统服务(当前运行包名/当前网络状态和开关网络/音频服务/马达服务) (转)

    转:http://blog.csdn.net/zhandoushi1982/article/details/8501773 Context字面意思上下文,位于framework 的android.co ...

  7. Ubuntu安装可视化电脑配置视图工具neofetch

    安装步骤: sudo apt-get install software-properties-common python-software-propertiessudo add-apt-reposit ...

  8. python如何读写EXCEL文档 (有助于自动化的参数化,用的方法是XLRD,XLWT)

    读EXCEL: import xlrd 例1, data=xlrd.open("E:\egg.xls")     # 打开xls文件 table=data.sheets()[0] ...

  9. 使用函数指针模拟C++多态

    #include <iostream> using namespace std; class Base { public : void display() { cout << ...

  10. 四. jenkins部署springboot项目(1)--window环境

    前提:jenkins和springboot运行在同一台机器 springboot项目使用git和maven jenkins所需的插件如Maven,Git等这里就不再详述. 1.jenkins配置git ...