matplotlib - Python & Matplot: how to set auto-offset? -


for example, when try plot points

points = [(0,0),(0,1),(1,1,),(1,0)] point in points:     plt.plot(point[0], point[1], 'o') plt.show() 

it display

enter image description here

this makes points hard see. how can make x, y axis wider point move center of plot? like

enter image description here

that is, how can set offset value of points bounderies of plot, won't displaed @ corners?

use xlim , ylim

points = [(0,0),(0,1),(1,1,),(1,0)]  point in points:     plt.plot(point[0], point[1], 'o')  automin, automax = plt.xlim() plt.xlim(automin-0.5, automax+0.5) automin, automax = plt.ylim() plt.ylim(automin-0.5, automax+0.5)  plt.show() 

if need set limits before plot data can turn off autoscaling first , set limits xlim , ylim


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -