VOOZH about

URL: https://www.geeksforgeeks.org/python/pyqtgraph-symbols/

⇱ PyQtGraph - Symbols - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

PyQtGraph - Symbols

Last Updated : 4 Mar, 2022

PyQtGraph is a graphics and user interface Python library for functionalities commonly required in designing and science applications. Its provides fast, interactive graphics for displaying data (plots, video, etc.). A line chart is a type of graph which displays information as a series of data points commonly known as markers, connected by straight line segments. A scatter plot uses dots to represent values for two different numeric variables. It is a type of graph, drawn using Cartesian coordinates to display values for typically two variables for a set of data
 

When we create a line graph or scatter plot graph, the points which represent some data needs to be highlighted using certain symbols, by default it is round circle but this can be modified as required. There are a total of 12 symbols which are offered by pyqtgraph which can be used to change symbol as required.
Below are the list of the symbols available in this module:

  • o : Default symbol, round circle symbol
  • t : Triangle pointing downwards symbol
  • t1 : Triangle pointing upwards symbol
  • t2 : Triangle pointing right side symbol
  • t3 : Triangle pointing left side symbol
  • s : Square symbol
  • p : Pentagon symbol
  • h : Hexagon symbol
  • star : Star symbol
  • + : Plus symbol
  • d : Prism symbol
  • x : Cross symbol
    This is how they appear on the output screen:
👁 Image


We can create a plot window with the help of commands given below :

plt = pg.plot()


In order to implement the above explained concept, following steps can be followed:
 

  • Import pyqtgraph, pyqt5 and numpy modules
  • Create Main window class
  • Create a plot window object
  • Add legend to the plot window
  • Create 12 lines having different points so that they don't intersect each other and hiving different symbol and colors
  • Add the plot window and other widget like label to the grid layout
  • Set grid layout widget as the central widget of the main window
     

Example:

Output : 
 


 

Comment
Article Tags: