I'm not aware of any built in functionality that would do this but I do not use the charting abilities often.
Here is some code that should get you in the right direction though! You could modify it to use two thresholds and even base them off of standard deviation or business goals.
import matplotlib.pyplot as plt
# Sample data
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = [5, 15, 10, 20, 25, 30, 35, 40, 45, 50]
# Threshold value
threshold = 25
# Create a line chart
plt.figure(figsize=(10, 6))
# Plot the line with a single color
plt.plot(x, y, color='blue')
# Plot the dots with conditional formatting
for i in range(len(x)):
if y[i] < threshold:
plt.scatter(x[i], y[i], color='red') # Red color for values below threshold
else:
plt.scatter(x[i], y[i], color='green') # Green color for values above threshold
# Add labels and title
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Line Chart with Conditional Formatting on Dots')
# Show the plot
plt.show()
Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!