The following code may not be executed from the terminal. I think it is a phenomenon due to the difference in OS.
Like this
Python_console
import pyqtgraph as pg
pg.plot([0,1,2],[3,4,5])
this.
Python_console
import pyqtgraph as pg
import numpy as np
pg.image(np.random.rand(10,10))
By the way, this too.
Python_console
import pyqtgraph as pg
pg.dbg()
With this, it seems that you can create an advanced application that users can operate from the python console, such as 3DCG blender. No, I wonder if I started studying python because of this in 3D. ... works normally.
The window appears, but it looks like it's frozen. I think it's in the same state as it was on this Yahoo! Answers.
(In addition to this, there were cases where the axes of the graph were displayed but frozen.)
By the way, when linked with PySide, it will be displayed properly even on a Windows PC in the environment where this happens. ([Save this as im.py for now and run it.](Http://qiita.com/yozi/items/71f5b43ea99258d5fb81#%E3%81%A8%E3%82%8A%E3%81%82% E3% 81% 88% E3% 81% 9A% E3% 81% 93% E3% 82% 8C% E3% 82% 92impy% E3% 81% A8% E3% 81% 97% E3% 81% A6% E4% BF% 9D% E5% AD% 98% E3% 81% 97% E5% AE% 9F% E8% A1% 8C% E3% 81% 99% E3% 82% 8B))
I tried to make it a little easier than it was in here.
python
import sys
import pyqtgraph as pg
plt = pg.plot([0,1,2],[3,4,5])
if __name__ == '__main__':
if sys.flags.interactive != 1 or not hasattr(pg.QtCore, 'PYQT_VERSION'):
pg.QtGui.QApplication.exec_()
I thought I couldn't do it again ... I can do it.
The cause is unknown, but it seems that pyqtgraph can be used once it is plotted with matplotlib. I noticed it by chance.
python
import matplotlib.pyplot as plt
plt.plot([0,1,2],[0,1,2])
plt.show()
Anyway, after deleting the window of matplotlib,
import pyqtgraph as pg
pg.plot([0,1,2],[3,4,5])
Then you can do it safely. Importing pyqtgraph seems to be okay even before matplotlib.
I don't know what role matplotlib plays.
You can! One shot! !!
By the way, this is a graph that can be operated interactively.
--Left-click and drag to move left or right. --Right-click and drag to zoom. --From the menu that appears by right-clicking and pressing once, it also supports axis log display, image saving, plot data saving, etc.
Python_console_session
import matplotlib.pyplot as plt
plt.plot([0,1,2],[3,4,5])
plt.show()
It takes 3 lines. This can also be operated interactively. I will omit the details, It's like pressing the lower button → dragging to move the screen.
I like the operation of PyQtGraph on Ubuntu because it works faster.
Recommended Posts