<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: João Palmeiro</title>
    <description>The latest articles on Forem by João Palmeiro (@joaompalmeiro).</description>
    <link>https://forem.com/joaompalmeiro</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F295369%2Fbc168992-ffc6-441a-90ea-2fd53d4def6f.jpg</url>
      <title>Forem: João Palmeiro</title>
      <link>https://forem.com/joaompalmeiro</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/joaompalmeiro"/>
    <language>en</language>
    <item>
      <title>How to change a tooltip to dark theme in Altair?</title>
      <dc:creator>João Palmeiro</dc:creator>
      <pubDate>Sun, 27 Mar 2022 16:37:26 +0000</pubDate>
      <link>https://forem.com/joaompalmeiro/how-to-change-a-tooltip-to-dark-theme-in-altair-2bd0</link>
      <guid>https://forem.com/joaompalmeiro/how-to-change-a-tooltip-to-dark-theme-in-altair-2bd0</guid>
      <description>&lt;p&gt;When we add a &lt;a href="https://vega.github.io/vega-lite/docs/tooltip.html"&gt;tooltip&lt;/a&gt; to a chart in Altair, as in the example below, it follows a light theme by default. This tooltip implementation comes from &lt;a href="https://github.com/vega/vega-tooltip"&gt;Vega Tooltip&lt;/a&gt;, a plugin included in &lt;a href="https://github.com/vega/vega-embed"&gt;Vega-Embed&lt;/a&gt; (the package used under the hood to render the charts).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;altair&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;alt&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"A"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"B"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"C"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"D"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"E"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"F"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"G"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"H"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"I"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="s"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;43&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;91&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;81&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;53&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;87&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;52&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Chart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;mark_bar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tooltip&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VOvGMKcG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/dnhtjs74d/image/upload/v1648398809/blog/light_theme_p3uza2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VOvGMKcG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/dnhtjs74d/image/upload/v1648398809/blog/light_theme_p3uza2.png" alt="Example of a light-themed tooltip in an Altair chart" width="880" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In addition to the &lt;code&gt;light&lt;/code&gt; theme, Vega Tooltip also has another &lt;a href="https://github.com/vega/vega-tooltip/blob/v0.28.0/src/defaults.ts#L32"&gt;predefined theme&lt;/a&gt;: the &lt;code&gt;dark&lt;/code&gt; theme. To use the &lt;code&gt;dark&lt;/code&gt; theme, let's set one of the Vega-Embed options to do so, similar to when &lt;a href="https://dev.to/joaompalmeiro/how-to-configure-vega-embed-for-a-single-altair-chart-4chd"&gt;we configured Vega-Embed for a single Altair chart&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;metadata&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"embedOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"tooltip"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"theme"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"dark"&lt;/span&gt;&lt;span class="p"&gt;}}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, considering the chart we created at the beginning, we just need to pass the dictionary defined above as an argument to the &lt;code&gt;properties()&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Chart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;mark_bar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tooltip&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;usermeta&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;metadata&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As a result, the tooltip will look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VIE4xhkE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/dnhtjs74d/image/upload/v1648398809/blog/dark_theme_rsw1ds.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VIE4xhkE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/dnhtjs74d/image/upload/v1648398809/blog/dark_theme_rsw1ds.png" alt="Example of a dark-themed tooltip in an Altair chart" width="880" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the other hand, to enable the &lt;code&gt;dark&lt;/code&gt; theme &lt;a href="https://github.com/altair-viz/altair/blob/v4.2.0/altair/utils/display.py#L39"&gt;globally&lt;/a&gt; for all charts in a notebook, for example, it is a matter of running the following snippet initially:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;renderers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set_embed_options&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tooltip&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"theme"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"dark"&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, if you have any questions or suggestions, feel free to leave a comment below!&lt;/p&gt;

