Limits plot original dataplt plt
Additionally, the plotTransformedData function accepts three other parameters: colors, size, and limits.
The colors parameter is passed to the scatter function through its c parameter. The colors parameter must be a NumPy array, where is the number of data points and each of the three columns corresponds to an RGB value in the range [0,1]. Hint: The first point is black and the last point is green. Look up the RGB colors for these two colors and think about how you could get the colors to gradually go from black to green.
Import data from the file called 2D_data.csv. Name the returned DataFrame data.
csv data
Important: When performing the matrix multiplication, please note that the order in scalar or dot product matters. A dot B is not the same as B dot A.
Identity Matrix
import matplotlib.pyplot as plt
def plotTransformedData(original_df, trans_df, colors, size, limits):
plt.ylim(limits[2], limits[3])
plt.title('Original Data')
plt.ylim(limits[2], limits[3])
plt.title('Transformed Data')
# Create NumPy array X from the data DataFrame
X = data.values
# Perform linear transformations and plot results
trans_df = pd.DataFrame()
trans_df['y'] = transformed_data[:, 1]
# Generate colors and sizes for plotting
# Plot the transformed data
plotTransformedData(data, trans_df, colors, size, limits)


