I am using ginput to plot additional points to an exisiting scatter plot, however when the new points are added the previously set x and y limits change. Attached is the code and visualizations to help explain the issue I am having.
#### CODE ####
![[Image: view?usp=sharing]](https://drive.google.com/a/mix.wvu.edu/file/d/1jfJD6MTYqkO9bIdFwz4Kal7T5PG9dEdE/view?usp=sharing)
![[Image: view?usp=sharing]](https://drive.google.com/a/mix.wvu.edu/file/d/1GdDVYWiE_W8Ej3gH4H8s8FZFm_rJGfb7/view?usp=sharing)
As you can see after the points are placed in Figure_1b that the plot zooms in and the axis limits change. I would like for the figure to maintain the format of Figure_1a after placing the points with ginput.
#### CODE ####
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
import pandas as pd import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np #### Read CSV File #### mb = pd.read_csv( 'CuerpoGeologico.csv' ) topo = pd.read_csv( 'Superficie.csv' ) #### Create Subplots #### fig = plt.figure() ax1 = fig.add_subplot( 211 ) ax2 = fig.add_subplot( 234 ) ax3 = fig.add_subplot( 235 ) ax4 = fig.add_subplot( 236 ) #### PLot Data #### ax1.scatter(mb.x, mb.y, c = 'blue' , s = 10 ) ax2.scatter(mb.x, mb.z, c = 'magenta' , s = 1 ) ax3.scatter(mb.y, mb.z, c = 'magenta' , s = 1 ) ax4.scatter(mb.x, mb.y, c = 'magenta' , s = 1 ) #### Set Grid ##### ax1.grid() #### Set Axis Limits and Ticks #### ax1.set_xticks(np.arange( 3000 , 9000 , 1000 )) ax1.set_yticks(np.arange( 4000 , 9000 , 1000 )) ax2.set_xlim([ 3000 , 8000 ]) ax2.set_xticks([ 4000 , 6000 , 8000 ]) ax2.set_yticks(np.arange( 0 , 5000 , 1000 )) ax3.set_xticks([ 4000 , 6000 , 8000 ]) ax3.set_yticks(np.arange( 0 , 5000 , 1000 )) ax4.set_xlim([ 3000 , 8000 ]) ax4.set_xticks([ 4000 , 6000 , 8000 ]) ax4.set_yticks(np.arange( 4000 , 9000 , 1000 )) #### Set Axis Labels #### ax1.set_xlabel( 'East' ) ax1.set_ylabel( 'North' ) ax2.set_xlabel( 'East' ) ax2.set_ylabel( 'Elevation' ) ax3.set_xlabel( 'North' ) ax3.set_ylabel( 'Elevation' ) ax4.set_xlabel( 'East' ) ax4.set_ylabel( 'North' ) fig.tight_layout() #### Select Drillhole Locations #### collars = plt.ginput( 2 ) x = [] y = [] for i in collars: #Create list of x and y coordinates of collars x.append(i[ 0 ]) y.append(i[ 1 ]) ax1.scatter(x, y, c = 'black' , marker = 'x' ) #Plot drillhole collars |
As you can see after the points are placed in Figure_1b that the plot zooms in and the axis limits change. I would like for the figure to maintain the format of Figure_1a after placing the points with ginput.