Title: Upgrading from 2.1.1 to 3.3.2 Causes plot3 lines to be behind plot_surface objects · Issue #18612 · matplotlib/matplotlib · GitHub
Open Graph Title: Upgrading from 2.1.1 to 3.3.2 Causes plot3 lines to be behind plot_surface objects · Issue #18612 · matplotlib/matplotlib
X Title: Upgrading from 2.1.1 to 3.3.2 Causes plot3 lines to be behind plot_surface objects · Issue #18612 · matplotlib/matplotlib
Description: Bug report Bug summary Running the code below in matplotlib version 2.1.1 and 3.3.2 produces different results. In 2.1.1 the surface is behind the orbit and in 3.3.2 the surface is in front of the orbit. The code below is supposed to sho...
Open Graph Description: Bug report Bug summary Running the code below in matplotlib version 2.1.1 and 3.3.2 produces different results. In 2.1.1 the surface is behind the orbit and in 3.3.2 the surface is in front of the ...
X Description: Bug report Bug summary Running the code below in matplotlib version 2.1.1 and 3.3.2 produces different results. In 2.1.1 the surface is behind the orbit and in 3.3.2 the surface is in front of the ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/18612
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Upgrading from 2.1.1 to 3.3.2 Causes plot3 lines to be behind plot_surface objects","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nRunning the code below in matplotlib version 2.1.1 and 3.3.2 produces different results. In 2.1.1 the surface is behind the orbit and in 3.3.2 the surface is in front of the orbit. The code below is supposed to show the orbit around a planet in which case part of the orbit should be behind and some should be in front.\r\n\r\n```\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nfrom mpl_toolkits.mplot3d import Axes3D\r\n\r\n##Kerbin Parameters\r\nG = 6.6742*10**-11; #%%Gravitational constant\r\nMkerbin = 5.2915158*10**22 #\r\n#MMun = 9.7599066*10**20 #\r\nmuKerbin = G*Mkerbin\r\n#muMun = G*MMun\r\nRkerbin = 600000 #meters\r\n#RMun = 200000 #meters\r\n\r\n##True Anamoly\r\nnu = np.linspace(0,2*np.pi,100)\r\n##Semi Major Axis of an 80 km parking orbit\r\nalt_AGL = 80000\r\nrp = Rkerbin + alt_AGL\r\n#ra = 12000000\r\nra = rp\r\na = (ra+rp)/2.\r\n#alt_AGL = 6000\r\n#a = RMun + alt_AGL\r\n##Eccentricity\r\ne = (ra - rp)/(ra+rp)\r\n##inclination\r\ni = 0*98.0*np.pi/180.0 ##Drew's random satellite he wants a just slightly over polar retrograde orbit\r\n###Longitude of the Ascending Node\r\nW = 0*45*np.pi/180.0\r\n#Argument of the periaps\r\nw = 0.\r\n\r\n##plot in the orbital plane\r\n###Phat and Qhat\r\np = a*(1-e**2)\r\nr = p/(1+e*np.cos(nu))\r\nxp = r*np.cos(nu)\r\nyq = r*np.sin(nu)\r\n\r\nplt.plot(xp,yq,'r-')\r\nplt.plot(xp[0],yq[0],'r*',markersize=20)\r\ntheta = np.linspace(0,2*np.pi,100)\r\nxkerbin = Rkerbin*np.cos(theta)\r\nykerbin = Rkerbin*np.sin(theta)\r\nplt.plot(xkerbin,ykerbin,'b-')\r\n#xMun = RMun*np.cos(theta)\r\n#yMun = RMun*np.sin(theta)\r\n#plt.plot(xMun,yMun,'b-')\r\n#plt.axis('equal')\r\nplt.title('Orbital Plane')\r\n\r\n###Rotate to Kerbin Centered Inertial Frame (KCI)\r\nzr = 0*xp\r\n\r\nTPI = np.asarray([[np.cos(W)*np.cos(w)-np.sin(W)*np.sin(w)*np.cos(i),-np.cos(W)*np.sin(w)-np.sin(W)*np.cos(w)*np.cos(i),np.sin(W)*np.sin(i)],\r\n [np.sin(W)*np.cos(w)+np.cos(W)*np.sin(w)*np.cos(i),-np.sin(W)*np.sin(w)+np.cos(W)*np.cos(w)*np.cos(i),-np.cos(W)*np.sin(i)],\r\n [np.sin(w)*np.sin(i),np.cos(w)*np.sin(i),np.cos(i)]])\r\n\r\nxi = 0*xp\r\nyj = 0*yq\r\nzk = 0*zr\r\nfor x in range(0,len(xp)):\r\n xyzO = np.asarray([xp[x],yq[x],zr[x]]) ##3x1 vector\r\n xyzi = np.matmul((TPI),xyzO)\r\n xi[x] = xyzi[0]\r\n yj[x] = xyzi[1]\r\n zk[x] = xyzi[2]\r\n \r\nfig = plt.figure()\r\nax = fig.add_subplot(111, projection='3d')\r\n\r\nu, v = np.mgrid[0:2*np.pi:20j, 0:np.pi:10j]\r\nxsph = np.cos(u)*np.sin(v)\r\nysph = np.sin(u)*np.sin(v)\r\nzsph = np.cos(v)\r\nax.plot_surface(Rkerbin*xsph,Rkerbin*ysph,Rkerbin*zsph,color='blue')\r\nax.plot(xi,yj,zk,'r-')\r\nax.scatter(xi[0],yj[0],zk[0],'r*',s=20)\r\n#ax.plot_wireframe(RMun*xsph,RMun*ysph,RMun*zsph,color='grey')\r\n#ax.axis('square')\r\n\r\n###Now let's plot velocity\r\nvx = np.sqrt(muKerbin/p)*(-np.sin(nu))\r\nvy = np.sqrt(muKerbin/p)*(e+np.cos(nu))\r\n#vx = np.sqrt(muMun/p)*(-np.sin(nu))\r\n#vy = np.sqrt(muMun/p)*(e+np.cos(nu))\r\nv = np.sqrt(vx**2 + vy**2)\r\n\r\nplt.figure()\r\nplt.plot(nu,vx,label='Vx')\r\nplt.plot(nu,vy,label='Vy')\r\nplt.plot(nu,v,label='V')\r\nplt.grid()\r\nplt.xlabel('True Anomaly (rad)')\r\nplt.ylabel('Velocity (m/s)')\r\nplt.legend()\r\n \r\nplt.show()\r\n\r\n```\r\n**Expected Outcome**\r\n\r\nSee attached screenshot. The left is python 2.7.1 and the right is 3.6.1 \r\nNotice the graphs produce different outputs. \r\n\r\n\r\n\r\n**Matplotlib version**\r\n\r\n2.2.1 and 3.3.2\r\n\r\n * Operating system: Ubuntu 18.04\r\n * Matplotlib version: 2.2.1 and 3.3.2\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): Qt5Agg\r\n * Python version: 2.7.1 for matplotlib 2.2.1 and 3.6.1 for matplotlib 3.3.2\r\n * Jupyter version (if applicable): N/A\r\n * Other libraries: numpy version 1.19.2\r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\r\nI used pip3 and pip to install\r\n","author":{"url":"https://github.com/cmontalvo251","@type":"Person","name":"cmontalvo251"},"datePublished":"2020-09-30T16:40:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/18612/matplotlib/issues/18612"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9dd09e01-6365-c005-41bc-42b84356af4b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E6E4:10FEF0:1E6D42E:286445D:6A52D79B |
| html-safe-nonce | 6fb8f044eb64b6b59a95afc13e8f63b5ce8e1c2d978bfa1f077a64ec31cb191e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkU0OjEwRkVGMDoxRTZENDJFOjI4NjQ0NUQ6NkE1MkQ3OUIiLCJ2aXNpdG9yX2lkIjoiMjU2MTI1MzU5NjQyMDI5ODY1MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 96ddad476ae94d4f71cbe7c4c4a312c6531270d24effc7323571cdd59306e8dd |
| hovercard-subject-tag | issue:712104253 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/18612/issue_layout |
| twitter:image | https://opengraph.githubassets.com/571ef2f3bfdd3e4bede0362f09939898433d9383b512b6e547231e3965d899eb/matplotlib/matplotlib/issues/18612 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/571ef2f3bfdd3e4bede0362f09939898433d9383b512b6e547231e3965d899eb/matplotlib/matplotlib/issues/18612 |
| og:image:alt | Bug report Bug summary Running the code below in matplotlib version 2.1.1 and 3.3.2 produces different results. In 2.1.1 the surface is behind the orbit and in 3.3.2 the surface is in front of the ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cmontalvo251 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width