Reputation: 97
Good Afternoon All,
I'm attempting to create a contour map of surface elevation by using drilling data from a mineral exploration programme. I am new to programming, any feedback would be welcomed!
Each drill hole has a:
An excerpt of the data is as follows:
Methodology
I broke the work down into two steps.
1) Checking that the data plots in the correct area
I used pandas
to extract the co-ordinates of each drilling hole from the csv file, and plotted the data using plt.scatter
from matplotlib
.
This is my output. So far it works, so now I want to plot the 3D (z axis) data.
2) Plotting of Surface_Elevation (z axis)
This is where I am having problems. I've read through several contouring guides for matplotlib which is dependent on plt.contour
. The issue is that this function wants a 2D array, and the data that I want to contour is 1D. Am I missing something here?
My attempt
import matplotlib.pyplot as plt # plot data
import pandas as pd # extract data from csv
# access csv and assign as a variable
dataset = pd.read_csv('spreadsheet.csv')
# x_axis values extracted and converted to a list from the csv
x_axis = list(dataset["Orig_East"])
# y_axis values extracted and converted to a list from the csv
y_axis = list(dataset["Orig_North"])
# z_axis values extracted and converted to a list from the csv
z_axis = list(dataset["Surface_Elevation"])
plt.contour(x_axis, y_axis, z_axis, colors='black');
plt.ticklabel_format(useOffset=False, style='plain') # remove exponential axis labels
plt.xlabel('Easting') # label x axis
plt.ylabel('Northing') # label y axis
plt.title('Surface Elevation') # label plot
# plot graph
plt.show()
Upvotes: 0
Views: 397
Reputation: 493
A possible solution is to encode the elevation of each point into the color of the scatter marker. This can be done by calling plt.scatter(x, y, c=z)
you can also specify a desired cmap
, see the documentation.
Upvotes: 1