Forum Discussion
Need Assistance In Writing Conditional Statement to Achieve The Desired Results. Please Read Below
Hi bkanderso ,
Please review the following links, hope they can help you.
Stripplot using Seaborn in Python
seaborn.set(style = 'whitegrid')
tips = seaborn.load_dataset("tips")
seaborn.stripplot(x="day", y="total_bill", hue="smoker",
data=tips, palette="Set1", size=20,
marker="s", alpha=0.2)
plt.show()
Conditional formatting of plotly scatterplot markers
trace = go.Scatter(
x=df['x'],
y=df['y'],
mode='markers',
marker=dict(
size=42,
# I want the color to be green if lower_limit ≤ y ≤ upper_limit
# else red
color=np.where(np.logical_and(df['lower_limit'] <= df['y'], df['y'] <= df['upper_limit']), 'green', 'red'),
)
)
And you can provide some raw data in the field [UnitType] and [UnitScore] and your expected result with the screenshot, later we will check on it and give you a suitable solution. Thank you.
Best Regards
Rena
I appreciate you taking the time to look at this.
I tried your suggestion (code) and it still is not giving me what I need. I am attaching the code with my attempt to get the desired results. I believe I need to create a data frame for Unit and Rating and Unit Score of <= 0, and then insert the data frame into the strip plot code using an conditional statement. I do not know where or how to do this. West coast units (markers) will be blue in color with blue border, East coast markers will be gold with blue border. If a unit has a rating less than or equal to (<=) zero I want the border for those markers (units) to be red, else West coast units (markers) will be blue in color with blue border, East coast markers will be gold with blue border. If a unit has a payband with a score less than or equal to (<=) zero I want the fill for those markers (units) to be a hatch pattern (++) with blue border, else West coast units (markers) will be blue in color with blue border, East coast markers will be gold with blue border. My attempt to write the data frame and conditional statements is incorrect and I am hoping you can help me get this over the finish line.
Here is the code:
Here is a screenshot of the visual in Power BI without the conditional statement.