Week #40 - 2022

Week #40 - 2022

Joash Xu
·Oct 7, 2022·

2 min read

Subscribe to my newsletter and never miss my upcoming articles

I started this blog to learn how to be a better communicator and write technical stuff. But I have been neglecting this blog for a while. So to push myself to write, I decided to start writing weekly posts. The idea is to take a brief note of what I find interesting during the week.


I am looking into making a data visualization dashboard for an analytics app. The library I am currently looking into is Bokeh. For aesthetic reasons, I would like a smooth area chart instead of a janky-looking graph. In C3 (a D3-based chart library), this function is available through the area-spline graph type, but in Bokeh you have to do it manually. The key to having a smooth graph is through the interpolation operation. For this, I use the pchip_interpolate from the wonderful scipy library.

Plot Comparison

def get_ts_area_plot(x, y, plot):
    date_range = x.astype('int64')
    date_space = np.linspace(date_range.min(),
                             date_range.max(),
                             len(x) * 10)
    value_smooth = pchip_interpolate(date_range, 
                                     y,
                                    date_space)

    fill_color = "#1f77b4"
    area_opacity = 0.2

    # Line chart
    plot.line(x=pd.to_datetime(date_space),
              y=value_smooth,
              color=fill_color)

    # Area chart
    plot.varea(x=pd.to_datetime(date_space),
               y1=0, y2=value_smooth,
               alpha=area_opacity,
               fill_color=fill_color)

    # Dot 
    plot.circle(x=x, y=y, size=5, color=fill_color)

    return plot

I stumbled upon a book titled Designerly Ways of Knowing. The book starts by saying that there are these “two cultures” in general education: science and humanities. But there is a third neglected culture which is design. While sciences deal with the natural world and humanities deal with human experience. Design deals with the artificial world. While we value objectivity, rationality, and neutrality in the sciences, we value subjectivity and imagination in the humanities. In design, however, we value practicality, ingenuity, and empathy. I have not finished reading the whole document, but it is pretty interesting, and I intend to finish this book.


I started incorporating some Okinawan diet components into my daily meal to stay healthy. The Okinawan diet has produced one of the world’s longest-lived populations. The most common ingredients in their diet are purple sweet potato, bitter gourd, tofu, turmeric, and green tea . According to one source, about 60% of all calories came from the purple sweet potato. The purple potato is high in B vitamins and potassium. It also has a higher concentration of the antioxidant anthocyanin (from purple pigment) than blueberries. Bitter gourd has potent compounds that control blood sugar. Out of all the so-called “blue zones,” Okinawa is the closest to where I live, and I can easily find the ingredients.

 
Share this