'Trim data on matplotlib diagonally
Can anyone help me with how to trim plot data on the left side of this straight line besides doing it manually on excel? Thanks
I'm using pandas to load and read the excel data, this is my code:
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import matplotlib.cm as cm
plt.style.use('seaborn-poster')
import seaborn as sns
fig, ax = plt.subplots(1,1)
x = df['Ex Wavelength(nm)']
y = df['Em Wavelength(nm)']
Z = df['Intensity(cnt)']
ax.tricontourf(x, y, Z, cmap=plt.cm.viridis)
ax.set_xlabel('Excitation (nm)', labelpad=20)
ax.set_ylabel('Emission (nm)', labelpad=20)
x1 = [200, 300, 450, 200]
y1 = [500, 500, 750, 750]
mask = ax.add_patch(patches.Polygon(xy=list(zip(x1,y1)), fill=True))
m = cm.ScalarMappable(cmap=cm.viridis)
m.set_array(df['Intensity(cnt)'])
plt.colorbar(m, pad=0.15)
plt.show()
I use this excel file: https://docs.google.com/spreadsheets/d/1PuGE6Jfx_ZG2yfczJxHL1H88OnK9d5WU/edit?usp=sharing&ouid=116799328907524097274&rtpof=true&sd=true
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|