Qt Data Visualization adjust axis scaling
-
I am currently plotting 3D figures using Q3DScatter and I am running into an issue with adjusting scales on an axis. The 3D figure that is rendering is very out of scale and too "squished".
Here is a picture to show what I mean:
As you can see, the values of the axis on the bottom (x axis) go all the way up to 195. The data on this axis gets shrunk and makes it look very squished when it should be stretched out a bit more. This has happened on other 3d models, but it is having the most effect on this one specifically. I've tried changing aspect ratios but I haven't really found anything that can let me change the axis scaling.
It would be helpful to know if there is a way to do this or if it is not built to be customized that way. Any help or guidance is appreciated.
Here is a sample of my code, you can assume all the proper libraries are imported:
class ScatterGraph(QObject): def __init__(self, x, y, z): super(ScatterGraph, self).__init__() #self.setWindowTitle('3D Visualization') self.scatter = Q3DScatter() self.scatter.setFlags(self.scatter.flags() ^ Qt.FramelessWindowHint) self.container = QWidget.createWindowContainer(self.scatter) sc_sze = self.scatter.screen().size() self.container.setMinimumSize(QSize(sc_sze.width() / 2, sc_sze.height() / 1.6)) self.container.setMaximumSize(sc_sze) self.container.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.container.setFocusPolicy(Qt.StrongFocus) self.container.setWindowTitle('3D Visualization') data = [] i = 0 while i < len(x) - 25: data.append(QScatterDataItem(QVector3D(y[i], z[i], x[i]))) i += 25 self.series = QScatter3DSeries() self.series.dataProxy().addItems(data) self.scatter.addSeries(self.series) self.scatter.setAspectRatio(0.5) self.scatter.setHorizontalAspectRatio(1.0) self.scatter.show() self.container.show() self.container.setAttribute(Qt.WA_DeleteOnClose) if __name__ == '__main__': app = QApplication(sys.argv) data = 'myfile.txt' df = pd.read_csv(data) x = list(df['X Position (mm)'].values) y = list(df['Y Position (mm)'].values) z = list(df['Z Position (mm)'].values) plot = ScatterGraph(x,y,z) sys.exit(app.exec())