</description>
      <category>python</category>
      <category>altair</category>
      <category>datavisualization</category>
      <category>vega</category>
    </item>
    <item>
      <title>A chart walks into a bar: Altair vs. leather</title>
      <dc:creator>João Palmeiro</dc:creator>
      <pubDate>Sat, 26 Mar 2022 20:47:40 +0000</pubDate>
      <link>https://forem.com/joaompalmeiro/a-chart-walks-into-a-bar-altair-vs-leather-5b9i</link>
      <guid>https://forem.com/joaompalmeiro/a-chart-walks-into-a-bar-altair-vs-leather-5b9i</guid>
      <description>&lt;p&gt;In this blog post series, we're going to compare two Data Visualization packages in the Python landscape. We will create a bar chart from dummy data, based on &lt;a href="https://altair-viz.github.io/gallery/simple_bar_chart.html"&gt;this example available in the Altair documentation&lt;/a&gt;, with each package. Furthermore, we will try to follow the most straightforward implementation to compare the two APIs/charts from their defaults.&lt;/p&gt;

&lt;p&gt;For this first installment, let's create a bar chart using &lt;a href="https://github.com/altair-viz/altair"&gt;Altair&lt;/a&gt; and then &lt;a href="https://github.com/wireservice/leather"&gt;leather&lt;/a&gt;. The dataset looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"A"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"B"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"C"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"D"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"E"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"F"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"G"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"H"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"I"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="s"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;43&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;91&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;81&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;53&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;87&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;52&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the &lt;code&gt;source&lt;/code&gt; above, we can define a bar chart in Altair via the following snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;altair&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;alt&lt;/span&gt;

&lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Chart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;mark_bar&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When we run the snippet above, we get the result below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--89DkxAo3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/dnhtjs74d/image/upload/v1648324433/blog/altair_oroodi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--89DkxAo3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/dnhtjs74d/image/upload/v1648324433/blog/altair_oroodi.png" alt="Bar chart created with Altair" width="880" height="1326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, using leather, we get a similar bar chart as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;leather&lt;/span&gt;

