nls-programming

Logo

Github Website with utilities, codes and more developed by Nicolas Celli. Work in progress.

View My GitHub Profile

Plotting our results:

Here we’ll import our newly created data and plot them. Import the data on the left panel, in the “Files” session and “upload to session storage”.

Then put the name of your file in the single quotes in “read_csv” and execute the code.

import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns

#- read in the file
df = pd.read_csv('test.out',sep=r"\s+")

#- plot data points
ax = sns.scatterplot(data=df,x=df.columns[0],y=df.columns[1],hue=df.columns[2],palette='RdBu');

#- make colorbar and prettify
norm = plt.Normalize(df[df.columns[2]].min(), df[df.columns[2]].max())
sm = plt.cm.ScalarMappable(cmap="RdBu", norm=norm)
sm.set_array([])
ax.get_legend().remove()
cbar = ax.figure.colorbar(sm)
cbar.ax.set_ylabel(df.columns[2])

plt.show()

png