Advertisement
lamiastella

qt Aborted (core dumped)

Jan 25th, 2021
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. and also:
  2.  
  3.  
  4. '''
  5. ====================
  6. 3D plots as subplots
  7. ====================
  8.  
  9. Demonstrate including 3D plots as subplots.
  10. '''
  11.  
  12. import matplotlib.pyplot as plt
  13. from mpl_toolkits.mplot3d.axes3d import Axes3D, get_test_data
  14. from matplotlib import cm
  15. import numpy as np
  16.  
  17.  
  18. # set up a figure twice as wide as it is tall
  19. fig = plt.figure(figsize=plt.figaspect(0.5))
  20.  
  21. #===============
  22. # First subplot
  23. #===============
  24. # set up the axes for the first plot
  25. ax = fig.add_subplot(1, 2, 1, projection='3d')
  26.  
  27. # plot a 3D surface like in the example mplot3d/surface3d_demo
  28. X = np.arange(-5, 5, 0.25)
  29. Y = np.arange(-5, 5, 0.25)
  30. X, Y = np.meshgrid(X, Y)
  31. R = np.sqrt(X**2 + Y**2)
  32. Z = np.sin(R)
  33. surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm,
  34. linewidth=0, antialiased=False)
  35. ax.set_zlim(-1.01, 1.01)
  36. fig.colorbar(surf, shrink=0.5, aspect=10)
  37.  
  38. #===============
  39. # Second subplot
  40. #===============
  41. # set up the axes for the second plot
  42. ax = fig.add_subplot(1, 2, 2, projection='3d')
  43.  
  44. # plot a 3D wireframe like in the example mplot3d/wire3d_demo
  45. X, Y, Z = get_test_data(0.05)
  46. ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10)
  47.  
  48. plt.show()
  49.  
  50.  
  51. and when I run it I get:
  52.  
  53. $ python test_qt.py
  54. qt.qpa.xcb: could not connect to display desktop:0
  55. qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
  56. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
  57.  
  58. Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
  59.  
  60. Aborted (core dumped)
  61. 18790/31772MB(vision)
  62.  
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement