Matplotlib
If a Markdown cell is followed by a Python cell that generates PNG output, it's assumed that the output is a Matplotlib-based diagram. Constellate will then display that PNG image in the side panel, along with the code that generated it. Constellate's first-class support of dark mode shines here: Constellate will generate a light and dark version of each plot separately and display the appropriate one.1 Note how the colors change with dark mode: the dark blue becomes a lighter blue that still maintains contrast with the background.
Because you're really coding two plots at once (one light and one dark), take care not to hardcode specific colors. If you explicitly color text white, for example, it will be unreadable on a light background. If you are doing complicated styling, reference theme variables: plt.rcParams['text.color']
will give you a theme-appropriate color for text. If you want explicit access to the categorical colors used, they're stored in the cs
variable.
With the default rho_plus
theme, you can coordinate text coloring and the categorical colors to indicate a specific part of the plot. I can reference May by writing <span class='text-c5'>May</span>
. text-c1
through text-c12
will work. There are specific names for each color as well: instead of text-c5
, I could have used text-purple
.1
On the right is a complicated figure that shows off the default Constellate theming. Note how a #constellate: setup_matplotlib
directive keeps the stock imports out of the cell, as they are in most notebooks, so the code is just the relevant part that actually makes the plot. The code will be formatted using black
for readability.
- The color names are, in order: blue, green, yellow, red, purple, cerulean, aqua, emerald, burgundy, pink, and rose. ↩
Matplotlib
If a Markdown cell is followed by a Python cell that generates PNG output, it's assumed that the output is a Matplotlib-based diagram. Constellate will then display that PNG image in the side panel, along with the code that generated it. Constellate's first-class support of dark mode shines here: Constellate will generate a light and dark version of each plot separately and display the appropriate one.1 Note how the colors change with dark mode: the dark blue becomes a lighter blue that still maintains contrast with the background.
Because you're really coding two plots at once (one light and one dark), take care not to hardcode specific colors. If you explicitly color text white, for example, it will be unreadable on a light background. If you are doing complicated styling, reference theme variables: plt.rcParams['text.color']
will give you a theme-appropriate color for text. If you want explicit access to the categorical colors used, they're stored in the cs
variable.
With the default rho_plus
theme, you can coordinate text coloring and the categorical colors to indicate a specific part of the plot. I can reference May by writing <span class='text-c5'>May</span>
. text-c1
through text-c12
will work. There are specific names for each color as well: instead of text-c5
, I could have used text-purple
.1
On the right is a complicated figure that shows off the default Constellate theming. Note how a #constellate: setup_matplotlib
directive keeps the stock imports out of the cell, as they are in most notebooks, so the code is just the relevant part that actually makes the plot. The code will be formatted using black
for readability.
- The color names are, in order: blue, green, yellow, red, purple, cerulean, aqua, emerald, burgundy, pink, and rose. ↩