&lt;span class="n"&gt;chart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;leather&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Chart&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# We cannot use a pandas DataFrame directly.
&lt;/span&gt;&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add_columns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;to_records&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;tolist&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;to_svg&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---KlVd8P---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/dnhtjs74d/image/upload/v1648324433/blog/leather_ciwdtm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---KlVd8P---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/dnhtjs74d/image/upload/v1648324433/blog/leather_ciwdtm.png" alt="Bar chart created with leather" width="880" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Comparing the two (default) outputs, we can highlight a number of differences:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The default width is larger with leather. As a result, the bars are also wider.&lt;/li&gt;
&lt;li&gt;In leather, the bars are red (&lt;code&gt;#e41a1c&lt;/code&gt;), compared to blue in Altair.&lt;/li&gt;
&lt;li&gt;The bar chart created with leather does not show titles for the axes, unlike Altair.&lt;/li&gt;
&lt;li&gt;There is no axis line on the Y-axis in leather. On the X-axis, the labels are not rotated (0°).&lt;/li&gt;
&lt;li&gt;In Altair, there are only horizontal gridlines. In the case of leather, there are horizontal and vertical ones.&lt;/li&gt;
&lt;li&gt;The default fonts are different. In leather, &lt;a href="https://en.wikipedia.org/wiki/Monaco_(typeface)"&gt;Monaco&lt;/a&gt; is used.&lt;/li&gt;
&lt;li&gt;The background colors are also different. In Altair, the background color is white, while in leather, it is a (very) light gray (&lt;code&gt;#f9f9f9&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the other hand, for the Y-axis, both charts present a scale with the same domain, ending in a &lt;a href="https://github.com/d3/d3-scale"&gt;nice round value&lt;/a&gt; (100). However, the number of ticks is different.&lt;/p&gt;

&lt;p&gt;Finally, if you have any questions or suggestions, feel free to leave a comment below!&lt;/p&gt;

</description>
      <category>python</category>
      <category>datavisualization</category>
      <category>altair</category>
      <category>leather</category>
    </item>
    <item>
      <title>How do people package Altair themes? (II)</title>
      <dc:creator>João Palmeiro</dc:creator>
      <pubDate>Sun, 20 Mar 2022 17:51:03 +0000</pubDate>
      <link>https://forem.com/joaompalmeiro/how-do-people-package-altair-themes-ii-2l4i</link>
      <guid>https://forem.com/joaompalmeiro/how-do-people-package-altair-themes-ii-2l4i</guid>
      <description>&lt;p&gt;After we saw &lt;a href="https://dev.to/joaompalmeiro/how-do-people-package-altair-themes-36p3"&gt;four examples in the first part&lt;/a&gt;, let's look at four more and learn more about how people package &lt;a href="https://altair-viz.github.io/index.html"&gt;Altair&lt;/a&gt; themes.&lt;/p&gt;

&lt;p&gt;Based on the &lt;a href="https://github.com/datadesk/altair-latimes"&gt;altair-latimes&lt;/a&gt; package, we have &lt;a href="https://pypi.org/project/altair-reveal/"&gt;altair-reveal&lt;/a&gt;. In this package, we can find the &lt;a href="https://revealnews.org/"&gt;Reveal&lt;/a&gt; theme for Altair. An interesting detail in this theme is the empty space available at the bottom of each chart (bottom padding) to accommodate manually added sources and credits. We can see this detail, as well as several examples, from this &lt;a href="https://github.com/cirlabs/altair-theme-reveal/blob/main/examples.ipynb"&gt;notebook&lt;/a&gt; directly on GitHub.&lt;/p&gt;

&lt;p&gt;For the &lt;a href="https://en.wikipedia.org/wiki/Sun-Sentinel"&gt;Sun Sentinel&lt;/a&gt; theme, there is &lt;a href="https://github.com/SunSentinel/sunsentinel-altair-theme"&gt;sunsentinel_theme&lt;/a&gt;. This theme is based on &lt;a href="https://github.com/deppen8/husky-altair-theme"&gt;husky_theme&lt;/a&gt;, and for us to use it, we have to follow the steps mentioned in the &lt;a href="https://dev.to/joaompalmeiro/how-do-people-package-altair-themes-36p3"&gt;first part&lt;/a&gt; (it is not a &lt;code&gt;pip&lt;/code&gt; installable Python package).&lt;/p&gt;

&lt;p&gt;Based on &lt;a href="https://spacy.io/"&gt;spaCy&lt;/a&gt; branding, we can find two themes in the &lt;a href="https://github.com/pmbaumgartner/spacy-altair-theme"&gt;spacy-altair-theme&lt;/a&gt; package. One of them is a monospaced version of the available base theme. In addition to a function for each of the themes (each function contains some constants and returns a dictionary with the configuration for the respective theme), we can also find three importable lists for the three types of defined color palettes. To use these themes, we just need to &lt;code&gt;alt.themes.enable()&lt;/code&gt; the desired one, as these are &lt;a href="https://github.com/pmbaumgartner/spacy-altair-theme/blob/main/spacy_altair_theme/themes.py#L156"&gt;&lt;code&gt;alt.themes.register()&lt;/code&gt;ed&lt;/a&gt; when we &lt;a href="https://github.com/pmbaumgartner/spacy-altair-theme/blob/main/spacy_altair_theme/__init__.py#L3"&gt;import the package&lt;/a&gt;. As a final note, some color variants were chosen from spaCy's &lt;a href="https://spacy.io/styleguide"&gt;style guide&lt;/a&gt; because of contrast (like dark blue and dark green instead of blue and green, respectively).&lt;/p&gt;

&lt;p&gt;In the case of the &lt;a href="https://github.com/catethos/pcolor"&gt;pcolor&lt;/a&gt; package (bootstrapped from the &lt;a href="https://github.com/fastai/nbdev_template"&gt;nbdev template&lt;/a&gt;), we can find an Altair (and &lt;a href="https://seaborn.pydata.org/"&gt;seaborn&lt;/a&gt;) theme for personal use. This package contains color constants and various utilities, in addition to the typical function for the theme (&lt;code&gt;pulsifi_theme&lt;/code&gt;). It also provides a &lt;a href="https://github.com/catethos/pcolor/blob/master/pcolor/core.py#L218"&gt;utility function&lt;/a&gt; called &lt;code&gt;setup_altair()&lt;/code&gt; that wraps up theme registration and activation.&lt;/p&gt;

&lt;p&gt;Finally, if you have any questions or suggestions, feel free to leave a comment below!&lt;/p&gt;

</description>
      <category>python</category>
      <category>altair</category>
      <category>datavisualization</category>
      <category>vega</category>
    </item>
    <item>
      <title>How to configure Vega-Embed for a single Altair chart?</title>
      <dc:creator>João Palmeiro</dc:creator>
      <pubDate>Wed, 02 Mar 2022 22:57:08 +0000</pubDate>
      <link>https://forem.com/joaompalmeiro/how-to-configure-vega-embed-for-a-single-altair-chart-4chd</link>
      <guid>https://forem.com/joaompalmeiro/how-to-configure-vega-embed-for-a-single-altair-chart-4chd</guid>
      <description>&lt;p&gt;By default, in the upper right corner of each &lt;a href="https://altair-viz.github.io/"&gt;Altair&lt;/a&gt; chart, there is a dropdown menu with various options. This menu comes with &lt;a href="https://github.com/vega/vega-embed"&gt;Vega-Embed&lt;/a&gt;, the package used under the hood to &lt;a href="https://altair-viz.github.io/user_guide/internals.html"&gt;render the charts&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The Vega-Embed menu can be customized differently for each chart. For this example, we will define a menu with only the options to export the chart as PNG or SVG. Also, the default name of the generated file will be "bar_chart" instead of "visualization", and we will increase the resolution for the PNG image. So, let's see how we can do it using the &lt;code&gt;properties()&lt;/code&gt; method and the &lt;code&gt;usermeta&lt;/code&gt; argument!&lt;/p&gt;

&lt;p&gt;First of all, let's define a dictionary with all the necessary metadata:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;metadata&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"embedOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s"&gt;"actions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s"&gt;"export"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s"&gt;"compiled"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s"&gt;"editor"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="s"&gt;"i18n"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"SVG_ACTION"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"Export as SVG"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"PNG_ACTION"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"Export as PNG"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="s"&gt;"scaleFactor"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s"&gt;"downloadFileName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"bar_chart"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To keep only the items to &lt;code&gt;export&lt;/code&gt; the chart, we start by removing the remaining ones (setting them to &lt;code&gt;False&lt;/code&gt;) from the menu. Second, we renamed these items to "Export as SVG" and "Export as PNG", respectively (&lt;code&gt;i18n&lt;/code&gt;). Third and fourth, specifically for exporting the chart as PNG, we changed the resolution scale factor from 1 to 5 (&lt;code&gt;scaleFactor&lt;/code&gt;) and chose "bar_chart" (without the file extension) as our new default filename (&lt;code&gt;downloadFileName&lt;/code&gt;). For more details on these items and other options, check the &lt;a href="https://github.com/vega/vega-embed#options"&gt;README file in the Vega-Embed repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now, assuming we already have a chart (like the one in this &lt;a href="https://altair-viz.github.io/gallery/simple_bar_chart.html"&gt;example available in the Altair documentation&lt;/a&gt;), we pass the dictionary defined earlier as an argument to the &lt;code&gt;properties()&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Chart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;mark_bar&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;usermeta&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to adapt this example to a &lt;a href="https://altair-viz.github.io/user_guide/compound_charts.html"&gt;compound chart&lt;/a&gt;, make sure you use the &lt;code&gt;properties()&lt;/code&gt; method on the "final chart" and not on each of the "intermediate charts":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hconcat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Chart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;mark_bar&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Chart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;mark_bar&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;usermeta&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, if you have any questions or suggestions, feel free to leave a comment below!&lt;/p&gt;

</description>
      <category>python</category>
      <category>altair</category>
      <category>datavisualization</category>
      <category>vega</category>
    </item>
    <item>
      <title>How do people package Altair themes?</title>
      <dc:creator>João Palmeiro</dc:creator>
      <pubDate>Thu, 24 Feb 2022 19:44:37 +0000</pubDate>
      <link>https://forem.com/joaompalmeiro/how-do-people-package-altair-themes-36p3</link>
      <guid>https://forem.com/joaompalmeiro/how-do-people-package-altair-themes-36p3</guid>
      <description>&lt;p&gt;In &lt;a href="https://altair-viz.github.io/"&gt;Altair&lt;/a&gt;, we can create custom and shareable themes to apply to different charts. So, several Python packages are available with these themes ready to go. Considering four examples, let's see how other people package their Altair themes. For more information before we talk about them, check the &lt;a href="https://altair-viz.github.io/user_guide/configuration.html#altair-themes"&gt;&lt;em&gt;Altair Themes&lt;/em&gt; section available in the documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As a first example, we have the &lt;a href="https://github.com/datadesk/altair-latimes"&gt;altair-latimes&lt;/a&gt; package. Here we can find the &lt;a href="https://www.latimes.com/"&gt;Los Angeles Times&lt;/a&gt; theme for Altair. More specifically, in addition to the &lt;code&gt;theme()&lt;/code&gt; function that contains some constants and returns a dictionary with the configuration for the theme, there is a color dictionary (&lt;code&gt;palette&lt;/code&gt;). This color dictionary can also be imported and used directly.&lt;/p&gt;

&lt;p&gt;For a theme based on the &lt;a href="https://www.washington.edu/brand/graphic-elements/"&gt;University of Washington brand&lt;/a&gt;, there is &lt;a href="https://github.com/deppen8/husky-altair-theme"&gt;husky_theme&lt;/a&gt;. To leverage it, we need to run the respective &lt;a href="https://github.com/deppen8/husky-altair-theme/blob/master/husky_theme.py"&gt;file&lt;/a&gt; as a script or add it to a given project (and import the &lt;code&gt;husky_theme()&lt;/code&gt; function), as opposed to installing and importing a Python package. Like the first example, the &lt;code&gt;husky_theme()&lt;/code&gt; function contains some constants and returns a dictionary.&lt;/p&gt;

&lt;p&gt;In the &lt;a href="https://github.com/UBC-MDS/hueniversitypy"&gt;hueniversitypy&lt;/a&gt; (great name!) package, we can find different themes based on the visual identities of Canadian universities. Each theme is defined in its file, similar to the previous examples (a function with some constants and which returns a dictionary). The main difference between this package and the previous examples is that it brings together more than one theme that can be used separately (instead of being dedicated to a single theme).&lt;/p&gt;

&lt;p&gt;To use any of the themes available in the three examples mentioned above globally, we need to &lt;code&gt;alt.themes.register()&lt;/code&gt; and &lt;code&gt;alt.themes.enable()&lt;/code&gt; them. In the case of the &lt;a href="https://github.com/carbonplan/styles"&gt;carbonplan-styles&lt;/a&gt; package, which provides a light theme and a dark theme for Altair and &lt;a href="https://matplotlib.org/"&gt;Matplotlib&lt;/a&gt;, we just need to enable the theme (and we don't need to import any extras). In other words, there is no need to register the theme, as it is added to the available themes "automatically" from the &lt;a href="https://github.com/altair-viz/altair/blob/v4.2.0/altair/vegalite/v4/theme.py#L35"&gt;entry points&lt;/a&gt; defined in the &lt;code&gt;setup.py&lt;/code&gt; file (or equivalent):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;setuptools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;setup&lt;/span&gt;

&lt;span class="n"&gt;ENTRY_POINTS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"altair.vegalite.v4.theme"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s"&gt;"carbonplan_dark = carbonplan_styles.altair:dark"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s"&gt;"carbonplan_light = carbonplan_styles.altair:light"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"carbonplan-styles"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entry_points&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;ENTRY_POINTS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As for the Altair themes themselves, there is a color dictionary for each one (&lt;code&gt;colors.py&lt;/code&gt; file), importable constants for the fonts, and a function for each theme, defined from a more general function (&lt;code&gt;altair.py&lt;/code&gt; file).&lt;/p&gt;

&lt;p&gt;Finally, if you have any questions or suggestions, feel free to leave a comment below!&lt;/p&gt;

</description>
      <category>python</category>
      <category>altair</category>
      <category>datavisualization</category>
      <category>vega</category>
    </item>
    <item>
      <title>Generate a directory structure diagram with mermaid on GitLab.</title>
      <dc:creator>João Palmeiro</dc:creator>
      <pubDate>Sun, 22 Dec 2019 01:47:39 +0000</pubDate>
      <link>https://forem.com/joaompalmeiro/generate-a-directory-structure-diagram-with-mermaid-on-gitlab-642</link>
      <guid>https://forem.com/joaompalmeiro/generate-a-directory-structure-diagram-with-mermaid-on-gitlab-642</guid>
      <description>&lt;p&gt;Recently, while preparing the README file for a project hosted on GitLab, I came across the possibility of using &lt;a href="https://mermaid-js.github.io/mermaid/"&gt;mermaid&lt;/a&gt; to generate diagrams from markdown-like text. This gave me the idea of trying to recreate the tree-like diagram obtained from the &lt;code&gt;tree -L 2&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;The tree-like format was not fully preserved (the root appears as the leftmost element, but not at the top, and the reading of the elements is not as vertical, for example), but the result, made as simple as I could, was interesting, as you can see &lt;a href="https://gitlab.com/joaommpalmeiro/diagram-scratchpad"&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt;. Also, there are a few points to keep in mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The diagram (a.k.a. flowchart) generated with &lt;a href="https://mermaid-js.github.io/mermaid/"&gt;mermaid&lt;/a&gt; takes up more space than the diagram generated with the &lt;code&gt;tree -L 2&lt;/code&gt; command. In addition, if the purpose of this diagram is merely to provide an overview of the directory structure of a given project, obtaining it with &lt;a href="https://mermaid-js.github.io/mermaid/"&gt;mermaid&lt;/a&gt; may require extra effort that has no clear benefit.&lt;/li&gt;
&lt;li&gt;With the help of style features, you can use the color, for example, of subgraph boundaries (&lt;em&gt;stroke&lt;/em&gt;) to encode whether a group of elements concerns a folder or not. This information is already encoded to some extent in the indentation or vertical positioning but may be useful, for example, to separate subgroups of files under the same helper text from other files at the same hierarchical level.&lt;/li&gt;
&lt;li&gt;The use of subgraphs for individual files, as in the case of the README file, is because they have a title. This way each file may also have a helper text.&lt;/li&gt;
&lt;li&gt;The default placement of titles, as well as the "boxes" of each subgraph, can help, in my opinion, the user to quickly associate a particular helper text with the corresponding elements.&lt;/li&gt;
&lt;li&gt;At the interaction level, it is possible to associate a hyperlink with each node (check the root and the README file, please). On the other hand, you can select text from this diagram and copy it easily.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, if you want to know more about &lt;a href="https://mermaid-js.github.io/mermaid/"&gt;mermaid&lt;/a&gt; or &lt;a href="https://docs.gitlab.com/ee/user/markdown.html"&gt;GitLab Flavored Markdown&lt;/a&gt;, you can check out the links. I hope this quick sharing can be helpful to you!&lt;/p&gt;

</description>
      <category>gitlab</category>
      <category>markdown</category>
      <category>mermaid</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
