Dalam penggunaan analisis data, scatter plot adalah salah satu diagram yang paling umum digunakan untuk menampilkan hubungan antara dua variabel. Namun, dalam kasus di mana Anda memiliki banyak titik pada chart, manual adding data labels dapat menjadi proses yang tidak efisien dan memerlukan waktu yang lama.

In this case, Macabacus can be a great help. It allows you to automatically add data labels to large scatter plots with just one click. This means that you don't have to spend hours manually entering the data labels for each point on your chart.

Ketika Menggunakan Macabacus untuk Data Labels Scatter Plot

Anda seharusnya menggunakan Macabacus jika Anda memiliki scatter plot yang memiliki banyak titik dan ingin menambahkan label-data secara otomatis. Dengan menggunakan Macabacus, Anda dapat memperbarui data labels secara mudah dengan hanya beberapa klik.

Contoh Penggunaan Macabacus

Berikut adalah contoh sederhana bagaimana Macabacus digunakan untuk menambahkan data labels pada scatter plot:

When to Use Macabacus for Excel Scatter Plot Data Labels
Manually adding data labels in regular Excel works fine for scatter plots with just a few data points. Now, if you have to create a scatter chart that has dozens or hundreds of points, the manual process becomes unrealistic and really inefficient. This is where Macabacus shines. It lets you instantly add data labels to large scatter plots with just a click.
You should also use Macabacus if you need to frequently update your scatter charts. It’s easy to reapply the XY scatter labels anytime your data changes.
Try Macabacus, free for 30-days, and explore scatter plot tools, along with dozens of other Excel charting productivity features.

Menggunakan Macabacus untuk Membuat Legend pada Scatter Plot

Berikut adalah contoh sederhana bagaimana Macabacus digunakan untuk membuat legend pada scatter plot:

4,Scatter plots with a legend

Note
Go to the end
to download the full example code.

To create a scatter plot with a legend one may use a loop and create one
scatter plot per item to appear in the legend and set the label
accordingly.
The following also demonstrates how transparency of the markers
can be adjusted by giving alpha a value between 0 and 1.
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(19680801)


fig, ax = plt.subplots()
for color in ['tab:blue', 'tab:orange', 'tab:green']:
 n = 750
 x, y = np.random.rand(2, n)
 scale = 200.0 * np.random.rand(n)
 ax.scatter(x, y, c=color, s=scale, label=color,
 alpha=0.3, edgecolors='none')

ax.legend()
ax.grid(True)

plt.show()

Automated Legend Creation

Another option for creating a legend for a scatter is to use the PathCollection.legend_elements method. It will automatically try to determine a useful number of legend entries to be shown and return a tuple of handles and labels.

Automated legend creation#
Another option for creating a legend for a scatter is to use the
PathCollection.legend_elements method. It will automatically try to
determine a useful number of legend entries to be shown and return a tuple of
handles and labels. Those can be passed to the call to legend.
N = 45
x, y = np.random.rand(2, N)
c = np.random.randint(1, 5, size=N)
s = np.random.randint(10, 220, size=N)

fig, ax = plt.subplots()

scatter = ax.scatter(x, y, c=c, s=s)

# produce a legend with the unique colors from the scatter
legend1 = ax.legend(*scatter.legend_elements(),
 loc="lower left", title="Classes")
ax.add_artist(legend1)

# produce a legend with a cross-section of sizes from the scatter
handles, labels = scatter.legend_elements(prop="sizes", alpha=0.6)
legend2 = ax.legend(handles, labels, loc="upper right", title="Sizes")

plt.show()

Argumen Lanjutan untuk PathCollection.legend_elements

Berikut adalah contoh sederhana bagaimana argumen lanjutan dapat digunakan untuk PathCollection.legend_elements:

Further arguments to the PathCollection.legend_elements method
can be used to steer how many legend entries are to be created and how they
should be labeled. The following shows how to use some of them.
volume = np.random.rayleigh(27, size=40)
amount = np.random.poisson(10, size=40)
s = np.random.randint(10, 220, size=40)

fig, ax = plt.subplots()

scatter = ax.scatter(volume, amount, s=s)

# produce a legend with the unique colors from the scatter
legend1 = ax.legend(*scatter.legend_elements(),
 loc="lower left", title="Classes")
ax.add_artist(legend1)

# produce a legend with a cross-section of sizes from the scatter
handles, labels = scatter.legend_elements(prop="sizes", alpha=0.6)
legend2 = ax.legend(handles, labels, loc="upper right", title="Sizes")

plt.show()

Dalam artikel ini, kita telah melihat bagaimana Macabacus dapat membantu dalam menambahkan data labels pada scatter plot dengan cepat dan mudah. Dengan menggunakan Macabacus, Anda tidak perlu menghabiskan waktu yang lama untuk menambahkan label-data secara manual. Coba gunakan Macabacus sekarang dan lihat bagaimana Anda dapat memperbarui data labels Anda dalam waktu yang singkat!