#Google sheets

1 messages · Page 1 of 1 (latest)

gray grotto
#

@sterile pollen can you modify the script to have a the starting range as the top of the a highlighted range,the end range be the bottom and the waterfall range be the middle ?

sterile pollenBOT
# gray grotto <@1082069574901563453> can you modify the script to have a the starting range as...

Of course! To modify the script according to your request, we can use the following implementation:

  1. startingRange - Top of the highlighted range.
  2. endRange - Bottom of the highlighted range.
  3. waterfallRange - Middle of the highlighted range.

Here is a sample script in Python. Note that you would need to replace your_data with the actual data values and adapt the code to your specific use case.

import matplotlib.pyplot as plt

your_data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]  # Replace your_data with your actual data values.

startingRange = min(your_data)
endRange = max(your_data)
waterfallRange = startingRange + (endRange - startingRange) / 2

fig, ax = plt.subplots()
colors = []

for value in your_data:
    if value < waterfallRange:
        color = 'g'  # Green for the upper (starting) range
    else:
        color = 'r'  # Red for the lower (end) range
    colors.append(color)

bars = plt.bar(range(len(your_data)), your_data, color=colors)
plt.axhline(y=waterfallRange, color="blue", linestyle="--", label="Waterfall range")

# Annotate bars with values
for bar in bars:
    height = bar.get_height()
    ax.annotate('{}'.format(height),
                xy=(bar.get_x() + bar.get_width() / 2, height),
                xytext=(0, 3),  # 3 points vertical offset
                textcoords="offset points",
                ha='center', va='bottom')

plt.xlabel('Categories')
plt.ylabel('Values')
plt.title('Waterfall Chart Example')
plt.legend()
plt.show()

In this script, a waterfall chart with the specified starting, end, and waterfall ranges is created. The bar colors change depending on the waterfall range, creating a visual distinction between the upper and lower ranges.

Advertisement

xp4r is the best way to advertise on reddit. Better than reddit's built-in advertising system, and cheaper too!

gray grotto
#

@sterile pollen the data comes from the highlighted cells in sheets,can you write it so it will be compatible inside of sheets