From the course: Data Science Reporting with Quarto for Python
Unlock this course with a free trial
Join today to access over 24,600 courses taught by industry experts.
Using Matplotlib and Plotnine in Quarto
From the course: Data Science Reporting with Quarto for Python
Using Matplotlib and Plotnine in Quarto
- [Instructor] Matplotlib and plotnine are fantastic data visualization tools in Python that you'll want to be able to use in Quarto. So we're in a .qmd file, in the 04_01b folder, and we're going to preview this document with the keyboard shortcut Command + Shift + K. That takes a couple of seconds. We need to render the documents and preview it when it's finished. We'll see a preview on the right-hand side of the screen. Okay, so we're generating a matplotlib chart here. And notice, we've used set_figwidth and set_figheight. Do you know what unit those functions use? Those use inches. And in the HTML formats, and in web content in general, inches don't really mean very much. If we want to control exactly how big something looks in web content, we need to save our matplotlib object as an image, and then insert that image, which we've done in the code. So if we scroll down in our input document, we can see we're using savefig on line 34, and line 37, we're using markdown to insert the…
Contents
-
-
-
-
-
-
(Locked)
Using Matplotlib and Plotnine in Quarto4m 16s
-
Displaying tables of data in Quarto5m 9s
-
(Locked)
Displaying images in Quarto4m 25s
-
(Locked)
Inserting calculated values into sentences3m 34s
-
(Locked)
Adding captions and cross-references to Quarto8m 35s
-
(Locked)
Challenge: Create a rich Quarto report30s
-
(Locked)
Solution: Create a rich Quarto report8m 39s
-
(Locked)
-
-
-
-