python - Axis limits for scatter plot - Matplotlib -


I have the same problem, though the proposed solutions do not work for me.

I am planning a set of data that is plotting this pattern of the main plot:

Which is the conspiracy that differentiates Axis bounds (-1, 1) from both x and y, this marginal set with this part of the code Occurs:

  plt.figure () plt.show (data) ## Some margin L, R, B, T = PLT.exis () DX, DI = RL, TB Plat. Axis ([L-0.1 * DX, R + 0.1 * dx, b-0.1 * dy, t + 0.1 * dy])  

In problem Ray has "complicated" plot which is why I made some changes. This is the code that creates it:

  def plot_quiver_singularities (min_points, max_points, vector_field_x, vector_field_y, file_path): "" "Plot Vilkshntaan vector field: Param File_path: save path data: ultimate Vector_fild_aks for the vector field X plant Plot: ultimate Vector_fild_y: vector fields to plot y components: ultimate Min_point minimum Rating One set (A S, Y): param max_points: a set of (x, y) maximum points area "" "fig = Pieltikfigyur (fig = (8, 8)) Ax = Fig. ADDX ([.13, .3, .6, .6]) ## Plot Computor X, Y = Numpy.mgrid [-1: 1: 100 * 1j, -1: 1: 100 * 1j] m = numpy. sqrt (numpy.power (vector_field_x, 2) + numpy.power (vector_field_y, 2)) quiver = ax Thrthr (x, y, Vector_fild_aks, Vector_fild_y, M, Jeder = 1) ## Plot critical points x = Mmpiklinspes ( -1, 1, X_ step) y = Mmpiklinspas (-1, 1, Wai_steps) # Draw marks x_indices = numpy.nonzero (min_points) [0] y_in Dices = numpy.nonzero (min_points) [1] ax.scatter (X [x_indices], y [y_indices], marker = '$ \\ circlewiserow $', s = 100, zorder = 2) Maximum number x_indices = Numpy.nonzero (max_poin Ts] [0] y_indices = numpy.nonzero (max_points) [1] ax.scatter (x [x_indices], y [y_indices], marker = '$ \\ circlearrowleft $', s = 100, zorder = 2) ## Legends marker_min = plt.Line2D ((0, 0), (0, 0), Keep Markrge color = (1.0, 0.4, 0.0), Linstail = 'marker = "$ \\ Srklkarorait $' Markrgudth = 1, Markers = 10) marker_max = PLT Lin 2D ((0, 0), (0, 0), Markerge color = (0.2, 0.2, 1.0), linestyle = '', marker = '$ \\ circular rowbound $', markerguide = 1, markers = 10) plt.legend ([marker_min, marker_max], [ 'CW bread Center, CCW rot Center'], numpoints = 1, loc = 'center left', bbox_to_anchor = (1, 0.5)) quiver_cax = fig.add_axes ([ 13, .2, .6, .03]) fig.colorbar (substrate, orientation = 'horizontal', cax = quiver_cax) ## set axis border plt.xlim (-1, 1) plt.ylim (-1, 1) ## Add some margin # L, R, B, T = PLT.ex () # Dx, dy = rl, tb # plt.axis ([l-0.1 * dx, r + 0.1 * dx, b-0.1 * Dy, t + 0.1 * dy]) plt.savefig (file_path + '.png', d Pi = dpi) plt.close ()  

This creates the following image:

As can be seen, there are no axis boundaries and I have not yet found why.

Any help would be appreciated.

Thank you in advance.

I was able to solve the problem of putting this piece of code

  plt.xlim (-1, 1) plt.ylim (-1, 1)  

down calling scatter () .


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -