標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

最近の作業部屋活動履歴

2022-11-27
2022-11-24
2022-11-14
2022-02-11
2022-02-01
2021-06-28

最近のWikiの更新 (Recent Changes)

No changes on this wiki.

Wikiガイド(Guide)

サイドバー (Side Bar)

QCustomPlot2-PyQt5

  • R/O
  • R/O (HTTP)
  • R/W (SSH)
  • R/W (HTTPS)
Fork

Bindings for graphics lib QCustomPlot2 for PyQt5

Release Files

檔案名大小時間下載總數
QCustomPlot2-2.1.0.tar.gz1.27 M2022-02-01 20:50:55132
QCustomPlot2-2.0.1.tar.gz1.22 M2019-10-19 18:08:09384

Recent Commits

修訂.時間作者訊息 RSS
283b70932022-11-27 20:01:02Sergey SalnikovExplicitly set SIP ABI version for compatibility with dif...
57a82b572022-11-27 01:30:13Sergey SalnikovFixed building internal QCustomPlot for Windows.
3c29ea8c2022-11-24 20:19:50Sergey Salnikov* Switched to using amalgamated QCustomPlot source files....
a12071cd2022-11-22 20:58:20Sergey SalnikovAdded new compile options: * no-static-qcustomplot to lin...
2680ede12022-02-01 16:56:45Sergey SalnikovAdded build system for SIP 5 and newer.
383deae72022-02-01 16:55:44Sergey SalnikovUpdated QCustomPlot to version 2.1.0.
e2543de22022-02-01 16:52:41Sergey Salnikov* Added missing bindings to protected methods for QCPCurv...
439389ca2022-02-01 16:47:42Sergey SalnikovMoved some changes from the fork by cowo78.
a8a64f902020-11-12 15:38:39Sergey SalnikovUpdate README.md Updated example to make it really execu...
075c72ee2019-10-19 17:46:24Sergey SalnikovAdded bindings to protected methods to allow overloading ...

QCustomPlot2-PyQt5

Design goals

This is Python bindings for QCustomPlot - Qt C++ library for plotting and data visualization. There are myriads of Python charting libraries out there, and each may even have its reason to exist. QCustomPlot2 for PyQt5 has the following goals:

  • Performance. QCustomPlot is written in modern C++ with the excellent Qt library for superior performance over alternative libraries.

  • Flexibility. QCustomPlot is one of the most customisable libraries available, with a wide range of supported graph types and full control over how the graph is rendered.

Installing

Linux

You can find compiled packages for many Linux distributions at OBS.

Windows

Install the package via our favourite package manager:

$ pip install QCustomPlot2

Getting started

Now let's take a look at some code:

import sys
import math
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPen, QBrush, QColor
from PyQt5.QtWidgets import QApplication, QMainWindow
from QCustomPlot2 import *


app = QApplication(sys.argv)
window = QMainWindow()
window.resize(800, 600)

customPlot = QCustomPlot()
window.setCentralWidget(customPlot)

graph0 = customPlot.addGraph()
graph0.setPen(QPen(Qt.blue))
graph0.setBrush(QBrush(QColor(0, 0, 255, 20)))

graph1 = customPlot.addGraph()
graph1.setPen(QPen(Qt.red))

x, y0, y1 = [], [], []
for i in range (251):
    x.append(i)
    y0.append(math.exp(-i/150.0)*math.cos(i/10.0)) # exponentially decaying cosine
    y1.append(math.exp(-i/150.0))                  # exponential envelope

graph0.setData(x, y0)
graph1.setData(x, y1)

customPlot.rescaleAxes()
customPlot.setInteraction(QCP.iRangeDrag)
customPlot.setInteraction(QCP.iRangeZoom)
customPlot.setInteraction(QCP.iSelectPlottables)

window.show()
sys.exit(app.exec_())

That's all!

Some important things:

  • QCustomPlot is a QWidget type that can be used the same way as any other widget, added to layouts, etc. However, you can nest multiple graphs in a single QCustomPlot using layouts (see the Advanced Axes demo).

Examples

Beside the examples below, you may want to check the documentation.

Supported compilers

The following compilers are known to work:

  • MSVC 140, 141
  • GCC 4.8
  • Clang 3.4

I would be happy to learn about other compilers/versions.

License

This code is licensed under the MIT License:

Copyright © 2017-2019 Dmitry Voronin, Christopher Gilbert and Sergey Salnikov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


This project contains the QCustomPlot library from Emanuel Eichhammer which is licensed under the GPL Version 3 License. Copyright © 2011-2018 Emanuel Eichhammer bjoern@hoehrmann.de

Contact

If you have questions regarding the library, I would like to invite you to open an issue at Github. Please describe your request, problem, or question as detailed as possible, and also mention the version of the library you are using as well as the version of your compiler and operating system. Opening an issue at GitHub allows other users and contributors to this library to collaborate.

Thanks

I deeply appreciate the help of the following people.

  • DerManu is the official author and maintainer of the excellent QCustomPlot library.
  • dimv36 is the original author of the Python bindings for QCustomPlot 1.0.0, upon which this project is based.
  • cowo78 and cjgdev added support for the QCustomPlot 2.0.0 API.

Thanks a lot for helping out! Please let me know if I forgot someone.

Used third-party tools

This library is built, tested, documented, and whatnot using third-party tools and services. Thanks a lot!

  • SIP to generate the Python bindings.

Projects using

  • GPX Viewer --- an application for viewing GPX files as a list of points and tracks.

If you are using QCustomPlot2-PyQt5 in a project and would like to share with the community, please let me know, or even better, raise a pull request.

Building from sources

Linux

Apt users (Debian, Ubuntu, etc) may follow the instructions below, users of other distributions may adapt the steps below for your own package manager.

# Fetch the necessary development tools and libraries
$ apt-get install build-essential python3-pyqt5 pyqt5-dev-tools qttools5-dev-tools

# Clone the repository and submodules
$ git clone --recursive https://github.com/salsergey/QCustomPlot2-PyQt5.git && cd QCustomPlot2-PyQt5

# Build
$ sip-build

# Zzz..

# Install
$ sip-install

Windows

Windows users should install Qt tools, appropriate version of VC compiler, Python, PyQt5 and SIP. You may need to build SIP from sources to ensure you have all files necessary for building other software. Then follow the instructions below to build the library, otherwise you will need to adapt the steps for your own environment.

  • Download QCustomPlot2 sources from Github. You can use git or download an archive.
  • Launch Qt console and follow instructions there. It will ensure that you have all necessary tools in your PATH variable. Also be sure that python.exe binary is in your PATH.
  • Then follow these instructions:
# Go to QCustomPlot2 folder
cd <<PATH_TO QCustomPlot2-PyQt5>>

# Download submodules if you use git
git submodules update --init

# Build
sip-build

# Zzz..

# Install
sip-install

macOS

Users of macOS using homebrew may follow the instructions below to fetch the required packages to build the library, or simply adapt to your own environment.

# First ensure Xcode is installed, as homebrew depends on it
$ xcode-select --install

# Fetch the necessary development tools and libraries
$ brew install qt --devel sip --without-python@2 pyqt --without-python@2

# Clone the repository and submodules
$ git clone --recursive https://github.com/salsergey/QCustomPlot2-PyQt5.git && cd QCustomPlot2-PyQt5

# Build
$ CFLAGS='-std=c++11 -stdlib=libc++' CXXFLAGS='-std=c++11 -stdlib=libc++' sip-build

# Zzz..

# Install
$ sip-install

Latest updated Tickets

標題優先權里程碑標籤Created at最後更新
Qt6 support2022-11-14 23:13:542022-11-14 23:13:54
stuck at sip-build for QCustomPlot2-PyQt5中間2022-02-11 03:15:052022-02-11 03:15:05
error when installing QCustomPlot2-PyQt5 with pip中間2022-02-11 01:05:072022-02-11 01:05:07
QCustomPlot2中間2021-06-28 21:17:572021-06-28 21:17:57
QCPBars crash2020-11-21 04:14:492020-11-21 04:14:49
提交

About Chamber Wiki

Welcome to OSDN Wiki system. Here is your chamber Wiki space.

Check Wiki Guide (English) to refer syntax and functions.