Spaces:
Sleeping
Sleeping
Upload 64 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- ChartMimic/dataset/ori_500/density_2.png +0 -0
- ChartMimic/dataset/ori_500/density_2.py +48 -0
- ChartMimic/dataset/ori_500/density_3.png +0 -0
- ChartMimic/dataset/ori_500/density_3.py +61 -0
- ChartMimic/dataset/ori_500/density_5.png +0 -0
- ChartMimic/dataset/ori_500/density_5.py +53 -0
- ChartMimic/dataset/ori_500/errorbar_10.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_10.py +87 -0
- ChartMimic/dataset/ori_500/errorbar_12.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_12.py +85 -0
- ChartMimic/dataset/ori_500/errorbar_13.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_13.py +74 -0
- ChartMimic/dataset/ori_500/errorbar_14.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_14.py +66 -0
- ChartMimic/dataset/ori_500/errorbar_15.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_15.py +63 -0
- ChartMimic/dataset/ori_500/errorbar_17.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_17.py +39 -0
- ChartMimic/dataset/ori_500/errorbar_19.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_19.py +76 -0
- ChartMimic/dataset/ori_500/errorbar_21.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_21.py +81 -0
- ChartMimic/dataset/ori_500/errorbar_23.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_23.py +88 -0
- ChartMimic/dataset/ori_500/errorbar_28.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_28.py +82 -0
- ChartMimic/dataset/ori_500/errorbar_29.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_29.py +83 -0
- ChartMimic/dataset/ori_500/errorbar_4.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_4.py +62 -0
- ChartMimic/dataset/ori_500/errorbar_5.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_5.py +74 -0
- ChartMimic/dataset/ori_500/errorbar_6.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_6.py +105 -0
- ChartMimic/dataset/ori_500/errorbar_7.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_7.py +52 -0
- ChartMimic/dataset/ori_500/errorbar_8.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_8.py +88 -0
- ChartMimic/dataset/ori_500/errorbar_9.png +0 -0
- ChartMimic/dataset/ori_500/errorbar_9.py +64 -0
- ChartMimic/dataset/ori_500/errorpoint_1.png +0 -0
- ChartMimic/dataset/ori_500/errorpoint_1.py +66 -0
- ChartMimic/dataset/ori_500/errorpoint_2.png +0 -0
- ChartMimic/dataset/ori_500/errorpoint_2.py +43 -0
- ChartMimic/dataset/ori_500/errorpoint_4.png +0 -0
- ChartMimic/dataset/ori_500/errorpoint_4.py +72 -0
- ChartMimic/dataset/ori_500/errorpoint_5.png +0 -0
- ChartMimic/dataset/ori_500/errorpoint_5.py +77 -0
- ChartMimic/dataset/ori_500/errorpoint_6.png +0 -0
- ChartMimic/dataset/ori_500/errorpoint_6.py +105 -0
ChartMimic/dataset/ori_500/density_2.png
ADDED
![]() |
ChartMimic/dataset/ori_500/density_2.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Create some data
|
14 |
+
y = np.linspace(0, 20, 100)
|
15 |
+
x1 = np.exp(-0.5 * (y - 5) ** 2)
|
16 |
+
x2 = 0.75 * np.exp(-0.2 * (y - 8) ** 2)
|
17 |
+
|
18 |
+
# ===================
|
19 |
+
# Part 3: Plot Configuration and Rendering
|
20 |
+
# ===================
|
21 |
+
# Create the figure and axis
|
22 |
+
fig, ax = plt.subplots(figsize=(8, 4)) # Adjusted to match the dimensions in pixels
|
23 |
+
|
24 |
+
# Plot the data
|
25 |
+
# ax.fill_between(x1, y, color="gray", edgecolor="#929292" ,alpha=0.5)
|
26 |
+
ax.fill_between(
|
27 |
+
x2, y, color="pink", edgecolor="#be6373", alpha=0.5
|
28 |
+
) # Adjusted to taper off the pink area
|
29 |
+
|
30 |
+
# Add the dashed vertical line at the peak of the gray area
|
31 |
+
# Add the red horizontal line at the bottom
|
32 |
+
# ax.axhline(0, color='red', linewidth=2)
|
33 |
+
|
34 |
+
# Customize the plot to match the picture
|
35 |
+
ax.spines["top"].set_visible(False)
|
36 |
+
ax.spines["right"].set_visible(False)
|
37 |
+
ax.spines["left"].set_visible(True)
|
38 |
+
ax.spines["bottom"].set_visible(False)
|
39 |
+
ax.tick_params(left=False, labelleft=False, bottom=False, labelbottom=False)
|
40 |
+
|
41 |
+
ax.set_ylim(1, 15)
|
42 |
+
|
43 |
+
# ===================
|
44 |
+
# Part 4: Saving Output
|
45 |
+
# ===================
|
46 |
+
# Displaying the plot with tight layout to minimize white space
|
47 |
+
plt.tight_layout()
|
48 |
+
plt.savefig("density_2.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/density_3.png
ADDED
![]() |
ChartMimic/dataset/ori_500/density_3.py
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
from scipy.stats import gaussian_kde
|
10 |
+
|
11 |
+
# ===================
|
12 |
+
# Part 2: Data Preparation
|
13 |
+
# ===================
|
14 |
+
# Generate a bimodal distribution for the data
|
15 |
+
data1 = np.random.normal(loc=-0.5, scale=0.2, size=500)
|
16 |
+
data2 = np.random.normal(loc=0.5, scale=0.2, size=500)
|
17 |
+
data = np.concatenate([data1, data2])
|
18 |
+
xs = np.linspace(-1.5, 1.5, 200)
|
19 |
+
|
20 |
+
# Axes Limits and Labels
|
21 |
+
xticks_values = [-1, -0.5, 0, 0.5, 1]
|
22 |
+
xticklabels = ["-1.0", "-0.5", "0.0", "0.5", "1.0"]
|
23 |
+
yticks_values = [0, 0.2, 0.4, 0.6, 0.8, 1.0]
|
24 |
+
yticklabels = ["0.0", "0.2", "0.4", "0.6", "0.8", "1.0"]
|
25 |
+
xlim_values = [-1.5, 1.5]
|
26 |
+
ylim_values = [0, 1.2]
|
27 |
+
title = "KDE Plot of Spearman Coefficient Distribution"
|
28 |
+
xlabel_value = "Spearman Coefficient"
|
29 |
+
ylabel_value = "Density"
|
30 |
+
|
31 |
+
# ===================
|
32 |
+
# Part 3: Plot Configuration and Rendering
|
33 |
+
# ===================
|
34 |
+
# Set the figure size to match the original image's dimensions
|
35 |
+
fig, ax = plt.subplots(figsize=(8, 4))
|
36 |
+
|
37 |
+
# Create the KDE plot with adjusted x-axis range
|
38 |
+
density = gaussian_kde(data)
|
39 |
+
density.covariance_factor = lambda: 0.5
|
40 |
+
density._compute_covariance()
|
41 |
+
plt.fill_between(xs, density(xs), color="#d1e4e5", edgecolor="teal")
|
42 |
+
|
43 |
+
ax.set_xticks(xticks_values)
|
44 |
+
ax.set_xticklabels(xticklabels)
|
45 |
+
|
46 |
+
ax.set_yticks(yticks_values)
|
47 |
+
ax.set_yticklabels(yticklabels)
|
48 |
+
|
49 |
+
plt.xlim(xlim_values)
|
50 |
+
plt.ylim(ylim_values)
|
51 |
+
# Set the title and labels
|
52 |
+
plt.title(title)
|
53 |
+
plt.xlabel(xlabel_value)
|
54 |
+
plt.ylabel(ylabel_value)
|
55 |
+
|
56 |
+
# ===================
|
57 |
+
# Part 4: Saving Output
|
58 |
+
# ===================
|
59 |
+
# Displaying the plot with tight layout to minimize white space
|
60 |
+
plt.tight_layout()
|
61 |
+
plt.savefig("density_3.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/density_5.png
ADDED
![]() |
ChartMimic/dataset/ori_500/density_5.py
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
from scipy.stats import gaussian_kde
|
10 |
+
|
11 |
+
# ===================
|
12 |
+
# Part 2: Data Preparation
|
13 |
+
# ===================
|
14 |
+
# Sample data
|
15 |
+
data1 = np.random.normal(loc=8, scale=0.8, size=1000)
|
16 |
+
data2 = np.random.normal(loc=12, scale=0.8, size=1000)
|
17 |
+
|
18 |
+
# Compute density for each dataset
|
19 |
+
density1 = gaussian_kde(data1)
|
20 |
+
density2 = gaussian_kde(data2)
|
21 |
+
xs = np.linspace(5, 15, 300)
|
22 |
+
ys1 = density1(xs)
|
23 |
+
ys2 = density2(xs)
|
24 |
+
labels = ["Gucci", "Chanel"]
|
25 |
+
xlabel = "Density"
|
26 |
+
ylabel = "Value"
|
27 |
+
# ===================
|
28 |
+
# Part 3: Plot Configuration and Rendering
|
29 |
+
# ===================
|
30 |
+
# Create the figure and axis
|
31 |
+
fig, ax = plt.subplots(figsize=(9, 6))
|
32 |
+
|
33 |
+
# Fill between x for density regions
|
34 |
+
plt.fill_betweenx(xs, ys1, color="blue", alpha=0.2, label=labels[0])
|
35 |
+
plt.fill_betweenx(xs, ys2, color="green", alpha=0.2, label=labels[1])
|
36 |
+
|
37 |
+
# Set labels and title (if any)
|
38 |
+
ax.set_ylim(5, 15)
|
39 |
+
ax.set_xlabel(xlabel)
|
40 |
+
ax.set_ylabel(ylabel)
|
41 |
+
|
42 |
+
# Show grid
|
43 |
+
plt.grid(True, linestyle="--")
|
44 |
+
|
45 |
+
# Add legend
|
46 |
+
plt.legend()
|
47 |
+
|
48 |
+
# ===================
|
49 |
+
# Part 4: Saving Output
|
50 |
+
# ===================
|
51 |
+
# Displaying the plot with tight layout to minimize white space
|
52 |
+
plt.tight_layout()
|
53 |
+
plt.savefig("density_5.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_10.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_10.py
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Data
|
14 |
+
number_of_experts = [1, 2, 3, 4]
|
15 |
+
baseline = [6] * len(number_of_experts)
|
16 |
+
softmoe_unchanged = [5.8, 6.2, 7.5, 6.4]
|
17 |
+
softmoe_div_numexperts = [5.7, 6.1, 6.9, 6.2]
|
18 |
+
errors = [0.2, 0.15, 0.1, 0.05]
|
19 |
+
|
20 |
+
# Labels and Plot Types
|
21 |
+
label1 = "SoftMoE (unchanged)"
|
22 |
+
label2 = "SoftMoE (÷ NumExperts)"
|
23 |
+
label3 = "Baseline"
|
24 |
+
|
25 |
+
# Axes Limits and Labels
|
26 |
+
xlabel_value = "Number of experts"
|
27 |
+
ylabel_value = "IQM Human Normalized Score"
|
28 |
+
title = "Expert dimension"
|
29 |
+
xticklabels = ["1", "2", "4", "8"]
|
30 |
+
ylim_values = [5, 8]
|
31 |
+
yticks_values = np.arange(5, 8, 1)
|
32 |
+
legend_title = "Expert dimension"
|
33 |
+
|
34 |
+
# ===================
|
35 |
+
# Part 3: Plot Configuration and Rendering
|
36 |
+
# ===================
|
37 |
+
# Plotting
|
38 |
+
fig, ax = plt.subplots(figsize=(8, 6)) # Adjusted for the given dimensions
|
39 |
+
bar_width = 0.4
|
40 |
+
opacity = 0.8
|
41 |
+
|
42 |
+
bar1 = ax.bar(
|
43 |
+
np.array(number_of_experts) - bar_width / 2,
|
44 |
+
softmoe_unchanged,
|
45 |
+
bar_width,
|
46 |
+
alpha=opacity,
|
47 |
+
color="#41886c",
|
48 |
+
label=label1,
|
49 |
+
yerr=errors,
|
50 |
+
capsize=3,
|
51 |
+
)
|
52 |
+
|
53 |
+
bar2 = ax.bar(
|
54 |
+
np.array(number_of_experts) + bar_width / 2,
|
55 |
+
softmoe_div_numexperts,
|
56 |
+
bar_width,
|
57 |
+
alpha=opacity,
|
58 |
+
color="#b886b3",
|
59 |
+
label=label2,
|
60 |
+
yerr=errors,
|
61 |
+
capsize=3,
|
62 |
+
)
|
63 |
+
|
64 |
+
ax.plot(
|
65 |
+
number_of_experts,
|
66 |
+
baseline,
|
67 |
+
linestyle="--",
|
68 |
+
color="b",
|
69 |
+
linewidth=2,
|
70 |
+
label=label3,
|
71 |
+
)
|
72 |
+
|
73 |
+
ax.set_xlabel(xlabel_value)
|
74 |
+
ax.set_ylabel(ylabel_value)
|
75 |
+
ax.set_title(title)
|
76 |
+
ax.set_xticks(number_of_experts)
|
77 |
+
ax.set_xticklabels(xticklabels)
|
78 |
+
ax.set_ylim(ylim_values)
|
79 |
+
ax.set_yticks(yticks_values)
|
80 |
+
ax.legend(loc="upper left", title=legend_title)
|
81 |
+
|
82 |
+
# ===================
|
83 |
+
# Part 4: Saving Output
|
84 |
+
# ===================
|
85 |
+
# Displaying the plot with tight layout to minimize white space
|
86 |
+
plt.tight_layout()
|
87 |
+
plt.savefig("errorbar_10.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_12.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_12.py
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Data (estimated from the image)
|
14 |
+
means = [np.random.uniform(-15, 0, 3) for m in range(4)]
|
15 |
+
errors = [np.random.randint(1, 5, 3) for n in range(4)]
|
16 |
+
|
17 |
+
# Labels
|
18 |
+
labels = ["GPT-4", "Claude-2.1", "Claude-2", "GPT-3.5"]
|
19 |
+
x = np.arange(len(labels) - 1) # Adjusted to have 3 bars instead of 4
|
20 |
+
|
21 |
+
label_s = [
|
22 |
+
["Claude-2.1", "Claude-2", "GPT-3.5"],
|
23 |
+
["GPT-4", "Claude-2", "GPT-3.5"],
|
24 |
+
["GPT-4", "Claude-2.1", "Claude-2"],
|
25 |
+
["GPT-4", "Claude-2.1", "GPT-3.5"],
|
26 |
+
]
|
27 |
+
title = "Sellers (valuation 60)"
|
28 |
+
xlabel = "Buyer (valuation 40)"
|
29 |
+
ylim = [-20, 0]
|
30 |
+
yticks = [-20, -10, 0]
|
31 |
+
|
32 |
+
|
33 |
+
# ===================
|
34 |
+
# Part 3: Plot Configuration and Rendering
|
35 |
+
# ===================
|
36 |
+
# Plotting
|
37 |
+
fig, axs = plt.subplots(
|
38 |
+
2, 2, figsize=(8, 5)
|
39 |
+
) # Adjusted to match the original image's dimensions
|
40 |
+
# Define colors for each bar
|
41 |
+
colors = [
|
42 |
+
["sandybrown", "lightseagreen", "indianred"],
|
43 |
+
["dodgerblue", "lightseagreen", "indianred"],
|
44 |
+
["dodgerblue", "sandybrown", "lightseagreen"],
|
45 |
+
["dodgerblue", "sandybrown", "indianred"],
|
46 |
+
]
|
47 |
+
|
48 |
+
|
49 |
+
# Loop through each subplot to set properties
|
50 |
+
for i, ax in enumerate(axs.flat):
|
51 |
+
ax.bar(
|
52 |
+
x,
|
53 |
+
means[i],
|
54 |
+
yerr=errors[i],
|
55 |
+
color=colors[i],
|
56 |
+
edgecolor="white",
|
57 |
+
label=label_s[i],
|
58 |
+
)
|
59 |
+
ax.set_xlabel(f"{labels[i]} {xlabel}")
|
60 |
+
ax.set_xticks([])
|
61 |
+
for spine in ax.spines.values():
|
62 |
+
spine.set_visible(False)
|
63 |
+
ax.set_ylim(ylim)
|
64 |
+
ax.set_yticks(yticks)
|
65 |
+
ax.set_facecolor("#eaeaf2")
|
66 |
+
ax.yaxis.grid(color="white", linestyle="-", linewidth=1)
|
67 |
+
ax.set_axisbelow(True)
|
68 |
+
ax.tick_params(axis="both", length=0)
|
69 |
+
|
70 |
+
fig.legend(
|
71 |
+
labels,
|
72 |
+
loc="lower center",
|
73 |
+
ncol=4,
|
74 |
+
bbox_to_anchor=(0.5, -0.1),
|
75 |
+
title=title,
|
76 |
+
facecolor="#eaeaf2",
|
77 |
+
)
|
78 |
+
|
79 |
+
# ===================
|
80 |
+
# Part 4: Saving Output
|
81 |
+
# ===================
|
82 |
+
# Adjust layout
|
83 |
+
plt.tight_layout()
|
84 |
+
# Legend
|
85 |
+
plt.savefig("errorbar_12.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_13.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_13.py
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
|
6 |
+
# ===================
|
7 |
+
# Part 2: Data Preparation
|
8 |
+
# ===================
|
9 |
+
# Data
|
10 |
+
categories = [
|
11 |
+
"DNN x \n(k=1)",
|
12 |
+
"DNN x \nred\n(k=2)",
|
13 |
+
"DNN x \n(k=1)",
|
14 |
+
"DNN x red\n (k=1)",
|
15 |
+
][::-1]
|
16 |
+
subcategories = ["[m]", "[ΔR]", "[${ΔR^{-1}}$]", "[none]"][::-1]
|
17 |
+
values = [
|
18 |
+
[0.84, 0.83, 0.82, 0.76],
|
19 |
+
[0.84, 0.83, 0.825, 0.76],
|
20 |
+
[0.82, 0.81, 0.8, 0.74],
|
21 |
+
[0.81, 0.8, 0.79, 0.73],
|
22 |
+
]
|
23 |
+
errors = [
|
24 |
+
[0.02, 0.01, 0.01, 0.01],
|
25 |
+
[0.02, 0.01, 0.02, 0.01],
|
26 |
+
[0.01, 0.04, 0.03, 0.015],
|
27 |
+
[0.01, 0.01, 0.01, 0.012],
|
28 |
+
]
|
29 |
+
percentages = [
|
30 |
+
"+9.5%",
|
31 |
+
"+8.3%",
|
32 |
+
"+8.0%",
|
33 |
+
" ",
|
34 |
+
"+8.0%",
|
35 |
+
"+6.6%",
|
36 |
+
"+6.2%",
|
37 |
+
" ",
|
38 |
+
"+10.6%",
|
39 |
+
"+8.9%",
|
40 |
+
"+8.0%",
|
41 |
+
" ",
|
42 |
+
"+9.6%",
|
43 |
+
"+8.6%",
|
44 |
+
"+7.8%",
|
45 |
+
" ",
|
46 |
+
][::-1]
|
47 |
+
xlim = [0.5, 0.9]
|
48 |
+
|
49 |
+
# ===================
|
50 |
+
# Part 3: Plot Configuration and Rendering
|
51 |
+
# ===================
|
52 |
+
# Plotting
|
53 |
+
fig, axes = plt.subplots(4, 1, figsize=(8, 8), sharex=True)
|
54 |
+
|
55 |
+
for i, ax in enumerate(axes):
|
56 |
+
ax.barh(subcategories, values[i][::-1], xerr=errors[i], color="gray", capsize=5)
|
57 |
+
ax.set_yticklabels(subcategories)
|
58 |
+
ax.set_xlim(xlim)
|
59 |
+
ax.set_ylabel(categories[i])
|
60 |
+
for j, v in enumerate(values[i][::-1]):
|
61 |
+
ax.text(
|
62 |
+
v + errors[i][j] + 0.01,
|
63 |
+
j,
|
64 |
+
percentages[i * 4 + j],
|
65 |
+
color="black",
|
66 |
+
va="center",
|
67 |
+
)
|
68 |
+
|
69 |
+
# ===================
|
70 |
+
# Part 4: Saving Output
|
71 |
+
# ===================
|
72 |
+
# Adjust layout and save
|
73 |
+
plt.tight_layout()
|
74 |
+
plt.savefig("errorbar_13.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_14.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_14.py
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Data
|
14 |
+
categories = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"]
|
15 |
+
values = [0.18, 0.15, 0.12, 0.09, 0.06, 0.03, -0.06, -0.03, -0.02, -0.03]
|
16 |
+
errors = [0.05, 0.04, 0.03, 0.03, 0.02, 0.02, 0.02, 0.02, 0.01, 0.01]
|
17 |
+
colors = [
|
18 |
+
"#c0d5e6",
|
19 |
+
"#709ec6",
|
20 |
+
"#f2a965",
|
21 |
+
"#c6e1c2",
|
22 |
+
"#7fba74",
|
23 |
+
"#eac0bf",
|
24 |
+
"#d36e6c",
|
25 |
+
"#7f7f7f",
|
26 |
+
"#bcbd22",
|
27 |
+
"#a88a83",
|
28 |
+
]
|
29 |
+
|
30 |
+
# Axes Limits and Labels
|
31 |
+
ylabel_value = "Posterior accuracy\n(Δ to no prompting)"
|
32 |
+
ylim_values = [-0.08, 0.22]
|
33 |
+
|
34 |
+
# ===================
|
35 |
+
# Part 3: Plot Configuration and Rendering
|
36 |
+
# ===================
|
37 |
+
# Create figure and axis
|
38 |
+
fig, ax = plt.subplots(figsize=(8, 6))
|
39 |
+
|
40 |
+
# Bar chart
|
41 |
+
bars = ax.bar(
|
42 |
+
categories, values, yerr=errors, color=colors, capsize=0, edgecolor="none"
|
43 |
+
)
|
44 |
+
ax.set_xticks([])
|
45 |
+
# Set labels
|
46 |
+
ax.set_ylabel(ylabel_value)
|
47 |
+
|
48 |
+
# Set x-axis limits and y-axis limits
|
49 |
+
ax.set_ylim(ylim_values)
|
50 |
+
|
51 |
+
# Remove top and right spines
|
52 |
+
ax.spines["top"].set_visible(False)
|
53 |
+
ax.spines["right"].set_visible(False)
|
54 |
+
ax.spines["left"].set_visible(True)
|
55 |
+
ax.spines["bottom"].set_visible(True)
|
56 |
+
|
57 |
+
# Remove grid lines
|
58 |
+
ax.yaxis.grid(False)
|
59 |
+
ax.xaxis.grid(False)
|
60 |
+
|
61 |
+
# ===================
|
62 |
+
# Part 4: Saving Output
|
63 |
+
# ===================
|
64 |
+
# Adjust layout to prevent clipping of ylabel
|
65 |
+
plt.tight_layout()
|
66 |
+
plt.savefig("errorbar_14.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_15.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_15.py
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Data
|
14 |
+
categories = ["Medium", "Medium-replay", "Medium-expert"]
|
15 |
+
methods = ["AUG", "TEstimation", "Qualification", "DiffStitch"]
|
16 |
+
performance = np.array([[60, 70, 80, 70], [80, 70, 75, 80], [70, 80, 75, 80]])
|
17 |
+
errors = np.array([[10, 10, 6, 6], [6, 10, 5, 4], [10, 4, 5, 4]])
|
18 |
+
ylim = [40, 90]
|
19 |
+
ylabel = "Performance"
|
20 |
+
|
21 |
+
# ===================
|
22 |
+
# Part 3: Plot Configuration and Rendering
|
23 |
+
# ===================
|
24 |
+
# Figure size 720x216 pixels
|
25 |
+
fig, axes = plt.subplots(1, 3, figsize=(10, 3))
|
26 |
+
# Colors
|
27 |
+
colors = ["#d66929", "#f7cc46", "blue", "darkblue"]
|
28 |
+
|
29 |
+
# Bar width
|
30 |
+
bar_width = 1
|
31 |
+
|
32 |
+
# Plotting bars
|
33 |
+
for i, ax in enumerate(axes):
|
34 |
+
for j, method in enumerate(methods):
|
35 |
+
ax.bar(
|
36 |
+
j + bar_width * i,
|
37 |
+
performance[i, j],
|
38 |
+
width=bar_width,
|
39 |
+
color=colors[j],
|
40 |
+
yerr=errors[i, j],
|
41 |
+
capsize=5,
|
42 |
+
label=method if i == 0 else "",
|
43 |
+
)
|
44 |
+
|
45 |
+
# Setting x-axis labels, y-axis limits, and titles
|
46 |
+
for i, ax in enumerate(axes):
|
47 |
+
ax.set_xticks([])
|
48 |
+
# ax.set_xticklabels(methods)
|
49 |
+
ax.set_ylim(ylim)
|
50 |
+
ax.set_xlabel(f"({chr(97+i)}) {categories[i]}")
|
51 |
+
ax.set_ylabel(ylabel)
|
52 |
+
ax.yaxis.grid(True)
|
53 |
+
ax.set_axisbelow(True)
|
54 |
+
|
55 |
+
# Adding legend outside of the plot
|
56 |
+
fig.legend(loc="upper center", bbox_to_anchor=(0.5, 1.1), ncol=len(methods))
|
57 |
+
|
58 |
+
# ===================
|
59 |
+
# Part 4: Saving Output
|
60 |
+
# ===================
|
61 |
+
# Adjusting layout and saving the figure
|
62 |
+
plt.tight_layout()
|
63 |
+
plt.savefig("errorbar_15.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_17.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_17.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
categories = ["United States", "Germany", "India", "Brazil", "Japan"]
|
14 |
+
|
15 |
+
values = [0.88, 0.65, 0.25, 0.36, 0.62]
|
16 |
+
errors = [0.03, 0.02, 0.05, 0.04, 0.03]
|
17 |
+
|
18 |
+
categories2 = ["United States", "Germany", "India", "Brazil", "Japan"]
|
19 |
+
values2 = [16, 15, 35, 20, 12]
|
20 |
+
errors2 = [1, 0.5, 2, 1.5, 0.5]
|
21 |
+
|
22 |
+
titles = ["Higher Education Enrollment Rate", "Student-Teacher Ratio"]
|
23 |
+
|
24 |
+
# ===================
|
25 |
+
# Part 3: Plot Configuration and Rendering
|
26 |
+
# ===================
|
27 |
+
colors = plt.get_cmap("Set3")(np.linspace(0.2, 0.8, 5))
|
28 |
+
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(6, 6))
|
29 |
+
ax1.barh(categories, values, xerr=errors, color=colors, capsize=3)
|
30 |
+
ax2.barh(categories2, values2, xerr=errors2, color=colors, capsize=3)
|
31 |
+
|
32 |
+
ax1.set_title(titles[0])
|
33 |
+
ax2.set_title(titles[1])
|
34 |
+
|
35 |
+
# ===================
|
36 |
+
# Part 4: Saving Output
|
37 |
+
# ===================
|
38 |
+
plt.tight_layout()
|
39 |
+
plt.savefig("errorbar_17.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_19.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_19.py
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Data representing social statistics for three different cities
|
14 |
+
categories = ["Detroit", "Philadelphia", "Baltimore"]
|
15 |
+
metrics = [
|
16 |
+
"Crime Rate",
|
17 |
+
"Happiness Index",
|
18 |
+
"Social Security Coverage",
|
19 |
+
"Political Participation",
|
20 |
+
]
|
21 |
+
performance = np.array(
|
22 |
+
[
|
23 |
+
[50, 70, 90, 80],
|
24 |
+
[60, 80, 85, 75],
|
25 |
+
[40, 75, 95, 85],
|
26 |
+
]
|
27 |
+
)
|
28 |
+
errors = np.array(
|
29 |
+
[
|
30 |
+
[5, 6, 9, 6],
|
31 |
+
[6, 7, 8, 7],
|
32 |
+
[8, 9, 6, 8],
|
33 |
+
]
|
34 |
+
)
|
35 |
+
ylim = [30, 100]
|
36 |
+
ylabel = "Percentage"
|
37 |
+
|
38 |
+
# ===================
|
39 |
+
# Part 3: Plot Configuration and Rendering
|
40 |
+
# ===================
|
41 |
+
# Figure size to match a 3x1 subplot layout
|
42 |
+
fig, axes = plt.subplots(3, 1, figsize=(10, 9), sharex=True)
|
43 |
+
# Colors, choosing a different palette to differentiate the plots
|
44 |
+
colors = ["#8e44ad", "#3498db", "#e74c3c", "#f1c40f"]
|
45 |
+
|
46 |
+
# Plotting bars
|
47 |
+
for i, ax in enumerate(axes):
|
48 |
+
for j, metric in enumerate(metrics):
|
49 |
+
ax.bar(
|
50 |
+
j,
|
51 |
+
performance[i, j],
|
52 |
+
width=0.8,
|
53 |
+
color=colors[j],
|
54 |
+
yerr=errors[i, j],
|
55 |
+
capsize=0,
|
56 |
+
label=metric if i == 0 else "",
|
57 |
+
)
|
58 |
+
|
59 |
+
# Setting x-axis labels, y-axis limits, and titles
|
60 |
+
ax.set_xticks(range(len(metrics)))
|
61 |
+
ax.set_xticklabels(metrics, rotation=45)
|
62 |
+
ax.set_ylim(ylim)
|
63 |
+
ax.set_xlabel(f"({chr(97+i)}) {categories[i]}")
|
64 |
+
ax.set_ylabel(ylabel)
|
65 |
+
ax.yaxis.grid(True)
|
66 |
+
ax.set_axisbelow(True)
|
67 |
+
|
68 |
+
# Adding a legend outside of the plot on top
|
69 |
+
fig.legend(loc="upper center", bbox_to_anchor=(0.5, 1.05), ncol=len(metrics))
|
70 |
+
|
71 |
+
# ===================
|
72 |
+
# Part 4: Saving Output
|
73 |
+
# ===================
|
74 |
+
# Adjusting layout to prevent overlap and ensure labels are visible
|
75 |
+
plt.tight_layout()
|
76 |
+
plt.savefig("errorbar_19.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_21.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_21.py
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Categories and values for different countries
|
14 |
+
categories = ["Germany", "China", "USA", "India", "Brazil"][::-1]
|
15 |
+
energy_consumption = [-4000, -6000, -5500, -3000, -2000][
|
16 |
+
::-1
|
17 |
+
] # Total energy consumption in Petajoules
|
18 |
+
consumption_error = [400, 550, 400, 550, 400][
|
19 |
+
::-1
|
20 |
+
] # Error values for energy consumption
|
21 |
+
|
22 |
+
renewable_energy = [20, 25, 18, 15, 10][
|
23 |
+
::-1
|
24 |
+
] # Renewable energy usage as percentage of total
|
25 |
+
renewable_error = [3, 3.5, 4, 2.5, 3.8][::-1] # Error values for renewable energy usage
|
26 |
+
xlabels = ["Energy Consumption (Petajoules)", "Renewable Energy Usage (%)"]
|
27 |
+
titles = ["Total Energy Consumption by Country", "Renewable Energy Usage by Country"]
|
28 |
+
xlims = [[-6500, 0], [0, 30]]
|
29 |
+
|
30 |
+
|
31 |
+
# ===================
|
32 |
+
# Part 3: Plot Configuration and Rendering
|
33 |
+
# ===================
|
34 |
+
# Create horizontal bar chart with subplots
|
35 |
+
fig, axes = plt.subplots(1, 2, figsize=(10, 6), sharey=True) # Adjust figure size
|
36 |
+
|
37 |
+
# Setting colors for the bars
|
38 |
+
neg_colors = ["#c5b3d6"] * 5
|
39 |
+
pos_colors = ["#76d7c4"] * 5
|
40 |
+
|
41 |
+
# Plotting bars for negative values (Energy Consumption)
|
42 |
+
bars = axes[0].barh(
|
43 |
+
categories,
|
44 |
+
energy_consumption,
|
45 |
+
color=neg_colors,
|
46 |
+
edgecolor="white",
|
47 |
+
height=0.5,
|
48 |
+
xerr=consumption_error,
|
49 |
+
capsize=0,
|
50 |
+
)
|
51 |
+
axes[0].set_xlabel(xlabels[0])
|
52 |
+
axes[0].set_title(titles[0])
|
53 |
+
axes[0].invert_yaxis()
|
54 |
+
axes[0].set_xlim(xlims[0])
|
55 |
+
axes[0].xaxis.grid(True)
|
56 |
+
axes[0].spines["top"].set_visible(False)
|
57 |
+
axes[0].spines["right"].set_visible(False)
|
58 |
+
|
59 |
+
# Plotting bars for positive values (Renewable Energy Usage)
|
60 |
+
bars2 = axes[1].barh(
|
61 |
+
categories,
|
62 |
+
renewable_energy,
|
63 |
+
color=pos_colors,
|
64 |
+
edgecolor="white",
|
65 |
+
height=0.5,
|
66 |
+
xerr=renewable_error,
|
67 |
+
capsize=0,
|
68 |
+
)
|
69 |
+
axes[1].set_xlabel(xlabels[1])
|
70 |
+
axes[1].set_title(titles[1])
|
71 |
+
axes[1].invert_yaxis()
|
72 |
+
axes[1].set_xlim(xlims[1])
|
73 |
+
axes[1].xaxis.grid(True)
|
74 |
+
axes[1].spines["top"].set_visible(False)
|
75 |
+
axes[1].spines["right"].set_visible(False)
|
76 |
+
|
77 |
+
# ===================
|
78 |
+
# Part 4: Saving Output
|
79 |
+
# ===================
|
80 |
+
plt.tight_layout()
|
81 |
+
plt.savefig("errorbar_21.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_23.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_23.py
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Data
|
14 |
+
entities = ["Wind", "Solar", "Hydro", "Nuclear"]
|
15 |
+
protocols = [
|
16 |
+
"Installation Efficiency",
|
17 |
+
"Operational Efficiency",
|
18 |
+
"Maintenance Costs",
|
19 |
+
"Environmental Impact",
|
20 |
+
"Regulatory Compliance",
|
21 |
+
"Safety Standards",
|
22 |
+
]
|
23 |
+
# Simulated mean scores for different protocols (more distinctive values)
|
24 |
+
efficiency_means = np.array(
|
25 |
+
[
|
26 |
+
[95, 60, 90, 55, 80, 95], # Wind
|
27 |
+
[70, 90, 70, 85, 60, 85], # Solar
|
28 |
+
[85, 75, 100, 70, 90, 75], # Hydro
|
29 |
+
[60, 85, 65, 95, 85, 65], # Nuclear
|
30 |
+
]
|
31 |
+
)
|
32 |
+
|
33 |
+
# Simulated standard deviations for scores (made more dramatic)
|
34 |
+
efficiency_std = np.array(
|
35 |
+
[
|
36 |
+
[5, 10, 6, 8, 5, 3], # Wind
|
37 |
+
[8, 6, 7, 5, 9, 4], # Solar
|
38 |
+
[7, 8, 5, 10, 6, 5], # Hydro
|
39 |
+
[9, 7, 8, 4, 7, 6], # Nuclear
|
40 |
+
]
|
41 |
+
)
|
42 |
+
xlabel = "Energy Assessment Entity"
|
43 |
+
ylabel = "Efficiency and Cost Scores (%)"
|
44 |
+
ylim = [40, 105]
|
45 |
+
legendtitle = "Evaluation Protocol"
|
46 |
+
|
47 |
+
|
48 |
+
# ===================
|
49 |
+
# Part 3: Plot Configuration and Rendering
|
50 |
+
# ===================
|
51 |
+
fig, ax = plt.subplots(figsize=(10, 5))
|
52 |
+
# Subdued color palette
|
53 |
+
colors = ["#92c6ff", "#97f0aa", "#ff9f9a", "#d0bbff", "#ffb480", "#99e6e6"]
|
54 |
+
|
55 |
+
# Bar width and positions
|
56 |
+
bar_width = 0.12
|
57 |
+
|
58 |
+
# Positions of the bar groups
|
59 |
+
r = np.arange(len(entities))
|
60 |
+
|
61 |
+
# Drawing bars for different protocols
|
62 |
+
for i in range(len(protocols)):
|
63 |
+
ax.bar(
|
64 |
+
r + i * bar_width,
|
65 |
+
efficiency_means[:, i],
|
66 |
+
yerr=efficiency_std[:, i],
|
67 |
+
width=bar_width,
|
68 |
+
label=protocols[i],
|
69 |
+
capsize=0,
|
70 |
+
color=colors[i],
|
71 |
+
edgecolor="black",
|
72 |
+
)
|
73 |
+
|
74 |
+
# Set x-axis labels and axis properties
|
75 |
+
ax.set_xlabel(xlabel)
|
76 |
+
ax.set_xticks(r + bar_width * (len(protocols) / 2))
|
77 |
+
ax.set_xticklabels(entities)
|
78 |
+
ax.set_ylabel(ylabel)
|
79 |
+
ax.set_ylim(ylim) # Adjust y-axis to better fit extended range
|
80 |
+
|
81 |
+
# Customize the legend
|
82 |
+
ax.legend(loc="lower center", bbox_to_anchor=(0.5, -0.4), title=legendtitle, ncol=3)
|
83 |
+
|
84 |
+
# ===================
|
85 |
+
# Part 4: Saving Output
|
86 |
+
# ===================
|
87 |
+
plt.tight_layout()
|
88 |
+
plt.savefig("errorbar_23.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_28.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_28.py
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
import matplotlib.colors as mcolors
|
10 |
+
|
11 |
+
# ===================
|
12 |
+
# Part 2: Data Preparation
|
13 |
+
# ===================
|
14 |
+
# Data for environmental factors affecting plant growth
|
15 |
+
categories = [
|
16 |
+
"Sunlight",
|
17 |
+
"Water Quality",
|
18 |
+
"Soil pH",
|
19 |
+
"Fertilizer",
|
20 |
+
"Temperature",
|
21 |
+
"Pesticides",
|
22 |
+
"CO2 Levels",
|
23 |
+
"Plant Variety",
|
24 |
+
"Planting Density",
|
25 |
+
"Watering Frequency",
|
26 |
+
]
|
27 |
+
values = [0.18, 0.15, 0.12, 0.09, 0.06, 0.03, -0.06, -0.03, -0.02, -0.03]
|
28 |
+
errors = [0.05, 0.04, 0.03, 0.03, 0.02, 0.02, 0.02, 0.02, 0.01, 0.01]
|
29 |
+
|
30 |
+
min_val = min(values) - 0.1
|
31 |
+
max_val = max(values) + 0.1
|
32 |
+
|
33 |
+
|
34 |
+
# Normalizing function to convert values to a 0-1 range for color scaling
|
35 |
+
def normalize(value, min_val, max_val):
|
36 |
+
return (value - min_val) / (max_val - min_val)
|
37 |
+
|
38 |
+
|
39 |
+
# Determine color based on normalized value
|
40 |
+
def get_color(value):
|
41 |
+
norm_value = normalize(value, min_val, max_val)
|
42 |
+
green_base = np.array(mcolors.to_rgb("#6a8347"))
|
43 |
+
# Create a color that ranges from very light green to the base green
|
44 |
+
return mcolors.to_hex((1 - green_base) * (1 - norm_value) + green_base)
|
45 |
+
|
46 |
+
|
47 |
+
colors = [get_color(value) for value in values]
|
48 |
+
|
49 |
+
# Axes Limits and Labels
|
50 |
+
ylabel_value = "Environmental Factors"
|
51 |
+
xlabel_value = "Impact on Plant Growth (Δ to control)"
|
52 |
+
|
53 |
+
# ===================
|
54 |
+
# Part 3: Plot Configuration and Rendering
|
55 |
+
# ===================
|
56 |
+
# Create figure and axis
|
57 |
+
fig, ax = plt.subplots(figsize=(10, 8))
|
58 |
+
|
59 |
+
# Horizontal bar chart
|
60 |
+
bars = ax.barh(
|
61 |
+
categories, values, xerr=errors, color=colors, capsize=3, edgecolor="none"
|
62 |
+
)
|
63 |
+
ax.set_ylabel(ylabel_value)
|
64 |
+
ax.set_xlabel(xlabel_value)
|
65 |
+
|
66 |
+
# Set y-axis limits and x-axis limits
|
67 |
+
ax.set_xlim(min_val, max_val) # Adjust limits to encompass errors
|
68 |
+
|
69 |
+
# Remove top and right spines for a cleaner look
|
70 |
+
ax.spines["top"].set_visible(False)
|
71 |
+
ax.spines["right"].set_visible(False)
|
72 |
+
|
73 |
+
# Customize grid lines
|
74 |
+
ax.xaxis.grid(True, linestyle="--", which="major", color="gray", alpha=0.6)
|
75 |
+
ax.set_axisbelow(True)
|
76 |
+
|
77 |
+
# ===================
|
78 |
+
# Part 4: Saving Output
|
79 |
+
# ===================
|
80 |
+
# Adjust layout to prevent clipping of ylabel
|
81 |
+
plt.tight_layout()
|
82 |
+
plt.savefig("errorbar_28.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_29.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_29.py
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Updated Urban Transportation Data for three major cities
|
14 |
+
metrics = ["Traffic Volume", "Public Transit", "Accident Rate"]
|
15 |
+
values = np.array(
|
16 |
+
[
|
17 |
+
[220, 180, 220], # New York
|
18 |
+
[150, 120, 130], # Los Angeles
|
19 |
+
[130, 160, 110], # Chicago
|
20 |
+
]
|
21 |
+
)
|
22 |
+
|
23 |
+
# Updated asymmetric error values, now more proportionate to the data scale
|
24 |
+
errors = np.array(
|
25 |
+
[
|
26 |
+
[[25, 20], [15, 15], [25, 20]], # Errors for New York (lower, upper)
|
27 |
+
[[20, 15], [10, 15], [20, 10]], # Errors for Los Angeles
|
28 |
+
[[15, 20], [15, 10], [15, 15]], # Errors for Chicago
|
29 |
+
]
|
30 |
+
)
|
31 |
+
|
32 |
+
# Creating subplots for each city
|
33 |
+
cities = ["New York", "Los Angeles", "Chicago"]
|
34 |
+
|
35 |
+
ylabel = "Metric Values"
|
36 |
+
ylim = [80, 280]
|
37 |
+
|
38 |
+
# ===================
|
39 |
+
# Part 3: Plot Configuration and Rendering
|
40 |
+
# ===================
|
41 |
+
fig, axs = plt.subplots(1, 3, figsize=(10, 4)) # Compact and square figure layout
|
42 |
+
|
43 |
+
|
44 |
+
# Function to plot each city's data
|
45 |
+
def plot_city_data(ax, errors, city_index, city_name):
|
46 |
+
x = np.arange(len(metrics)) # the label locations
|
47 |
+
bar_colors = ["#6a8347", "#377eb8", "#d62728"]
|
48 |
+
barerrors = np.array(errors).T[:, :, city_index]
|
49 |
+
bars = ax.bar(x, values[city_index], yerr=barerrors, color=bar_colors, capsize=5)
|
50 |
+
for bar, lower_error, upper_error in zip(bars, barerrors[0], barerrors[1]):
|
51 |
+
# Position for lower error text
|
52 |
+
ax.text(
|
53 |
+
bar.get_x() + bar.get_width() / 2,
|
54 |
+
bar.get_height() - lower_error - 15,
|
55 |
+
f"-{lower_error}",
|
56 |
+
va="bottom",
|
57 |
+
ha="center",
|
58 |
+
color="black",
|
59 |
+
)
|
60 |
+
# Position for upper error text
|
61 |
+
ax.text(
|
62 |
+
bar.get_x() + bar.get_width() / 2,
|
63 |
+
bar.get_height() + upper_error + 3,
|
64 |
+
f"+{upper_error}",
|
65 |
+
ha="center",
|
66 |
+
color="black",
|
67 |
+
)
|
68 |
+
|
69 |
+
ax.set_title(city_name)
|
70 |
+
ax.set_xticks(x)
|
71 |
+
ax.set_xticklabels(metrics, rotation=90)
|
72 |
+
ax.set_ylabel(ylabel)
|
73 |
+
ax.set_ylim(ylim) # Uniform scale for all charts
|
74 |
+
|
75 |
+
|
76 |
+
for i, city in enumerate(cities):
|
77 |
+
plot_city_data(axs[i], errors, i, city)
|
78 |
+
|
79 |
+
# ===================
|
80 |
+
# Part 4: Saving Output
|
81 |
+
# ===================
|
82 |
+
plt.tight_layout()
|
83 |
+
plt.savefig("errorbar_29.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_4.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_4.py
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Data
|
14 |
+
roles = ["Werewolf", "Seer", "Witch", "Hunter", "Villager"]
|
15 |
+
duration_means = [84.97, 102.67, 67.17, 78.22, 85.17]
|
16 |
+
duration_errors = [15, 20, 10, 15, 10]
|
17 |
+
tokens_means = [449.33, 780.67, 547.39, 612.99, 618.52]
|
18 |
+
tokens_errors = [100, 150, 80, 100, 90]
|
19 |
+
|
20 |
+
ylabel1 = "Duration (s)"
|
21 |
+
xlabel1 = "(a) Speak duration of roles"
|
22 |
+
ylabel2 = "Tokens"
|
23 |
+
xlabel2 = "(b) Speak tokens of roles"
|
24 |
+
|
25 |
+
# ===================
|
26 |
+
# Part 3: Plot Configuration and Rendering
|
27 |
+
# ===================
|
28 |
+
# Create subplots
|
29 |
+
fig, (ax1, ax2) = plt.subplots(
|
30 |
+
1, 2, figsize=(10, 4)
|
31 |
+
) # Adjusted for the given dimensions
|
32 |
+
colors = ["#acd9bb", "#83c3c7", "#5da2c7", "#3a77b0", "#224e8d"]
|
33 |
+
|
34 |
+
# Speak duration of roles
|
35 |
+
ax1.bar(roles, duration_means, yerr=duration_errors, color=colors, capsize=5)
|
36 |
+
ax1.set_ylabel(ylabel1)
|
37 |
+
ax1.set_xlabel(xlabel1)
|
38 |
+
for i, v in enumerate(duration_means):
|
39 |
+
ax1.text(i, v + duration_errors[i] + 2, str(v), ha="center", va="bottom")
|
40 |
+
ax1.spines["top"].set_visible(False)
|
41 |
+
ax1.spines["right"].set_visible(False)
|
42 |
+
ax1.yaxis.grid(True)
|
43 |
+
ax1.set_axisbelow(True)
|
44 |
+
|
45 |
+
# Speak tokens of roles
|
46 |
+
ax2.bar(roles, tokens_means, yerr=tokens_errors, color=colors, capsize=5)
|
47 |
+
ax2.set_ylabel(ylabel2)
|
48 |
+
ax2.set_xlabel(xlabel2)
|
49 |
+
for i, v in enumerate(tokens_means):
|
50 |
+
ax2.text(i, v + tokens_errors[i] + 20, str(v), ha="center", va="bottom")
|
51 |
+
|
52 |
+
ax2.spines["top"].set_visible(False)
|
53 |
+
ax2.spines["right"].set_visible(False)
|
54 |
+
ax2.yaxis.grid(True)
|
55 |
+
ax2.set_axisbelow(True)
|
56 |
+
|
57 |
+
# ===================
|
58 |
+
# Part 4: Saving Output
|
59 |
+
# ===================
|
60 |
+
# Adjust layout and save the figure
|
61 |
+
plt.tight_layout()
|
62 |
+
plt.savefig("errorbar_4.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_5.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_5.py
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
|
6 |
+
# ===================
|
7 |
+
# Part 2: Data Preparation
|
8 |
+
# ===================
|
9 |
+
# Data for plotting
|
10 |
+
sizes = ["5%", "10%", "20%", "30%", "40%", "50%"]
|
11 |
+
samples = [
|
12 |
+
"(40 samples)",
|
13 |
+
"(81 samples)",
|
14 |
+
"(163 samples)",
|
15 |
+
"(245 samples)",
|
16 |
+
"(326 samples)",
|
17 |
+
"(408 samples)",
|
18 |
+
]
|
19 |
+
x = range(len(sizes))
|
20 |
+
y = [63.77, 64.17, 64.31, 64.98, 65.82, 65.78]
|
21 |
+
errors = [1.5, 1.2, 1.3, 1.1, 1.0, 0.8]
|
22 |
+
ylabel = "True+info (%)"
|
23 |
+
xlabel = "Size of Data for Training and Validation"
|
24 |
+
ylim = [56, 67]
|
25 |
+
yticks = [56, 58, 60, 62, 64, 66]
|
26 |
+
|
27 |
+
|
28 |
+
# ===================
|
29 |
+
# Part 3: Plot Configuration and Rendering
|
30 |
+
# ===================
|
31 |
+
# Plotting the bar chart
|
32 |
+
plt.figure(
|
33 |
+
figsize=(10, 7)
|
34 |
+
) # Adjusting figure size to match original image's dimensions
|
35 |
+
bars = plt.bar(x, y, yerr=errors, color="skyblue", capsize=5)
|
36 |
+
|
37 |
+
# Adding data labels on top of the bars
|
38 |
+
for bar in bars:
|
39 |
+
yval = bar.get_height()
|
40 |
+
plt.text(
|
41 |
+
bar.get_x() + bar.get_width() / 2,
|
42 |
+
yval + 0.5,
|
43 |
+
round(yval, 2),
|
44 |
+
ha="right",
|
45 |
+
va="bottom",
|
46 |
+
)
|
47 |
+
|
48 |
+
# Setting the x-axis labels with both percentages and sample sizes
|
49 |
+
plt.xticks(x, [f"{size}\n{sample}" for size, sample in zip(sizes, samples)])
|
50 |
+
|
51 |
+
# Setting the y-axis label
|
52 |
+
plt.ylabel(ylabel)
|
53 |
+
|
54 |
+
# Setting the title of the chart
|
55 |
+
plt.xlabel(xlabel)
|
56 |
+
|
57 |
+
# Adjusting y-axis range
|
58 |
+
plt.ylim(ylim)
|
59 |
+
plt.yticks(yticks)
|
60 |
+
# Adding grid to the background
|
61 |
+
plt.grid(axis="both", alpha=0.7, which="both", color="gray")
|
62 |
+
|
63 |
+
# Making the axis lines visible
|
64 |
+
plt.gca().spines["top"].set_visible(True)
|
65 |
+
plt.gca().spines["right"].set_visible(True)
|
66 |
+
plt.gca().spines["bottom"].set_visible(True)
|
67 |
+
plt.gca().spines["left"].set_visible(True)
|
68 |
+
|
69 |
+
# ===================
|
70 |
+
# Part 4: Saving Output
|
71 |
+
# ===================
|
72 |
+
# Displaying the plot with tight layout to minimize white space
|
73 |
+
plt.tight_layout()
|
74 |
+
plt.savefig("errorbar_5.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_6.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_6.py
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Data for the left plot (Out-of-domain accuracy)
|
14 |
+
left_categories = [
|
15 |
+
"all",
|
16 |
+
"arg_causal",
|
17 |
+
"test_0",
|
18 |
+
"test_1",
|
19 |
+
"test_2",
|
20 |
+
"test_3",
|
21 |
+
"test_4",
|
22 |
+
"test_5",
|
23 |
+
"test_6",
|
24 |
+
"constant",
|
25 |
+
]
|
26 |
+
left_means = [0.832, 0.828, 0.830, 0.829, 0.830, 0.829, 0.828, 0.827, 0.826, 0.826]
|
27 |
+
left_errors = [0.002] * 10
|
28 |
+
|
29 |
+
# Data for the right plot (Shift gap)
|
30 |
+
right_categories = [
|
31 |
+
"all",
|
32 |
+
"arg_causal",
|
33 |
+
"test_0",
|
34 |
+
"test_1",
|
35 |
+
"test_2",
|
36 |
+
"test_3",
|
37 |
+
"test_4",
|
38 |
+
"test_5",
|
39 |
+
"test_6",
|
40 |
+
"constant",
|
41 |
+
]
|
42 |
+
right_means = [0.040, 0.035, 0.036, 0.036, 0.036, 0.036, 0.036, 0.036, 0.036, 0.035]
|
43 |
+
right_errors = [0.005] * 10
|
44 |
+
|
45 |
+
title1 = "Out-of-domain accuracy"
|
46 |
+
ylim1 = [0.824, 0.835]
|
47 |
+
yticks1 = np.arange(0.824, 0.835, 0.002)
|
48 |
+
title2 = "Shift gap"
|
49 |
+
ylim2 = [0, 0.050]
|
50 |
+
suptitle = "Diabetes"
|
51 |
+
|
52 |
+
|
53 |
+
# ===================
|
54 |
+
# Part 3: Plot Configuration and Rendering
|
55 |
+
# ===================
|
56 |
+
# Create subplots
|
57 |
+
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5))
|
58 |
+
|
59 |
+
# Left plot
|
60 |
+
ax1.bar(
|
61 |
+
left_categories,
|
62 |
+
left_means,
|
63 |
+
yerr=left_errors,
|
64 |
+
color=["#c53a32"] + ["#9ab6bd"] + ["#678c95"] * 7 + ["#454545"],
|
65 |
+
capsize=5,
|
66 |
+
error_kw=dict(ecolor="black", lw=1, capsize=5, capthick=2),
|
67 |
+
)
|
68 |
+
ax1.set_title(title1)
|
69 |
+
ax1.set_ylim(ylim1)
|
70 |
+
ax1.set_yticks(yticks1)
|
71 |
+
ax1.set_xticklabels(left_categories, rotation=90, ha="center")
|
72 |
+
ax1.tick_params(axis="both", length=0) # Hide tick marks
|
73 |
+
ax1.grid(True)
|
74 |
+
ax1.set_axisbelow(True)
|
75 |
+
for spine in ax1.spines.values():
|
76 |
+
spine.set_color("gray")
|
77 |
+
|
78 |
+
# Right plot
|
79 |
+
ax2.bar(
|
80 |
+
right_categories,
|
81 |
+
right_means,
|
82 |
+
yerr=right_errors,
|
83 |
+
color=["#c53a32"] + ["#9ab6bd"] + ["#678c95"] * 7 + ["#454545"],
|
84 |
+
capsize=5,
|
85 |
+
error_kw=dict(ecolor="black", lw=1, capsize=5, capthick=2),
|
86 |
+
)
|
87 |
+
ax2.set_title(title2)
|
88 |
+
ax2.set_ylim(ylim2)
|
89 |
+
ax2.set_xticklabels(right_categories, rotation=90, ha="center")
|
90 |
+
ax2.tick_params(axis="both", length=0) # Hide tick marks
|
91 |
+
ax2.grid(True)
|
92 |
+
ax2.set_axisbelow(True)
|
93 |
+
|
94 |
+
# Set the title for the entire figure
|
95 |
+
fig.suptitle(suptitle)
|
96 |
+
|
97 |
+
for spine in ax2.spines.values():
|
98 |
+
spine.set_color("gray")
|
99 |
+
|
100 |
+
# ===================
|
101 |
+
# Part 4: Saving Output
|
102 |
+
# ===================
|
103 |
+
# Adjust layout and save the figure
|
104 |
+
plt.tight_layout()
|
105 |
+
plt.savefig("errorbar_6.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_7.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_7.py
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
|
6 |
+
# ===================
|
7 |
+
# Part 2: Data Preparation
|
8 |
+
# ===================
|
9 |
+
# Data for plotting
|
10 |
+
categories = [
|
11 |
+
"Best-of-Three",
|
12 |
+
"Initial Distribution",
|
13 |
+
"0.125 Parameter-Valued\nDistribution",
|
14 |
+
"Final Distribution with\nGPT-3.5-Turbo",
|
15 |
+
"Final Distribution with\nGPT-4-Turbo",
|
16 |
+
]
|
17 |
+
values = [0.15, 0.35, 0.55, 0.65, 0.8]
|
18 |
+
errors = [0.05, 0.05, 0.05, 0.05, 0.05]
|
19 |
+
xlabel = "Objective Value"
|
20 |
+
title = "Mini Crosswords Performance"
|
21 |
+
label = "ToT (0.675)"
|
22 |
+
xvline = 0.675
|
23 |
+
|
24 |
+
|
25 |
+
# ===================
|
26 |
+
# Part 3: Plot Configuration and Rendering
|
27 |
+
# ===================
|
28 |
+
# Plotting the bar chart
|
29 |
+
plt.figure(
|
30 |
+
figsize=(10, 6)
|
31 |
+
) # Adjusting figure size to match the original image's dimensions
|
32 |
+
plt.barh(categories, values, xerr=errors, color="skyblue", capsize=5)
|
33 |
+
plt.xlabel(xlabel)
|
34 |
+
plt.title(title)
|
35 |
+
plt.gca().tick_params(axis="both", length=0) # Hide tick marks
|
36 |
+
|
37 |
+
# Adding the vertical line
|
38 |
+
plt.axvline(x=xvline, color="red", linestyle="--", label=label)
|
39 |
+
plt.gca().grid("both", color="gray", alpha=0.7)
|
40 |
+
|
41 |
+
# Adding the legend
|
42 |
+
plt.legend()
|
43 |
+
|
44 |
+
for spine in plt.gca().spines.values():
|
45 |
+
spine.set_color("gray")
|
46 |
+
|
47 |
+
# ===================
|
48 |
+
# Part 4: Saving Output
|
49 |
+
# ===================
|
50 |
+
# Adjusting the layout and saving the figure
|
51 |
+
plt.tight_layout()
|
52 |
+
plt.savefig("errorbar_7.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_8.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_8.py
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Data (estimated from the image)
|
14 |
+
models = [
|
15 |
+
"BERT",
|
16 |
+
"RoBERTa",
|
17 |
+
"DistilBERT",
|
18 |
+
"XLNet",
|
19 |
+
"Electra",
|
20 |
+
"Albert",
|
21 |
+
"BART",
|
22 |
+
"DeBERTa",
|
23 |
+
"Llama2",
|
24 |
+
]
|
25 |
+
ground_truth_accuracy = [50, 55, 60, 65, 40, 30, 70, 45, 35]
|
26 |
+
weak_labels_accuracy = [45, 50, 55, 60, 35, 25, 65, 40, 30]
|
27 |
+
error = [10, 8, 12, 10, 5, 7, 8, 10, 5]
|
28 |
+
labels = ["Ground-truth labels", "Weak labels"]
|
29 |
+
ylabel = "Accuracy (%)"
|
30 |
+
ylim = [0, 80]
|
31 |
+
yticks = np.arange(0, 71, 10)
|
32 |
+
|
33 |
+
|
34 |
+
# ===================
|
35 |
+
# Part 3: Plot Configuration and Rendering
|
36 |
+
# ===================
|
37 |
+
fig = plt.subplots(figsize=(10, 3))
|
38 |
+
# Bar width
|
39 |
+
bar_width = 0.35
|
40 |
+
|
41 |
+
# X position of bars
|
42 |
+
r1 = np.arange(len(ground_truth_accuracy))
|
43 |
+
r2 = [x + bar_width for x in r1]
|
44 |
+
|
45 |
+
# Create bars
|
46 |
+
plt.bar(
|
47 |
+
r1,
|
48 |
+
ground_truth_accuracy,
|
49 |
+
color="#d47e6d",
|
50 |
+
width=bar_width,
|
51 |
+
label=labels[0],
|
52 |
+
yerr=error,
|
53 |
+
capsize=7,
|
54 |
+
)
|
55 |
+
plt.bar(
|
56 |
+
r2,
|
57 |
+
weak_labels_accuracy,
|
58 |
+
color="#76a4c5",
|
59 |
+
width=bar_width,
|
60 |
+
label=labels[1],
|
61 |
+
yerr=error,
|
62 |
+
capsize=7,
|
63 |
+
)
|
64 |
+
|
65 |
+
# Add xticks on the middle of the group bars
|
66 |
+
plt.xticks([r + bar_width / 2 for r in range(len(ground_truth_accuracy))], models)
|
67 |
+
|
68 |
+
# Create legend & Show graphic
|
69 |
+
plt.ylabel(ylabel)
|
70 |
+
plt.legend(frameon=False, loc="upper right") # Remove legend background
|
71 |
+
|
72 |
+
# Set background color and grid
|
73 |
+
plt.gca().set_facecolor("#e5e5e5")
|
74 |
+
plt.grid(color="white", linestyle="-", linewidth=0.25, axis="both")
|
75 |
+
plt.gca().set_axisbelow(True)
|
76 |
+
|
77 |
+
# Set y-axis limits
|
78 |
+
plt.ylim(ylim)
|
79 |
+
plt.yticks(yticks)
|
80 |
+
|
81 |
+
for spine in plt.gca().spines.values():
|
82 |
+
spine.set_visible(False)
|
83 |
+
|
84 |
+
# ===================
|
85 |
+
# Part 4: Saving Output
|
86 |
+
# ===================
|
87 |
+
plt.tight_layout()
|
88 |
+
plt.savefig("errorbar_8.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorbar_9.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorbar_9.py
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
|
6 |
+
# ===================
|
7 |
+
# Part 2: Data Preparation
|
8 |
+
# ===================
|
9 |
+
# Categories and values (estimated from the image)
|
10 |
+
categories = [
|
11 |
+
"Syntax: Tagging, Chunking and Parsing",
|
12 |
+
"Discourse and Pragmatics",
|
13 |
+
"Information Extraction",
|
14 |
+
"Machine Learning for NLP",
|
15 |
+
"Information Retrieval and Text Mining",
|
16 |
+
"Phonology, Morphology and Word Segmentation",
|
17 |
+
"Computational Social Science and Social Media",
|
18 |
+
][::-1]
|
19 |
+
values = [-3.20, -3.1, -3.00, -2.90, -2.80, -2.70, -2.60][::-1]
|
20 |
+
error = [0.1, 0.15, 0.3, 0.25, 0.2, 0.1, 0.05]
|
21 |
+
xlabel = "A"
|
22 |
+
ylabel = "Categories"
|
23 |
+
title = "Your Chart Title Here"
|
24 |
+
xlim = [-3.5, -1.5]
|
25 |
+
# ===================
|
26 |
+
# Part 3: Plot Configuration and Rendering
|
27 |
+
# ===================
|
28 |
+
# Create horizontal bar chart
|
29 |
+
fig, ax = plt.subplots(figsize=(8, 8)) # Adjust figure size
|
30 |
+
bars = ax.barh(
|
31 |
+
categories,
|
32 |
+
values,
|
33 |
+
color="#c5b3d6",
|
34 |
+
edgecolor="white",
|
35 |
+
height=0.5,
|
36 |
+
xerr=error,
|
37 |
+
capsize=0,
|
38 |
+
)
|
39 |
+
|
40 |
+
# Set labels and title (if any)
|
41 |
+
ax.set_xlabel(xlabel)
|
42 |
+
ax.set_ylabel(ylabel)
|
43 |
+
ax.set_title(title)
|
44 |
+
|
45 |
+
# Invert y-axis to match the image
|
46 |
+
ax.invert_yaxis()
|
47 |
+
|
48 |
+
# Set x-axis range to match the reference image
|
49 |
+
ax.set_xlim(xlim)
|
50 |
+
|
51 |
+
# Remove grid lines
|
52 |
+
ax.xaxis.grid(False)
|
53 |
+
ax.spines["top"].set_visible(False)
|
54 |
+
ax.spines["right"].set_visible(False)
|
55 |
+
|
56 |
+
# Set background color to white
|
57 |
+
ax.set_facecolor("white")
|
58 |
+
|
59 |
+
# ===================
|
60 |
+
# Part 4: Saving Output
|
61 |
+
# ===================
|
62 |
+
# Displaying the plot with tight layout to minimize white space
|
63 |
+
plt.tight_layout()
|
64 |
+
plt.savefig("errorbar_9.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorpoint_1.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorpoint_1.py
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Sample data (replace with actual data)
|
14 |
+
categories = [
|
15 |
+
"Kashmir",
|
16 |
+
"Religion",
|
17 |
+
"Crime and Justice",
|
18 |
+
"CAA",
|
19 |
+
"Pulwama-Balakot",
|
20 |
+
"Politics",
|
21 |
+
]
|
22 |
+
means = np.random.uniform(0.05, 0.15, len(categories))
|
23 |
+
std_devs = np.random.uniform(0.01, 0.05, len(categories))
|
24 |
+
dataset_mean = np.mean(means)
|
25 |
+
|
26 |
+
# Labels and Plot Types
|
27 |
+
label_Mean = "Mean"
|
28 |
+
label_Dataset_mean = "Dataset mean"
|
29 |
+
|
30 |
+
# Axes Limits and Labels
|
31 |
+
ylabel_value = "Shouting Fraction (Fraction of videos)"
|
32 |
+
ylim_values = [0.01, 0.18]
|
33 |
+
|
34 |
+
# ===================
|
35 |
+
# Part 3: Plot Configuration and Rendering
|
36 |
+
# ===================
|
37 |
+
# Create figure and axis
|
38 |
+
fig, ax = plt.subplots(figsize=(8, 5))
|
39 |
+
|
40 |
+
# Error bar plot
|
41 |
+
ax.errorbar(
|
42 |
+
categories,
|
43 |
+
means,
|
44 |
+
yerr=std_devs,
|
45 |
+
fmt="o",
|
46 |
+
color="blue",
|
47 |
+
ecolor="blue",
|
48 |
+
capsize=5,
|
49 |
+
label=label_Mean,
|
50 |
+
)
|
51 |
+
|
52 |
+
# Dataset mean line
|
53 |
+
ax.axhline(y=dataset_mean, color="grey", linestyle="--", label=label_Dataset_mean)
|
54 |
+
|
55 |
+
# Customizing the plot
|
56 |
+
ax.set_ylabel(ylabel_value)
|
57 |
+
ax.set_xticklabels(categories, rotation=45, ha="right")
|
58 |
+
ax.legend()
|
59 |
+
ax.set_ylim(ylim_values)
|
60 |
+
|
61 |
+
# ===================
|
62 |
+
# Part 4: Saving Output
|
63 |
+
# ===================
|
64 |
+
# Adjust layout to prevent clipping of tick-labels
|
65 |
+
plt.tight_layout()
|
66 |
+
plt.savefig("errorpoint_1.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorpoint_2.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorpoint_2.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
|
6 |
+
# ===================
|
7 |
+
# Part 2: Data Preparation
|
8 |
+
# ===================
|
9 |
+
# Data for plotting
|
10 |
+
categories = ["Pulwama-Balakot", "CAA", "Kashmir", "Religion", "Politics"]
|
11 |
+
means = [0.24, 0.22, 0.20, 0.19, 0.18]
|
12 |
+
errors = [0.04, 0.03, 0.02, 0.02, 0.02]
|
13 |
+
dataset_mean = [0.162]
|
14 |
+
xlabel = "Incivility (Fraction of Videos)"
|
15 |
+
label = "Dataset mean"
|
16 |
+
|
17 |
+
# ===================
|
18 |
+
# Part 3: Plot Configuration and Rendering
|
19 |
+
# ===================
|
20 |
+
# Plotting the data
|
21 |
+
plt.figure(figsize=(8, 6)) # Adjusting figure size to match original image's dimensions
|
22 |
+
plt.errorbar(
|
23 |
+
means,
|
24 |
+
categories,
|
25 |
+
xerr=errors,
|
26 |
+
fmt="o",
|
27 |
+
color="#bc4949",
|
28 |
+
ecolor="#bc4949",
|
29 |
+
capsize=0,
|
30 |
+
label="Mean",
|
31 |
+
)
|
32 |
+
plt.axvline(dataset_mean, linestyle="--", label=label)
|
33 |
+
|
34 |
+
# Customizing the plot
|
35 |
+
plt.xlabel(xlabel)
|
36 |
+
plt.legend()
|
37 |
+
|
38 |
+
# ===================
|
39 |
+
# Part 4: Saving Output
|
40 |
+
# ===================
|
41 |
+
# Adjusting the layout and saving the figure
|
42 |
+
plt.tight_layout()
|
43 |
+
plt.savefig("errorpoint_2.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorpoint_4.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorpoint_4.py
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
|
6 |
+
# ===================
|
7 |
+
# Part 2: Data Preparation
|
8 |
+
# ===================
|
9 |
+
# Data (example values, replace with actual data)
|
10 |
+
categories = [
|
11 |
+
"Education",
|
12 |
+
"Religion",
|
13 |
+
"Bollywood",
|
14 |
+
"Crime and Justice",
|
15 |
+
"Farmers Protest",
|
16 |
+
"Issue Politics",
|
17 |
+
]
|
18 |
+
unique_speaker_mean = [10, 12, 11, 13, 14, 15] # Replace with actual mean values
|
19 |
+
unique_shouter_mean = [5, 6, 7, 6, 5, 4] # Replace with actual mean values
|
20 |
+
unique_speaker_error = [1, 1.5, 1, 1.5, 2, 1.5] # Replace with actual error values
|
21 |
+
unique_shouter_error = [
|
22 |
+
0.5,
|
23 |
+
0.75,
|
24 |
+
0.5,
|
25 |
+
0.75,
|
26 |
+
1,
|
27 |
+
0.75,
|
28 |
+
] # Replace with actual error values
|
29 |
+
labels = ["Unique speaker count mean", "Unique shouter count mean"]
|
30 |
+
ylabel = "Number of speakers"
|
31 |
+
axlabel = "Dataset unique shouter count mean"
|
32 |
+
# ===================
|
33 |
+
# Part 3: Plot Configuration and Rendering
|
34 |
+
# ===================
|
35 |
+
# Plotting
|
36 |
+
fig, ax = plt.subplots(
|
37 |
+
figsize=(10, 6)
|
38 |
+
) # Adjust the size to match the original image's dimensions
|
39 |
+
ax.errorbar(
|
40 |
+
categories,
|
41 |
+
unique_speaker_mean,
|
42 |
+
yerr=unique_speaker_error,
|
43 |
+
fmt="o",
|
44 |
+
color="blue",
|
45 |
+
label=labels[0],
|
46 |
+
)
|
47 |
+
ax.errorbar(
|
48 |
+
categories,
|
49 |
+
unique_shouter_mean,
|
50 |
+
yerr=unique_shouter_error,
|
51 |
+
fmt="o",
|
52 |
+
color="red",
|
53 |
+
label=labels[1],
|
54 |
+
)
|
55 |
+
|
56 |
+
# Customization
|
57 |
+
ax.set_ylabel(ylabel)
|
58 |
+
ax.set_xticklabels(categories, rotation=45, ha="right")
|
59 |
+
ax.axhline(
|
60 |
+
y=sum(unique_shouter_mean) / len(unique_shouter_mean),
|
61 |
+
color="grey",
|
62 |
+
linestyle="--",
|
63 |
+
label=axlabel,
|
64 |
+
)
|
65 |
+
ax.legend()
|
66 |
+
|
67 |
+
# ===================
|
68 |
+
# Part 4: Saving Output
|
69 |
+
# ===================
|
70 |
+
# Show plot
|
71 |
+
plt.tight_layout()
|
72 |
+
plt.savefig("errorpoint_4.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorpoint_5.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorpoint_5.py
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
|
6 |
+
# ===================
|
7 |
+
# Part 2: Data Preparation
|
8 |
+
# ===================
|
9 |
+
# Data for plotting
|
10 |
+
categories = [
|
11 |
+
"KASHMIR",
|
12 |
+
"COVID/LOCKDOWN",
|
13 |
+
"SPORTS",
|
14 |
+
"CHINA",
|
15 |
+
"PULWAMA-BALAKOT",
|
16 |
+
] # Capitalized category labels
|
17 |
+
means = [0.22, 0.23, 0.18, 0.12, 0.05]
|
18 |
+
errors = [0.03, 0.02, 0.05, 0.06, 0.02]
|
19 |
+
downerrors = [0.01, 0.02, 0.03, 0.04, 0.05]
|
20 |
+
legendtitles = ["Dataset mean", "Mean"]
|
21 |
+
texttitle = "Dataset mean"
|
22 |
+
ylabel = "Female Face presence (Fraction of videos)"
|
23 |
+
|
24 |
+
# ===================
|
25 |
+
# Part 3: Plot Configuration and Rendering
|
26 |
+
# ===================
|
27 |
+
# Plotting the data
|
28 |
+
fig, ax = plt.subplots(
|
29 |
+
figsize=(8, 6)
|
30 |
+
) # Adjusting figure size to match original image dimensions
|
31 |
+
ax.errorbar(
|
32 |
+
categories,
|
33 |
+
means,
|
34 |
+
yerr=[errors, downerrors],
|
35 |
+
fmt="o",
|
36 |
+
color="blue",
|
37 |
+
ecolor="blue",
|
38 |
+
capsize=5,
|
39 |
+
)
|
40 |
+
|
41 |
+
# Adding a legend with both "Mean" and "Dataset mean"
|
42 |
+
dataset_mean = 0.253
|
43 |
+
mean_line = ax.errorbar(
|
44 |
+
[], [], yerr=[], fmt="o", color="blue", ecolor="blue", capsize=5
|
45 |
+
)
|
46 |
+
dataset_mean_line = ax.axhline(
|
47 |
+
y=dataset_mean, color="gray", linestyle="--", linewidth=1
|
48 |
+
)
|
49 |
+
ax.legend(
|
50 |
+
[dataset_mean_line, mean_line],
|
51 |
+
legendtitles,
|
52 |
+
loc="upper right",
|
53 |
+
fancybox=True,
|
54 |
+
framealpha=1,
|
55 |
+
shadow=True,
|
56 |
+
borderpad=1,
|
57 |
+
)
|
58 |
+
# Adding a horizontal line for dataset mean and text annotation with a white background
|
59 |
+
ax.text(
|
60 |
+
0.95,
|
61 |
+
dataset_mean,
|
62 |
+
texttitle,
|
63 |
+
va="center",
|
64 |
+
ha="right",
|
65 |
+
backgroundcolor="white",
|
66 |
+
transform=ax.get_yaxis_transform(),
|
67 |
+
)
|
68 |
+
# Setting labels
|
69 |
+
ax.set_ylabel(ylabel)
|
70 |
+
ax.set_title("")
|
71 |
+
plt.xticks(rotation=30)
|
72 |
+
|
73 |
+
# ===================
|
74 |
+
# Part 4: Saving Output
|
75 |
+
# ===================
|
76 |
+
plt.tight_layout()
|
77 |
+
plt.savefig("errorpoint_5.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/errorpoint_6.png
ADDED
![]() |
ChartMimic/dataset/ori_500/errorpoint_6.py
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
np.random.seed(0)
|
8 |
+
|
9 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# example data
|
14 |
+
x = np.array([0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0])
|
15 |
+
y = np.exp(-x)
|
16 |
+
xerr = 0.2
|
17 |
+
yerr = 0.15
|
18 |
+
|
19 |
+
# lower & upper limits of the error
|
20 |
+
lolims = np.array([0.3, 0, 0.4, 0, 0, 1, 0, 0, 1.2, 0], dtype=bool)
|
21 |
+
uplims = np.array([0.5, 0, 0, 0.1, 0, 0.5, 0, 0.3, 0, 0], dtype=bool)
|
22 |
+
ls = "None"
|
23 |
+
labels = [
|
24 |
+
"standard",
|
25 |
+
"upper limits",
|
26 |
+
"lower limits",
|
27 |
+
"upper and lower limits",
|
28 |
+
"random",
|
29 |
+
]
|
30 |
+
title = "Errorbar upper and lower limits"
|
31 |
+
xlim = [0, 5.5]
|
32 |
+
colors =[ "#b2e7aa", "#fae18f", "#d75949", "#f0906d", "#a1a8d6"]
|
33 |
+
# ===================
|
34 |
+
# Part 3: Plot Configuration and Rendering
|
35 |
+
# ===================
|
36 |
+
fig, ax = plt.subplots(figsize=(9, 6))
|
37 |
+
|
38 |
+
# standard error bars
|
39 |
+
ax.errorbar(x, y, xerr=xerr, yerr=yerr, label=labels[0], linestyle=ls, color=colors[0])
|
40 |
+
# including upper limits
|
41 |
+
ax.errorbar(
|
42 |
+
x, y + 1, xerr=xerr, yerr=yerr, uplims=uplims, label=labels[1], linestyle=ls, color=colors[1]
|
43 |
+
)
|
44 |
+
|
45 |
+
# including lower limits
|
46 |
+
ax.errorbar(
|
47 |
+
x, y + 0.25, xerr=xerr, yerr=yerr, lolims=lolims, label=labels[2], linestyle=ls, color=colors[2]
|
48 |
+
)
|
49 |
+
|
50 |
+
# including upper and lower limits
|
51 |
+
ax.errorbar(
|
52 |
+
x,
|
53 |
+
y + 1.25,
|
54 |
+
xerr=xerr,
|
55 |
+
yerr=yerr,
|
56 |
+
lolims=lolims,
|
57 |
+
uplims=uplims,
|
58 |
+
marker="o",
|
59 |
+
markersize=8,
|
60 |
+
label=labels[3],
|
61 |
+
linestyle=ls,
|
62 |
+
color=colors[3],
|
63 |
+
)
|
64 |
+
|
65 |
+
# Plot a series with lower and upper limits in both x & y
|
66 |
+
# constant x-error with varying y-error
|
67 |
+
xerr = 0.2
|
68 |
+
yerr = np.full_like(x, 0.2)
|
69 |
+
yerr[[3, 6]] = 0.3
|
70 |
+
|
71 |
+
# mock up some limits by modifying previous data
|
72 |
+
xlolims = lolims
|
73 |
+
xuplims = uplims
|
74 |
+
lolims = np.zeros_like(x)
|
75 |
+
uplims = np.zeros_like(x)
|
76 |
+
lolims[[6]] = True # only limited at this index
|
77 |
+
uplims[[3]] = True # only limited at this index
|
78 |
+
|
79 |
+
# do the plotting
|
80 |
+
ax.errorbar(
|
81 |
+
x,
|
82 |
+
y + 2.1,
|
83 |
+
xerr=xerr,
|
84 |
+
yerr=yerr,
|
85 |
+
xlolims=xlolims,
|
86 |
+
xuplims=xuplims,
|
87 |
+
uplims=uplims,
|
88 |
+
lolims=lolims,
|
89 |
+
marker="o",
|
90 |
+
markersize=8,
|
91 |
+
linestyle="none",
|
92 |
+
label=labels[4],
|
93 |
+
color=colors[4],
|
94 |
+
)
|
95 |
+
|
96 |
+
# tidy up the figure
|
97 |
+
ax.set_xlim(xlim)
|
98 |
+
ax.set_title(title)
|
99 |
+
plt.legend(bbox_to_anchor=(0.5, 1.15), ncol=5, loc="upper center")
|
100 |
+
|
101 |
+
# ===================
|
102 |
+
# Part 4: Saving Output
|
103 |
+
# ===================
|
104 |
+
plt.tight_layout()
|
105 |
+
plt.savefig("errorpoint_6.pdf", bbox_inches="tight")
|