I need to be able to create a graph in PyQtGraph that either displays strings on the x line like this:
Or inside of the bar itself like this:
These are my values:
y = [5.509, 5.509, 5.414, 5.414, 5.414, 5.289, 5.289, 5.289, 5.289, 5.289, 5.289, 5.289, 5.174, 5.174]
x = ['RUS', 'VET', 'OCO', 'MSC', 'MAZ', 'VER', 'HAM', 'BOT', 'GAS', 'STR', 'SAI', 'RAI', 'NOR', 'PER']
This is an example of what it could look like. "Note that this does not work"
# importing QtGui to use QIcon
from PyQt5.QtGui import *
from PyQt5.QtWidgets import QApplication
# importing pyqtgraph as pg
import pyqtgraph as pg
# importing QtCore and QtGui from the pyqtgraph module
from pyqtgraph.Qt import QtCore
# creating a pyqtgraph plot window
window = pg.plot()
# setting window geometry
window.setGeometry(100, 100, 600, 500)
# title for the plot window
title = "Test"
# setting window title to plot window
window.setWindowTitle(title)
y = [1,2,3,4,5,6,7,8,9,10,11,12,13,14]
x = ['RUS', 'VET', 'OCO', 'MSC', 'MAZ', 'VER', 'HAM', 'BOT', 'GAS', 'STR', 'SAI', 'RAI', 'NOR', 'PER']
bargraph = pg.BarGraphItem(x=x, height=y, width=0.5)
window.addItem(bargraph)
# main method
if __name__ == '__main__':
# importing system
import sys
# Start Qt event loop unless running in interactive mode or using
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QApplication.instance().exec_()
I need all the help I can get, since I haven't been able to find out anything myself.