You may be used to making different diagrams using Matplotlib and Seaborn, but today we are going to introduce a very cool Python freehand style visualization package: Cutecharts.

This package can be used to generate the following diagrams that look hand-drawn, perhaps better in some scenarios. These lovely charts are also interactive and dynamic. Whenever the mouse hovers over the chart, the numbers are displayed. To create such a chart, you only need a few lines of Python code.

Currently, the library supports five charts — bar, line, pie, radar, and scatter. It also supports diagram composition.

Before we can start drawing cute charts, we need to install the Cutechart library.

Once installed, let’s try to draw bar and line graphs. Let’s start by creating data. Take the temperature data of a city as an example.

1. Bar chart

Code:

Effect:

In this bar chart, all the bars have the same color. If you want to customize the color of each bar chart, you only need to change one line of code.

2, line graph,

If you want to observe the variation difference of time series data, the line graph is undoubtedly more intuitive.

Code:

There is also a special feature:

When you hover over the chart, it automatically displays labels with numbers, and a dotted line is drawn to make the difference between this week’s temperature and last week’s more intuitive.

3. Radar map

To change the line diagram to a Radar diagram, you simply change the diagram type to CTC.radar.

Code:

Effect:

4, the pie chart

We need another data set to make pie and doughnut charts.

Create dataset:

This data set includes continent names and population share.

Effect:

And it’s easy to turn a pie chart into a doughnut chart. You just need to change the inner_radius parameter.

Code:

5. Scatter diagram

To plot the scatter plot, I will create a new data set. This time we’re using temperature and ice cream sales.

Data set:

Scatter diagram code:

6. Combination diagram

If you want to combine multiple diagrams, the code is not complicated.

The Cutecharts package is very easy to use, if you like this style of chart, give it a try.

Green lantern Education – Xiangjiu 2020/9/26 21:10:26

This article reprinted text, copyright belongs to the author, such as infringement contact xiaobian delete!

The original address: www.tuicool.com/articles/2U…

Click here to download the source code