0

I have used scatter plot to plot a 2d lithology map but since i have very less amount of data th plot is discrete. I have three columns x,y and predicted lithology which has numbers ranging from 1 to 6. So there are six lithologies that i have plotted. Below is the code that i have used

plt.figure(figsize=[15,10])

colormap = np.array(['blue','green','pink','brown','yellow','white'])

plt.scatter(df_final['x'], df_final['y'],  c=colormap[y_final-1],marker='8')

Here df_final is the data set and y_final contains the list of all the predicted lithologies from 1 to 6. Here is the result that i got using the above code

enter image description here

But as you can see that the plot is discrete and not a continuous plot. I want to plot the lithology as shown in the below figure enter image description here

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jan 02 '23 at 12:35
  • 1
    Does this answer your question? [draw a smooth polygon around data points in a scatter plot, in matplotlib](https://stackoverflow.com/questions/17553035/draw-a-smooth-polygon-around-data-points-in-a-scatter-plot-in-matplotlib) – Dschoni Jan 02 '23 at 12:36
  • @Dschoni yes its related to what i have asked but its complecated. I am a beginner to python and pandas so isnt there some library or an easy way to do it. – Bhawesh kumar singh Jan 02 '23 at 13:42
  • Sooner or later, you have to make a step outside what can be done using a cookbook recipe. Now it's 2023 and it seems a good moment to do that step. – gboffi Jan 02 '23 at 15:53
  • There might be a library doing exactly that, but that kind of research is off topic for stack overflow. – Dschoni Jan 04 '23 at 12:11
  • My suggestion would be: Get the points into an numpy array where the lithology is the value and the indeces are the coordinates of each point. Using e.g. ndi morphology, find clusters (=labelling) of points touching. For each cluster, compute the convex hull and plot a smooth polygon using the linked answer. – Dschoni Jan 04 '23 at 12:20

0 Answers0