Matplotlib Styles: FiveThirtyEight Case Study: Takeaways



Yüklə 34,85 Kb.
Pdf görüntüsü
tarix20.11.2023
ölçüsü34,85 Kb.
#162192
mission-528-matplotlib-styles-fivethirtyeight-case-study-takeaways



Matplotlib Styles: FiveThirtyEight
Case Study: Takeaways
 
by Dataquest Labs, Inc. - All rights reserved © 2023
Syntax
Concepts
Resources
Takeaways by Dataquest Labs, Inc. - All rights reserved © 2023
Using a speci

c Matplotlib style:
import matplotlib.style as style
style.use('fivethirtyeight')
plt.plot([1, 2, 3], [5, 2, 7])
plt.show()

Checking Matplotlib's styles:
print(style.available)

Moving the x-coordinate of the left sides of the bars by using the left parameter:
ax.barh(left)

Adding a signature bar with name and data source:
ax.text(x, y, 'Creator' + ' ' * 90 + 'Source',
color,
backgroundcolor)

Matplotlib's pre-de

ned styles change the default visual properties of graphs.

We must call the 
style.use()
function before we create the graph.

Once we use a certain style, all subsequent graphs will inherit that style.

To return to the default settings, use 
style.use('default')
.

If you want to switch between di

erent styles, use style.use('default') between each change —
some of the styles can interfere with one another.

Blog Post: FiveThirtyEight Graphs Tutorial


Document Outline

  • Matplotlib Styles: FiveThirtyEight Case Study: Takeaways
    • Syntax
    • Concepts
    • Resources

Yüklə 34,85 Kb.

Dostları ilə paylaş:




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin