A happier histogram plot
The stock exchange firm you created the histogram for thinks that all the data and plots being created are too impersonal.
They have requested that a positive message be added to the histogram plot of company revenues you recently created.
You have just the right idea - you can wish the viewer a happy day and use the current day of the week for this!
There is a fig histogram available for you, feel free to show() or print() it to remind yourself what it looks like.
Diese Übung ist Teil des Kurses
<Kurs>Introduction to Data Visualization with Plotly in Python</Kurs>Übungsanweisungen
- Position the annotation halfway along the x-axis and 95% up the y-axis.
- Set the correct values for
xrefandyreffor relative positioning. - Use the
update_layout()method to add the annotation.
Interaktive praktische Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Get and format today's date
today = datetime.today().strftime("%A")
# Create the message_annotation
message_annotation = dict(
# Set the correct coordinates
x=____, y=____, xref="____", yref="____",
# Set the format of the text and box
text=f"Have a Happy {today} :)",
font=dict(size=20, color="white"),
bgcolor="rgb(237, 64, 200)", showarrow=False
)
# Update the figure layout and show
fig.update_layout(annotations=[____])
fig.show()