Spaces:
Sleeping
Sleeping
Upload 82 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- ChartMimic/dataset/ori_500/HR_13.png +0 -0
- ChartMimic/dataset/ori_500/HR_13.py +36 -0
- ChartMimic/dataset/ori_500/hist_10.png +0 -0
- ChartMimic/dataset/ori_500/hist_10.py +97 -0
- ChartMimic/dataset/ori_500/hist_11.png +0 -0
- ChartMimic/dataset/ori_500/hist_11.py +69 -0
- ChartMimic/dataset/ori_500/hist_12.png +0 -0
- ChartMimic/dataset/ori_500/hist_12.py +64 -0
- ChartMimic/dataset/ori_500/hist_13.png +0 -0
- ChartMimic/dataset/ori_500/hist_13.py +103 -0
- ChartMimic/dataset/ori_500/hist_15.png +0 -0
- ChartMimic/dataset/ori_500/hist_15.py +57 -0
- ChartMimic/dataset/ori_500/hist_16.png +0 -0
- ChartMimic/dataset/ori_500/hist_16.py +61 -0
- ChartMimic/dataset/ori_500/hist_3.png +0 -0
- ChartMimic/dataset/ori_500/hist_3.py +89 -0
- ChartMimic/dataset/ori_500/hist_4.png +0 -0
- ChartMimic/dataset/ori_500/hist_4.py +91 -0
- ChartMimic/dataset/ori_500/hist_5.png +0 -0
- ChartMimic/dataset/ori_500/hist_5.py +53 -0
- ChartMimic/dataset/ori_500/hist_6.png +0 -0
- ChartMimic/dataset/ori_500/hist_6.py +48 -0
- ChartMimic/dataset/ori_500/hist_7.png +0 -0
- ChartMimic/dataset/ori_500/hist_7.py +55 -0
- ChartMimic/dataset/ori_500/hist_8.png +0 -0
- ChartMimic/dataset/ori_500/hist_8.py +42 -0
- ChartMimic/dataset/ori_500/hist_9.png +0 -0
- ChartMimic/dataset/ori_500/hist_9.py +39 -0
- ChartMimic/dataset/ori_500/line_1.png +0 -0
- ChartMimic/dataset/ori_500/line_1.py +88 -0
- ChartMimic/dataset/ori_500/line_10.png +0 -0
- ChartMimic/dataset/ori_500/line_10.py +59 -0
- ChartMimic/dataset/ori_500/line_11.png +0 -0
- ChartMimic/dataset/ori_500/line_11.py +71 -0
- ChartMimic/dataset/ori_500/line_12.png +0 -0
- ChartMimic/dataset/ori_500/line_12.py +103 -0
- ChartMimic/dataset/ori_500/line_13.png +0 -0
- ChartMimic/dataset/ori_500/line_13.py +113 -0
- ChartMimic/dataset/ori_500/line_15.png +0 -0
- ChartMimic/dataset/ori_500/line_15.py +111 -0
- ChartMimic/dataset/ori_500/line_16.png +0 -0
- ChartMimic/dataset/ori_500/line_16.py +67 -0
- ChartMimic/dataset/ori_500/line_17.png +0 -0
- ChartMimic/dataset/ori_500/line_17.py +74 -0
- ChartMimic/dataset/ori_500/line_18.png +0 -0
- ChartMimic/dataset/ori_500/line_18.py +105 -0
- ChartMimic/dataset/ori_500/line_19.png +0 -0
- ChartMimic/dataset/ori_500/line_19.py +64 -0
- ChartMimic/dataset/ori_500/line_2.png +0 -0
- ChartMimic/dataset/ori_500/line_2.py +82 -0
ChartMimic/dataset/ori_500/HR_13.png
ADDED
![]() |
ChartMimic/dataset/ori_500/HR_13.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
from matplotlib_venn import venn2
|
6 |
+
|
7 |
+
# ===================
|
8 |
+
# Part 2: Data Preparation
|
9 |
+
# ===================
|
10 |
+
# Set the figure size to match the original image's dimensions
|
11 |
+
plt.figure(figsize=(8, 6))
|
12 |
+
|
13 |
+
# Create a Venn diagram
|
14 |
+
venn = venn2(subsets=(24, 8, 45), set_labels=("CigaR", "ChatRepair"))
|
15 |
+
|
16 |
+
# ===================
|
17 |
+
# Part 3: Plot Configuration and Rendering
|
18 |
+
# ===================
|
19 |
+
# Customize the colors and edge styles
|
20 |
+
venn.get_patch_by_id("10").set_color("pink")
|
21 |
+
venn.get_patch_by_id("10").set_edgecolor("black")
|
22 |
+
venn.get_patch_by_id("10").set_linestyle("dashed")
|
23 |
+
venn.get_patch_by_id("01").set_color("lightgreen")
|
24 |
+
venn.get_patch_by_id("01").set_edgecolor("black")
|
25 |
+
venn.get_patch_by_id("01").set_linestyle("dashed")
|
26 |
+
venn.get_patch_by_id("11").set_color("sandybrown")
|
27 |
+
|
28 |
+
# Remove axis
|
29 |
+
plt.axis("off")
|
30 |
+
|
31 |
+
# ===================
|
32 |
+
# Part 4: Saving Output
|
33 |
+
# ===================
|
34 |
+
# Displaying the plot with tight layout to minimize white space
|
35 |
+
plt.tight_layout()
|
36 |
+
plt.savefig("HR_13.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_10.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_10.py
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
intra_class_left = np.random.normal(0.1, 0.1, 1000)
|
15 |
+
inter_class_left = np.random.normal(0.3, 0.2, 1000)
|
16 |
+
intra_class_right = np.random.normal(0.0, 0.1, 1000)
|
17 |
+
inter_class_right = np.random.normal(0.2, 0.2, 1000)
|
18 |
+
xlabel = "Cosine Similarity"
|
19 |
+
ylabel = "Frequency"
|
20 |
+
binslist = [30, 30, 30, 30]
|
21 |
+
labels = ["Inter Class", "Intra Class"]
|
22 |
+
|
23 |
+
# ===================
|
24 |
+
# Part 3: Plot Configuration and Rendering
|
25 |
+
# ===================
|
26 |
+
# Set the figure size to match the original image's dimensions
|
27 |
+
plt.figure(figsize=(10, 3))
|
28 |
+
|
29 |
+
# Left subplot
|
30 |
+
ax_left = plt.subplot(1, 2, 1)
|
31 |
+
plt.hist(
|
32 |
+
inter_class_left,
|
33 |
+
bins=binslist[0],
|
34 |
+
alpha=0.5,
|
35 |
+
label=labels[0],
|
36 |
+
color="#4498c8",
|
37 |
+
zorder=2,
|
38 |
+
)
|
39 |
+
plt.hist(
|
40 |
+
intra_class_left,
|
41 |
+
bins=binslist[1],
|
42 |
+
alpha=0.5,
|
43 |
+
label=labels[1],
|
44 |
+
color="#5ac4a2",
|
45 |
+
zorder=3,
|
46 |
+
)
|
47 |
+
leg = plt.legend(
|
48 |
+
frameon=False
|
49 |
+
) # Make legend background transparent and remove the border
|
50 |
+
plt.xlabel(xlabel)
|
51 |
+
plt.ylabel(ylabel)
|
52 |
+
plt.tick_params(axis="both", which="both", length=0)
|
53 |
+
plt.gca().set_facecolor("#eaeaf1")
|
54 |
+
plt.grid(True, color="white", zorder=0)
|
55 |
+
for spine in plt.gca().spines.values():
|
56 |
+
spine.set_visible(False)
|
57 |
+
|
58 |
+
# Right subplot
|
59 |
+
ax_right = plt.subplot(1, 2, 2)
|
60 |
+
plt.hist(
|
61 |
+
inter_class_right,
|
62 |
+
bins=binslist[2],
|
63 |
+
alpha=0.5,
|
64 |
+
label=labels[0],
|
65 |
+
color="#4498c8",
|
66 |
+
zorder=2,
|
67 |
+
)
|
68 |
+
plt.hist(
|
69 |
+
intra_class_right,
|
70 |
+
bins=binslist[3],
|
71 |
+
alpha=0.5,
|
72 |
+
label=labels[1],
|
73 |
+
color="#5ac4a2",
|
74 |
+
zorder=3,
|
75 |
+
)
|
76 |
+
leg = plt.legend(frameon=False)
|
77 |
+
plt.xlabel(xlabel)
|
78 |
+
plt.ylabel(ylabel)
|
79 |
+
plt.tick_params(axis="both", which="both", length=0)
|
80 |
+
plt.gca().set_facecolor("#eaeaf1")
|
81 |
+
plt.grid(True, color="white", zorder=0)
|
82 |
+
for spine in plt.gca().spines.values():
|
83 |
+
spine.set_visible(False)
|
84 |
+
|
85 |
+
# Set axis spine colors to black
|
86 |
+
for ax in [ax_left, ax_right]:
|
87 |
+
for spine in ax.spines.values():
|
88 |
+
spine.set_edgecolor("black")
|
89 |
+
|
90 |
+
# ===================
|
91 |
+
# Part 4: Saving Output
|
92 |
+
# ===================
|
93 |
+
# Adjust layout to prevent overlap
|
94 |
+
plt.tight_layout()
|
95 |
+
|
96 |
+
# Display the figure
|
97 |
+
plt.savefig("hist_10.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_11.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_11.py
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
# Generate random data for demonstration
|
14 |
+
data1 = np.random.normal(1, 0.3, 500)
|
15 |
+
data2 = np.random.normal(1.5, 0.3, 1000)
|
16 |
+
labels = ["V-I positive", "V-I negative"]
|
17 |
+
xlabel = "Euclidean Distance"
|
18 |
+
ylabel = "Density"
|
19 |
+
titlelist = [
|
20 |
+
"(a) Baseline",
|
21 |
+
"(b) MIRL w/ MULT",
|
22 |
+
"(c) MIRL + OCLR w/ MULT",
|
23 |
+
"(d) MIRL + OCLR w/ DOTLA",
|
24 |
+
]
|
25 |
+
|
26 |
+
# ===================
|
27 |
+
# Part 3: Plot Configuration and Rendering
|
28 |
+
# ===================
|
29 |
+
# Set figure size to match the original image's dimensions
|
30 |
+
fig, axs = plt.subplots(2, 2, figsize=(10, 8))
|
31 |
+
|
32 |
+
# Plot histograms for each subplot
|
33 |
+
for i, ax in enumerate(axs.flatten()):
|
34 |
+
ax.hist(
|
35 |
+
data1,
|
36 |
+
bins=30,
|
37 |
+
density=True,
|
38 |
+
alpha=0.6,
|
39 |
+
color="#f1a43a",
|
40 |
+
label=labels[0],
|
41 |
+
edgecolor="black",
|
42 |
+
linewidth=0.5,
|
43 |
+
)
|
44 |
+
ax.hist(
|
45 |
+
data2,
|
46 |
+
bins=30,
|
47 |
+
density=True,
|
48 |
+
alpha=0.6,
|
49 |
+
color="#3172bb",
|
50 |
+
label=labels[1],
|
51 |
+
edgecolor="black",
|
52 |
+
linewidth=0.5,
|
53 |
+
)
|
54 |
+
ax.set_xlabel(xlabel)
|
55 |
+
ax.set_ylabel(ylabel)
|
56 |
+
ax.legend()
|
57 |
+
|
58 |
+
# Set titles for each subplot
|
59 |
+
axs[0, 0].set_title(titlelist[0])
|
60 |
+
axs[0, 1].set_title(titlelist[1])
|
61 |
+
axs[1, 0].set_title(titlelist[2])
|
62 |
+
axs[1, 1].set_title(titlelist[3])
|
63 |
+
|
64 |
+
# ===================
|
65 |
+
# Part 4: Saving Output
|
66 |
+
# ===================
|
67 |
+
# Adjust layout and save the plot
|
68 |
+
plt.tight_layout()
|
69 |
+
plt.savefig("hist_11.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_12.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_12.py
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
# Generate random data for illustration purposes
|
14 |
+
data1 = np.random.normal(5, 1, 1000)
|
15 |
+
data2 = np.random.normal(5, 1, 1000)
|
16 |
+
data3 = np.random.normal(5, 1, 1000)
|
17 |
+
data4 = np.random.normal(5, 1, 1000)
|
18 |
+
|
19 |
+
# Define the titles for each subplot
|
20 |
+
titles = [
|
21 |
+
"MATHWELL",
|
22 |
+
"MATHWELL MaC",
|
23 |
+
"Llama-2",
|
24 |
+
"Llama-2 MaC",
|
25 |
+
"LLEMMMA",
|
26 |
+
"LLEMMMA MaC",
|
27 |
+
"MAmmoTH",
|
28 |
+
"MAmmoTH MaC",
|
29 |
+
]
|
30 |
+
|
31 |
+
# Define the colors for each subplot
|
32 |
+
colors = ["blue", "blue", "red", "red", "purple", "purple", "orange", "orange"]
|
33 |
+
xlabel = "FKGL"
|
34 |
+
ylabel = "Density"
|
35 |
+
bins = 30
|
36 |
+
xvline = 5
|
37 |
+
|
38 |
+
# ===================
|
39 |
+
# Part 3: Plot Configuration and Rendering
|
40 |
+
# ===================
|
41 |
+
# Set the figure size to match the original image's dimensions
|
42 |
+
plt.figure(figsize=(7, 8)) # Adjusted to match 720x864 dimensions
|
43 |
+
|
44 |
+
# Create subplots
|
45 |
+
for i in range(8):
|
46 |
+
plt.subplot(4, 2, i + 1)
|
47 |
+
if i % 2 == 0:
|
48 |
+
data = data1 if i < 4 else data3
|
49 |
+
else:
|
50 |
+
data = data2 if i < 4 else data4
|
51 |
+
plt.hist(data, bins=bins, density=True, alpha=0.6, color=colors[i], range=(0, 10))
|
52 |
+
plt.title(titles[i])
|
53 |
+
plt.xlabel(xlabel)
|
54 |
+
plt.ylabel(ylabel)
|
55 |
+
plt.axvline(
|
56 |
+
x=xvline, color="k", linestyle="--", linewidth=1
|
57 |
+
) # Changed to dashed line
|
58 |
+
|
59 |
+
# ===================
|
60 |
+
# Part 4: Saving Output
|
61 |
+
# ===================
|
62 |
+
# Adjust the layout and show the plot
|
63 |
+
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) # Adjusted padding for tighter layout
|
64 |
+
plt.savefig("hist_12.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_13.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_13.py
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
# Generate bimodal data for camel weights
|
14 |
+
camel_peak1 = np.random.normal(loc=0.035, scale=0.004, size=200)
|
15 |
+
camel_peak2 = np.random.normal(loc=0.065, scale=0.004, size=200)
|
16 |
+
camel_weights = np.concatenate([camel_peak1, camel_peak2])
|
17 |
+
|
18 |
+
# Generate bimodal data for kangaroo weights
|
19 |
+
kangaroo_peak1 = np.random.normal(loc=0.03, scale=0.005, size=500)
|
20 |
+
kangaroo_peak2 = np.random.normal(loc=0.08, scale=0.005, size=500)
|
21 |
+
kangaroo_weights = np.concatenate([kangaroo_peak1, kangaroo_peak2])
|
22 |
+
labels = ["Camels", "Kangaroos"]
|
23 |
+
xticks = np.arange(0.00, 0.1, 0.02)
|
24 |
+
yticks = [1, 10, 100]
|
25 |
+
xlabel = "Animal Weight (Tons)"
|
26 |
+
ylabel = "Frequency"
|
27 |
+
title = "Desert Animals in the Wild"
|
28 |
+
legendtitle = "Species"
|
29 |
+
|
30 |
+
|
31 |
+
# ===================
|
32 |
+
# Part 3: Plot Configuration and Rendering
|
33 |
+
# ===================
|
34 |
+
# Set the figure size
|
35 |
+
plt.figure(figsize=(5, 5))
|
36 |
+
|
37 |
+
# Define the number of bins and bin edges for consistent bin width
|
38 |
+
bins = np.histogram(np.hstack((camel_weights, kangaroo_weights)), bins=15)[1]
|
39 |
+
|
40 |
+
# Create the histograms without stacking
|
41 |
+
# New colors using hex codes
|
42 |
+
plt.hist(
|
43 |
+
camel_weights,
|
44 |
+
bins=bins,
|
45 |
+
color="#1f77b4",
|
46 |
+
label=labels[0],
|
47 |
+
edgecolor="white",
|
48 |
+
linewidth=0.6,
|
49 |
+
alpha=0.6,
|
50 |
+
zorder=2,
|
51 |
+
)
|
52 |
+
plt.hist(
|
53 |
+
kangaroo_weights,
|
54 |
+
bins=bins,
|
55 |
+
color="#ff7f0e",
|
56 |
+
label=labels[1],
|
57 |
+
edgecolor="white",
|
58 |
+
linewidth=0.6,
|
59 |
+
alpha=0.6,
|
60 |
+
zorder=3,
|
61 |
+
)
|
62 |
+
|
63 |
+
# Set the background color
|
64 |
+
plt.gca().set_facecolor("#f5f5f5")
|
65 |
+
|
66 |
+
# Set the scale of y-axis to logarithmic
|
67 |
+
plt.yscale("log")
|
68 |
+
|
69 |
+
# Set the x-axis ticks
|
70 |
+
plt.xticks(xticks) # Adjusted to show more ticks
|
71 |
+
plt.tick_params(axis="x", length=0)
|
72 |
+
|
73 |
+
# Add white grid lines and place them behind the bars (zorder=0)
|
74 |
+
plt.grid(color="white", linestyle="-", linewidth=1.5, zorder=0)
|
75 |
+
|
76 |
+
# Set the y-axis ticks and remove all line markings (spines)
|
77 |
+
plt.yticks(yticks) # Adjusted to show additional y-axis tick
|
78 |
+
plt.tick_params(axis="y", length=0)
|
79 |
+
|
80 |
+
# Remove spine lines
|
81 |
+
for spine in plt.gca().spines.values():
|
82 |
+
spine.set_visible(False)
|
83 |
+
|
84 |
+
# remove small dash on y-axis
|
85 |
+
plt.tick_params(axis="y", which="minor", length=0)
|
86 |
+
|
87 |
+
# Set labels and title
|
88 |
+
plt.xlabel(xlabel) # Adjusted label
|
89 |
+
plt.ylabel(ylabel) # Adjusted label
|
90 |
+
plt.title(title) # Adjusted title
|
91 |
+
|
92 |
+
# Move legend to the bottom center of the plot
|
93 |
+
plt.legend(
|
94 |
+
title=legendtitle, loc="upper center", bbox_to_anchor=(0.5, -0.15), ncol=2
|
95 |
+
) # Adjust legend position and make it span 2 columns
|
96 |
+
|
97 |
+
# ===================
|
98 |
+
# Part 4: Saving Output
|
99 |
+
# ===================
|
100 |
+
# Adjust layout to make room for the legend
|
101 |
+
plt.tight_layout() # We might need to adjust this to account for the new legend position
|
102 |
+
|
103 |
+
plt.savefig("hist_13.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_15.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_15.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
# Generate normally distributed data
|
14 |
+
data = np.random.normal(loc=2.0, scale=1.0, size=10000)
|
15 |
+
|
16 |
+
# Axes Limits and Labels
|
17 |
+
title = "Histogram of Wind Speed Measurements"
|
18 |
+
xlabel_value = "Wind Speed (km/h)"
|
19 |
+
ylabel_value = "Number of Measurements"
|
20 |
+
|
21 |
+
# ===================
|
22 |
+
# Part 3: Plot Configuration and Rendering
|
23 |
+
# ===================
|
24 |
+
# Set the figure size
|
25 |
+
plt.figure(figsize=(8, 6))
|
26 |
+
|
27 |
+
# Enable the grid
|
28 |
+
plt.grid(True, linestyle="--", linewidth=0.5, alpha=0.7)
|
29 |
+
|
30 |
+
# Histogram of the data
|
31 |
+
n, bins, patches = plt.hist(data, bins=25, color="skyblue", edgecolor="blue", alpha=0.7)
|
32 |
+
|
33 |
+
# Highlight the median of the data
|
34 |
+
median = np.median(data)
|
35 |
+
plt.axvline(median, color="purple", linestyle="dashed", linewidth=2)
|
36 |
+
|
37 |
+
# Adjust the median text position to not overlap the bars when possible
|
38 |
+
median_text_position = max(n) * 0.9
|
39 |
+
for bin_edge, count in zip(bins, n):
|
40 |
+
if bin_edge > median and count < median_text_position:
|
41 |
+
# Place the text above the median position
|
42 |
+
median_text_position = count
|
43 |
+
break
|
44 |
+
plt.text(median + 0.5, median_text_position, f"Median: {median:.2f}", color="purple")
|
45 |
+
|
46 |
+
# Title and labels relevant to database statistics
|
47 |
+
plt.title(title)
|
48 |
+
plt.xlabel(xlabel_value)
|
49 |
+
plt.ylabel(ylabel_value)
|
50 |
+
|
51 |
+
# ===================
|
52 |
+
# Part 4: Saving Output
|
53 |
+
# ===================
|
54 |
+
# Adjust the layout
|
55 |
+
plt.tight_layout()
|
56 |
+
|
57 |
+
plt.savefig("hist_15.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_16.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_16.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 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Sample data with modified distributions
|
14 |
+
correctly_classified = np.random.exponential(scale=0.8, size=1000)
|
15 |
+
misclassified = np.random.normal(loc=2.0, scale=0.5, size=1000)
|
16 |
+
|
17 |
+
# Labels and Plot Types
|
18 |
+
hist_label = ["Baguette", "Youtiao"]
|
19 |
+
|
20 |
+
# Axes Limits and Labels
|
21 |
+
xlabel_value = "Distance to Threshold"
|
22 |
+
ylabel_value = "Frequency"
|
23 |
+
title = "Baking Accuracy Analysis"
|
24 |
+
|
25 |
+
# ===================
|
26 |
+
# Part 3: Plot Configuration and Rendering
|
27 |
+
# ===================
|
28 |
+
# Set the figure size
|
29 |
+
plt.figure(figsize=(5, 4))
|
30 |
+
|
31 |
+
# Plot histograms with stacked bars, modified colors, and alpha for transparency
|
32 |
+
plt.hist(
|
33 |
+
[correctly_classified, misclassified],
|
34 |
+
bins=50,
|
35 |
+
stacked=True,
|
36 |
+
label=hist_label,
|
37 |
+
color=["#6495ED", "#FFA07A"],
|
38 |
+
alpha=0.6,
|
39 |
+
)
|
40 |
+
|
41 |
+
# Add labels, title, and modify the style of the labels
|
42 |
+
plt.xlabel(xlabel_value, color="#333333")
|
43 |
+
plt.ylabel(ylabel_value, color="#333333")
|
44 |
+
plt.title(title)
|
45 |
+
|
46 |
+
# Modify the legend style and position to lower center
|
47 |
+
plt.legend(frameon=True, loc="lower center", ncol=2, bbox_to_anchor=(0.5, -0.4))
|
48 |
+
|
49 |
+
# Adjust x-axis range and add some space at the beginning of the x-axis
|
50 |
+
plt.xlim(left=plt.xlim()[0] + 0.1, right=3) # Adjusted right xlim
|
51 |
+
|
52 |
+
# Add grid with lighter color and set behind the histograms
|
53 |
+
plt.grid(color="grey", linestyle="--", linewidth=0.5, alpha=0.7)
|
54 |
+
plt.gca().set_axisbelow(True)
|
55 |
+
|
56 |
+
# ===================
|
57 |
+
# Part 4: Saving Output
|
58 |
+
# ===================
|
59 |
+
# Adjust layout and save the plot
|
60 |
+
plt.tight_layout()
|
61 |
+
plt.savefig("hist_16.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_3.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_3.py
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
14 |
+
camel_weights = np.random.exponential(scale=0.02, size=1000)
|
15 |
+
kangaroo_weights = np.random.exponential(scale=0.02, size=1000)
|
16 |
+
|
17 |
+
# Define the number of bins and bin edges for consistent bin width
|
18 |
+
bins = np.histogram(np.hstack((camel_weights, kangaroo_weights)), bins=15)[1]
|
19 |
+
labels = ["Camel", "Kangaroo"]
|
20 |
+
xticks = [0.00, 0.05, 0.10, 0.15]
|
21 |
+
xlabel = "Concept Weight"
|
22 |
+
ylabel = "Count"
|
23 |
+
title = "CIFAR100 'Desert' Concept"
|
24 |
+
# ===================
|
25 |
+
# Part 3: Plot Configuration and Rendering
|
26 |
+
# ===================
|
27 |
+
# Set the figure size
|
28 |
+
plt.figure(figsize=(5, 4))
|
29 |
+
|
30 |
+
# Create the histograms without stacking
|
31 |
+
plt.hist(
|
32 |
+
camel_weights,
|
33 |
+
bins=bins,
|
34 |
+
color="#85c23b",
|
35 |
+
label=labels[0],
|
36 |
+
edgecolor="white",
|
37 |
+
linewidth=0.6,
|
38 |
+
alpha=0.6,
|
39 |
+
zorder=2,
|
40 |
+
)
|
41 |
+
plt.hist(
|
42 |
+
kangaroo_weights,
|
43 |
+
bins=bins,
|
44 |
+
color="#e57476",
|
45 |
+
label=labels[1],
|
46 |
+
edgecolor="white",
|
47 |
+
linewidth=0.6,
|
48 |
+
alpha=0.6,
|
49 |
+
zorder=3,
|
50 |
+
)
|
51 |
+
|
52 |
+
# Set the background color
|
53 |
+
plt.gca().set_facecolor("#f5f5f5")
|
54 |
+
|
55 |
+
# Set the scale of y-axis to logarithmic
|
56 |
+
plt.yscale("log")
|
57 |
+
|
58 |
+
# Set the x-axis ticks
|
59 |
+
plt.xticks(xticks)
|
60 |
+
plt.tick_params(axis="x", length=0)
|
61 |
+
|
62 |
+
# Add white grid lines and place them behind the bars (zorder=0)
|
63 |
+
plt.grid(color="white", linestyle="-", linewidth=1.5, zorder=0)
|
64 |
+
|
65 |
+
# Set the y-axis ticks and remove all line markings (spines)
|
66 |
+
plt.yticks([1, 10, 100])
|
67 |
+
plt.tick_params(axis="y", length=0)
|
68 |
+
for spine in plt.gca().spines.values():
|
69 |
+
spine.set_visible(False) # Remove all the spines
|
70 |
+
|
71 |
+
# remove small dash on y-axis
|
72 |
+
plt.tick_params(axis="y", which="minor", length=0)
|
73 |
+
|
74 |
+
# Set labels and title
|
75 |
+
plt.xlabel(xlabel)
|
76 |
+
plt.ylabel(ylabel)
|
77 |
+
plt.title(title)
|
78 |
+
|
79 |
+
# Add legend with title
|
80 |
+
plt.legend(title="Class")
|
81 |
+
|
82 |
+
# ===================
|
83 |
+
# Part 4: Saving Output
|
84 |
+
# ===================
|
85 |
+
# Adjust layout
|
86 |
+
plt.tight_layout()
|
87 |
+
|
88 |
+
# Show the plot
|
89 |
+
plt.savefig("hist_3.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_4.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_4.py
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
center_data = np.random.normal(6, 2, 1000)
|
15 |
+
random_data = np.random.normal(1, 2, 1000)
|
16 |
+
|
17 |
+
# Define bins aligned for both histograms
|
18 |
+
bins = np.histogram(np.hstack((center_data, random_data)), bins=30)[1]
|
19 |
+
labels = ["Center", "Random"]
|
20 |
+
xlabel = "Distance Difference (Random vs. Center)"
|
21 |
+
ylabel = "Number of Examples"
|
22 |
+
|
23 |
+
# ===================
|
24 |
+
# Part 3: Plot Configuration and Rendering
|
25 |
+
# ===================
|
26 |
+
# Create figure and axis
|
27 |
+
fig, ax = plt.subplots(
|
28 |
+
figsize=(5, 3)
|
29 |
+
) # Adjusted to match the original image's dimensions
|
30 |
+
|
31 |
+
# Calculate the histogram data for each set and plot them
|
32 |
+
ax.hist(
|
33 |
+
center_data,
|
34 |
+
bins=bins,
|
35 |
+
color="#f2a965",
|
36 |
+
edgecolor="#fdf460",
|
37 |
+
linewidth=1.2,
|
38 |
+
label=labels[0],
|
39 |
+
align="mid",
|
40 |
+
histtype="stepfilled",
|
41 |
+
alpha=0.7,
|
42 |
+
)
|
43 |
+
ax.hist(
|
44 |
+
random_data,
|
45 |
+
bins=bins,
|
46 |
+
color="#709dc6",
|
47 |
+
edgecolor="#ca3531",
|
48 |
+
linewidth=1.2,
|
49 |
+
label=labels[1],
|
50 |
+
align="mid",
|
51 |
+
histtype="stepfilled",
|
52 |
+
alpha=0.7,
|
53 |
+
)
|
54 |
+
|
55 |
+
# To show the overlapping areas, we plot the two histograms with transparency
|
56 |
+
ax.hist(
|
57 |
+
center_data,
|
58 |
+
bins=bins,
|
59 |
+
color="#f2a965",
|
60 |
+
edgecolor="#fdf460",
|
61 |
+
linewidth=1.2,
|
62 |
+
alpha=0.7,
|
63 |
+
align="mid",
|
64 |
+
histtype="stepfilled",
|
65 |
+
)
|
66 |
+
ax.hist(
|
67 |
+
random_data,
|
68 |
+
bins=bins,
|
69 |
+
color="#709dc6",
|
70 |
+
edgecolor="#ca3531",
|
71 |
+
linewidth=1.2,
|
72 |
+
alpha=0.7,
|
73 |
+
align="mid",
|
74 |
+
histtype="stepfilled",
|
75 |
+
)
|
76 |
+
|
77 |
+
# Set labels
|
78 |
+
ax.set_xlabel(xlabel)
|
79 |
+
ax.set_ylabel(ylabel)
|
80 |
+
|
81 |
+
# Add legend
|
82 |
+
ax.legend()
|
83 |
+
|
84 |
+
# ===================
|
85 |
+
# Part 4: Saving Output
|
86 |
+
# ===================
|
87 |
+
# Adjust layout
|
88 |
+
plt.tight_layout()
|
89 |
+
|
90 |
+
# Save the plot
|
91 |
+
plt.savefig("hist_4.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_5.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_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 |
+
|
10 |
+
# ===================
|
11 |
+
# Part 2: Data Preparation
|
12 |
+
# ===================
|
13 |
+
# Sample data to approximate the distribution in the image
|
14 |
+
data = np.random.gamma(shape=2.0, scale=1.0, size=10000)
|
15 |
+
data = data[data < 30] # Limiting the data to match the x-axis in the image
|
16 |
+
xlabel = "Number of Repetition"
|
17 |
+
ylabel = "Number of Clusters"
|
18 |
+
binslist = [30, 30]
|
19 |
+
|
20 |
+
# ===================
|
21 |
+
# Part 3: Plot Configuration and Rendering
|
22 |
+
# ===================
|
23 |
+
# Set the figure size to match the original image's dimensions
|
24 |
+
plt.figure(figsize=(4, 3))
|
25 |
+
|
26 |
+
# Show grid with some transparency
|
27 |
+
plt.grid(True, linestyle="-", linewidth=0.5, color="#000000", alpha=0.1)
|
28 |
+
|
29 |
+
# Create the histogram
|
30 |
+
plt.hist(data, bins=binslist[0], color="#dca684")
|
31 |
+
|
32 |
+
# Create the histogram with histtype='step' for edge-only bars
|
33 |
+
plt.hist(
|
34 |
+
data,
|
35 |
+
bins=binslist[1],
|
36 |
+
color="#dca684",
|
37 |
+
edgecolor="#d1885c",
|
38 |
+
histtype="step",
|
39 |
+
linewidth=1.2,
|
40 |
+
)
|
41 |
+
|
42 |
+
# Set the title and labels to match the image
|
43 |
+
plt.xlabel(xlabel)
|
44 |
+
plt.ylabel(ylabel)
|
45 |
+
|
46 |
+
# ===================
|
47 |
+
# Part 4: Saving Output
|
48 |
+
# ===================
|
49 |
+
# Adjust layout
|
50 |
+
plt.tight_layout()
|
51 |
+
|
52 |
+
# Display the plot
|
53 |
+
plt.savefig("hist_5.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_6.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_6.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 |
+
# Sample data (replace with your actual data)
|
14 |
+
correctly_classified = np.random.exponential(scale=1.0, size=1000)
|
15 |
+
misclassified = np.random.exponential(scale=0.5, size=1000)
|
16 |
+
labels = ["Correctly classified", "Misclassified"]
|
17 |
+
xlabel = "Distance to threshold"
|
18 |
+
bins = 50
|
19 |
+
|
20 |
+
|
21 |
+
# ===================
|
22 |
+
# Part 3: Plot Configuration and Rendering
|
23 |
+
# ===================
|
24 |
+
# Set the figure size to match the original image's dimensions
|
25 |
+
plt.figure(figsize=(5, 3))
|
26 |
+
|
27 |
+
# Plot histograms with stacked bars
|
28 |
+
plt.hist(
|
29 |
+
[correctly_classified, misclassified],
|
30 |
+
bins=bins,
|
31 |
+
stacked=True,
|
32 |
+
label=labels,
|
33 |
+
color=["#3b75af", "#ef8636"],
|
34 |
+
)
|
35 |
+
|
36 |
+
# Add labels and title
|
37 |
+
plt.xlabel(xlabel)
|
38 |
+
plt.legend()
|
39 |
+
|
40 |
+
# Adjust x-axis range to match the reference picture and add a little space at the beginning of the x-axis
|
41 |
+
plt.xlim(left=plt.xlim()[0] + 0.1, right=5)
|
42 |
+
|
43 |
+
# ===================
|
44 |
+
# Part 4: Saving Output
|
45 |
+
# ===================
|
46 |
+
# Adjust layout and save the plot
|
47 |
+
plt.tight_layout()
|
48 |
+
plt.savefig("hist_6.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_7.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_7.py
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 plotting
|
14 |
+
confidence = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
|
15 |
+
accuracy = np.array([0.2, 0.3, 0.4, 0.5, 0.6, 0.5, 0.4, 0.3, 0.8])
|
16 |
+
calibration_error = 0.31
|
17 |
+
text = f"Calibration Error:\n{calibration_error}"
|
18 |
+
|
19 |
+
# Axes Limits and Labels
|
20 |
+
xlabel_value = "Confidence"
|
21 |
+
ylabel_value = "Accuracy in bin"
|
22 |
+
title = "Cascade"
|
23 |
+
xlim_values = [0, 1]
|
24 |
+
ylim_values = [0, 1]
|
25 |
+
|
26 |
+
# ===================
|
27 |
+
# Part 3: Plot Configuration and Rendering
|
28 |
+
# ===================
|
29 |
+
# Set figure size to match the original image's dimensions
|
30 |
+
plt.figure(figsize=(8, 8))
|
31 |
+
|
32 |
+
# Plot histogram using plt.hist and specify bins
|
33 |
+
plt.hist(confidence, bins=9, weights=accuracy, color="tan", edgecolor="black")
|
34 |
+
|
35 |
+
# Add diagonal dashed line
|
36 |
+
plt.plot([0, 1], [0, 1], "k--", linestyle="--", linewidth=1, color="#808080")
|
37 |
+
|
38 |
+
# Add text for calibration error
|
39 |
+
plt.text(0.08, 0.85, text, color="#c06c27", fontsize=18)
|
40 |
+
|
41 |
+
# Set labels and title
|
42 |
+
plt.xlabel(xlabel_value)
|
43 |
+
plt.ylabel(ylabel_value)
|
44 |
+
plt.title(title)
|
45 |
+
|
46 |
+
# Adjust x and y axis limits to match the reference picture
|
47 |
+
plt.xlim(xlim_values)
|
48 |
+
plt.ylim(ylim_values)
|
49 |
+
|
50 |
+
# ===================
|
51 |
+
# Part 4: Saving Output
|
52 |
+
# ===================
|
53 |
+
# Adjust layout and save the plot
|
54 |
+
plt.tight_layout()
|
55 |
+
plt.savefig("hist_7.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_8.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_8.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
|
6 |
+
# ===================
|
7 |
+
# Part 2: Data Preparation
|
8 |
+
# ===================
|
9 |
+
# Sample data (replace with actual data)
|
10 |
+
image_overlap = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
|
11 |
+
number_of_queries = [500, 1000, 2000, 3000, 5500, 5700, 5800, 4000, 1000]
|
12 |
+
|
13 |
+
# Axes Limits and Labels
|
14 |
+
xlabel_value = "% images overlap"
|
15 |
+
ylabel_value = "Number of queries"
|
16 |
+
xlim_values = [0, 1.0]
|
17 |
+
ylim_values = [0, 6000]
|
18 |
+
|
19 |
+
# ===================
|
20 |
+
# Part 3: Plot Configuration and Rendering
|
21 |
+
# ===================
|
22 |
+
# Create a histogram
|
23 |
+
plt.figure(figsize=(6, 5)) # Adjusted to match the original image's dimensions
|
24 |
+
plt.hist(image_overlap, bins=9, weights=number_of_queries, color="#7f95c0")
|
25 |
+
|
26 |
+
# Set the labels and title
|
27 |
+
plt.xlabel(xlabel_value)
|
28 |
+
plt.ylabel(ylabel_value)
|
29 |
+
|
30 |
+
# Remove ticks on both axes
|
31 |
+
plt.tick_params(axis="both", which="both", length=0)
|
32 |
+
|
33 |
+
# Set the range for the axes
|
34 |
+
plt.xlim(xlim_values)
|
35 |
+
plt.ylim(ylim_values)
|
36 |
+
|
37 |
+
# ===================
|
38 |
+
# Part 4: Saving Output
|
39 |
+
# ===================
|
40 |
+
# Adjust layout and display the plot
|
41 |
+
plt.tight_layout()
|
42 |
+
plt.savefig("hist_8.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/hist_9.png
ADDED
![]() |
ChartMimic/dataset/ori_500/hist_9.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 |
+
# Sample data (replace with your actual data)
|
14 |
+
data1 = np.random.normal(0.08, 0.01, 10000)
|
15 |
+
data2 = np.random.normal(0.1, 0.02, 10000)
|
16 |
+
binslist = [100, 100]
|
17 |
+
titles = ["MNIST", "FashionMNIST"]
|
18 |
+
rangelist = [(0, 0.12), (0, 0.25)]
|
19 |
+
|
20 |
+
# ===================
|
21 |
+
# Part 3: Plot Configuration and Rendering
|
22 |
+
# ===================
|
23 |
+
# Create figure and axes with specified figure size
|
24 |
+
fig, axs = plt.subplots(2, 1, figsize=(10, 7), gridspec_kw={"hspace": 0.3})
|
25 |
+
|
26 |
+
# First histogram (MNIST)
|
27 |
+
axs[0].hist(data1, bins=binslist[0], range=rangelist[0], color="#3b75af")
|
28 |
+
axs[0].set_title(titles[0])
|
29 |
+
|
30 |
+
# Second histogram (FashionMNIST)
|
31 |
+
axs[1].hist(data2, bins=binslist[1], range=rangelist[1], color="#3b75af")
|
32 |
+
axs[1].set_title(titles[1])
|
33 |
+
|
34 |
+
# ===================
|
35 |
+
# Part 4: Saving Output
|
36 |
+
# ===================
|
37 |
+
# Adjust layout and save plot
|
38 |
+
plt.tight_layout()
|
39 |
+
plt.savefig("hist_9.pdf", bbox_inches="tight")
|
ChartMimic/dataset/ori_500/line_1.png
ADDED
![]() |
ChartMimic/dataset/ori_500/line_1.py
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
import numpy as np; np.random.seed(0)
|
7 |
+
|
8 |
+
# ===================
|
9 |
+
# Part 2: Data Preparation
|
10 |
+
# ===================
|
11 |
+
# Data (example values, the actual data should be extracted from the paper)
|
12 |
+
snr_values = [5, 10, 15, 20, 25]
|
13 |
+
jpeg_ldpc = [10, 30, 50, 70, 90]
|
14 |
+
deepjscc_wo_ofdm = [5, 15, 25, 35, 45]
|
15 |
+
deepjscc_w_ofdm = [20, 40, 60, 80, 95]
|
16 |
+
ours = [30, 60, 80, 95, 100]
|
17 |
+
|
18 |
+
# Labels and Plot Types
|
19 |
+
label_jpeg_ldpc = "JPEG+LDPC"
|
20 |
+
label_deepjscc_wo_ofdm = "DEEPJSCC w/o ofdm"
|
21 |
+
label_deepjscc_w_ofdm = "DEEPJSCC w/ ofdm"
|
22 |
+
label_ours = "OURS"
|
23 |
+
|
24 |
+
# Axes Limits and Labels
|
25 |
+
xlim_values = [5, 25]
|
26 |
+
ylim_values = [0, 100]
|
27 |
+
xlabel_value = "SNR"
|
28 |
+
ylabel_value = "Classification Accuracy (%)"
|
29 |
+
xticks_values = np.arange(5, 25, 5)
|
30 |
+
yticks_values = np.arange(0, 101, 20)
|
31 |
+
xtickslabel_values = None # Not specified in the code
|
32 |
+
ytickslabel_values = None # Not specified in the code
|
33 |
+
title_value = None # Not specified in the code
|
34 |
+
axhiline_value = None # Not specified in the code
|
35 |
+
axvline_value = None # Not specified in the code
|
36 |
+
|
37 |
+
# ===================
|
38 |
+
# Part 3: Plot Configuration and Rendering
|
39 |
+
# ===================
|
40 |
+
# Plotting
|
41 |
+
plt.figure(figsize=(8, 6)) # Adjusting figure size to match original image dimensions
|
42 |
+
plt.plot(
|
43 |
+
snr_values,
|
44 |
+
jpeg_ldpc,
|
45 |
+
"-o",
|
46 |
+
label=label_jpeg_ldpc,
|
47 |
+
color="#1f77b4",
|
48 |
+
clip_on=False,
|
49 |
+
zorder=10,
|
50 |
+
)
|
51 |
+
plt.plot(
|
52 |
+
snr_values,
|
53 |
+
deepjscc_wo_ofdm,
|
54 |
+
"-^",
|
55 |
+
label=label_deepjscc_wo_ofdm,
|
56 |
+
color="#ff7f0e",
|
57 |
+
clip_on=False,
|
58 |
+
zorder=10,
|
59 |
+
)
|
60 |
+
plt.plot(
|
61 |
+
snr_values,
|
62 |
+
deepjscc_w_ofdm,
|
63 |
+
"-x",
|
64 |
+
label=label_deepjscc_w_ofdm,
|
65 |
+
color="#2ca02c",
|
66 |
+
clip_on=False,
|
67 |
+
zorder=10,
|
68 |
+
)
|
69 |
+
plt.plot(snr_values, ours, "-x", label=label_ours, color="#d62728")
|
70 |
+
|
71 |
+
# Set y-axis to only display specific ticks and extend y-axis to leave space at top
|
72 |
+
plt.yticks(yticks_values)
|
73 |
+
plt.ylim(ylim_values) # Adjusted y-axis limit
|
74 |
+
plt.xticks(xticks_values)
|
75 |
+
plt.xlim(xlim_values)
|
76 |
+
|
77 |
+
# Adding grid, legend, and labels
|
78 |
+
plt.grid(True)
|
79 |
+
plt.legend(loc="upper center", bbox_to_anchor=(0.5, 1.08), ncol=4, frameon=False)
|
80 |
+
plt.xlabel(xlabel_value)
|
81 |
+
plt.ylabel(ylabel_value)
|
82 |
+
|
83 |
+
# ===================
|
84 |
+
# Part 4: Saving Output
|
85 |
+
# ===================
|
86 |
+
# Adjusting layout to reduce white space
|
87 |
+
plt.tight_layout()
|
88 |
+
plt.savefig('line_1.pdf', bbox_inches='tight')
|
ChartMimic/dataset/ori_500/line_10.png
ADDED
![]() |
ChartMimic/dataset/ori_500/line_10.py
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
import numpy as np; np.random.seed(0)
|
7 |
+
|
8 |
+
# ===================
|
9 |
+
# Part 2: Data Preparation
|
10 |
+
# ===================
|
11 |
+
# Data
|
12 |
+
n_aug = ["0", "0.125", "0.25", "0.5", "1", "2", "4", "8"]
|
13 |
+
content = [1, 3, 6, 4, 2, 1, 0.5, 0.2]
|
14 |
+
organization = [0.5, 1, 1.5, 2, 1.5, 1, 0.5, 0.25]
|
15 |
+
language = [0, 0.5, 1, 2, 4, 3, 2, 1]
|
16 |
+
|
17 |
+
# Positions for the bars on the x-axis
|
18 |
+
ind = np.arange(len(n_aug))
|
19 |
+
|
20 |
+
# Labels and Legend
|
21 |
+
xlabel = "n"
|
22 |
+
ylabel = "Performance Gain (%)"
|
23 |
+
content_label = "Content"
|
24 |
+
organization_label = "Organization"
|
25 |
+
language_label = "Language"
|
26 |
+
|
27 |
+
# Limits
|
28 |
+
xlim = (n_aug[0], n_aug[-1])
|
29 |
+
ylim = (0, 7)
|
30 |
+
|
31 |
+
# ===================
|
32 |
+
# Part 3: Plot Configuration and Rendering
|
33 |
+
# ===================
|
34 |
+
# Plot
|
35 |
+
fig, ax = plt.subplots(figsize=(8, 6)) # Adjust the size to match the original image's dimensions
|
36 |
+
ax.plot(n_aug, content, label=content_label, color="#0173b2")
|
37 |
+
ax.plot(n_aug, organization, label=organization_label, color="#de8f05")
|
38 |
+
ax.plot(n_aug, language, label=language_label, color="#20a983")
|
39 |
+
|
40 |
+
# Setting the x-axis and y-axis limits
|
41 |
+
ax.set_ylim(*ylim) # Set y-axis to go from 0 to 7
|
42 |
+
ax.set_xlim(*xlim) # Set x-axis limits to cover the range of n_aug without extra space
|
43 |
+
|
44 |
+
# Labels and Title
|
45 |
+
ax.set_xlabel(xlabel, fontsize=14)
|
46 |
+
ax.set_ylabel(ylabel, fontsize=14)
|
47 |
+
|
48 |
+
# Legend
|
49 |
+
ax.legend(loc="upper center", fontsize=14, frameon=False, ncol=3, bbox_to_anchor=(0.5, 1.1))
|
50 |
+
|
51 |
+
# Grid
|
52 |
+
ax.grid(True, ls="--", alpha=0.5)
|
53 |
+
|
54 |
+
# ===================
|
55 |
+
# Part 4: Saving Output
|
56 |
+
# ===================
|
57 |
+
# Adjusting layout to reduce white space
|
58 |
+
plt.tight_layout()
|
59 |
+
plt.savefig('line_10.pdf', bbox_inches='tight')
|
ChartMimic/dataset/ori_500/line_11.png
ADDED
![]() |
ChartMimic/dataset/ori_500/line_11.py
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
|
6 |
+
# ===================
|
7 |
+
# Part 2: Data Preparation
|
8 |
+
# ===================
|
9 |
+
# Approximated data points based on the image
|
10 |
+
decomposition_IO_norm = [0, 20, 40, 60, 80]
|
11 |
+
coco_10k = [0.60, 0.70, 0.72, 0.73, 0.74]
|
12 |
+
laion_10k = [0.58, 0.67, 0.70, 0.71, 0.73]
|
13 |
+
coco_5k = [0.56, 0.66, 0.67, 0.68, None]
|
14 |
+
laion_5k = [0.55, 0.61, 0.64, 0.65, None]
|
15 |
+
clip_y = [0.75, 0.75]
|
16 |
+
clip_x = [-10, 90]
|
17 |
+
|
18 |
+
# Axes Limits and Labels
|
19 |
+
xlabel_value = "Decomposition IO Norm"
|
20 |
+
xlim_values = [-10, 90]
|
21 |
+
|
22 |
+
ylabel_value = "Accuracy"
|
23 |
+
ylim_values = [0.53, 0.76]
|
24 |
+
yticks_values = [0.55, 0.60, 0.65, 0.70, 0.75]
|
25 |
+
|
26 |
+
# Labels
|
27 |
+
label_1="coco (10k)"
|
28 |
+
label_2="laion (10k)"
|
29 |
+
label_3 = "coco (5k)"
|
30 |
+
label_4="laion (5k)"
|
31 |
+
label_5="CLIP"
|
32 |
+
|
33 |
+
# Titles
|
34 |
+
title_1 = "Effect of Vocab on Zero Shot Accuracy"
|
35 |
+
title_2 = "Dictionary"
|
36 |
+
|
37 |
+
# ===================
|
38 |
+
# Part 3: Plot Configuration and Rendering
|
39 |
+
# ===================
|
40 |
+
# Create the plot
|
41 |
+
plt.figure(figsize=(6, 6)) # Adjust figure size to match original image dimensions
|
42 |
+
plt.plot(decomposition_IO_norm, coco_10k, label=label_1, color="red", marker="o")
|
43 |
+
plt.plot(
|
44 |
+
decomposition_IO_norm, laion_10k, label=label_2, color="green", marker="o"
|
45 |
+
)
|
46 |
+
plt.plot(decomposition_IO_norm, coco_5k, label=label_3, color="blue", marker="o")
|
47 |
+
plt.plot(
|
48 |
+
decomposition_IO_norm, laion_5k, label=label_4, color="orange", marker="o"
|
49 |
+
)
|
50 |
+
plt.plot(clip_x, clip_y, label=label_5, color="black", linestyle="--")
|
51 |
+
|
52 |
+
# Add title and labels
|
53 |
+
plt.title(title_1)
|
54 |
+
plt.xlabel(xlabel_value)
|
55 |
+
plt.ylabel(ylabel_value)
|
56 |
+
plt.xticks(decomposition_IO_norm)
|
57 |
+
plt.xlim(xlim_values)
|
58 |
+
plt.yticks(yticks_values)
|
59 |
+
plt.ylim(ylim_values)
|
60 |
+
# Add legend with additional entry
|
61 |
+
plt.legend(title=title_2,loc="lower right")
|
62 |
+
|
63 |
+
# Adding the white grid manually
|
64 |
+
plt.grid(color="white", linestyle="-", linewidth=0.5)
|
65 |
+
|
66 |
+
# ===================
|
67 |
+
# Part 4: Saving Output
|
68 |
+
# ===================
|
69 |
+
# Show the plot with tight layout to minimize white space
|
70 |
+
plt.tight_layout()
|
71 |
+
plt.savefig('line_11.pdf', bbox_inches='tight')
|
ChartMimic/dataset/ori_500/line_12.png
ADDED
![]() |
ChartMimic/dataset/ori_500/line_12.py
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
|
7 |
+
# ===================
|
8 |
+
# Part 2: Data Preparation
|
9 |
+
# ===================
|
10 |
+
# Data for plotting
|
11 |
+
sample_ratio = [0.25, 0.50, 0.75, 1.00]
|
12 |
+
std_acc_512 = [0.07, 0.06, 0.01, 0.05]
|
13 |
+
std_acc_1024 = [0.055, 0.045, 0.04, 0.035]
|
14 |
+
std_acc_2048 = [0.03, 0.025, 0.02, 0.015]
|
15 |
+
|
16 |
+
# Extracted variables
|
17 |
+
line_label_512 = "MAXN=512"
|
18 |
+
line_label_1024 = "MAXN=1024"
|
19 |
+
line_label_2048 = "MAXN=2048"
|
20 |
+
xlim_values = (0.25, 1)
|
21 |
+
ylim_values = (0.00, 0.08)
|
22 |
+
xlabel_value = "Sample Ratio"
|
23 |
+
ylabel_value = "Std of ACC"
|
24 |
+
xticks_values = sample_ratio
|
25 |
+
yticks_values = None # Not explicitly set in the code
|
26 |
+
xtickslabel_fontsize = 14
|
27 |
+
ytickslabel_fontsize = 14
|
28 |
+
title_value = None # Not explicitly set in the code
|
29 |
+
axhline_value = None # Not explicitly set in the code
|
30 |
+
axvline_value = None # Not explicitly set in the code
|
31 |
+
|
32 |
+
# ===================
|
33 |
+
# Part 3: Plot Configuration and Rendering
|
34 |
+
# ===================
|
35 |
+
# Plotting the lines with increased marker size and line width
|
36 |
+
plt.figure(figsize=(8, 6))
|
37 |
+
plt.plot(
|
38 |
+
sample_ratio,
|
39 |
+
std_acc_512,
|
40 |
+
marker="*",
|
41 |
+
markersize=10,
|
42 |
+
linewidth=2,
|
43 |
+
color="#2ab34a",
|
44 |
+
label=line_label_512,
|
45 |
+
clip_on=False,
|
46 |
+
zorder=10,
|
47 |
+
)
|
48 |
+
plt.plot(
|
49 |
+
sample_ratio,
|
50 |
+
std_acc_1024,
|
51 |
+
marker="^",
|
52 |
+
markerfacecolor="white",
|
53 |
+
markersize=10,
|
54 |
+
linewidth=2,
|
55 |
+
markeredgecolor="#ee756e",
|
56 |
+
color="#ee756e",
|
57 |
+
clip_on=False,
|
58 |
+
zorder=10,
|
59 |
+
label=line_label_1024,
|
60 |
+
)
|
61 |
+
plt.plot(
|
62 |
+
sample_ratio,
|
63 |
+
std_acc_2048,
|
64 |
+
marker="o",
|
65 |
+
markerfacecolor="white",
|
66 |
+
markersize=10,
|
67 |
+
linewidth=2,
|
68 |
+
markeredgecolor="#4995c6",
|
69 |
+
color="#4995c6",
|
70 |
+
clip_on=False,
|
71 |
+
zorder=10,
|
72 |
+
label=line_label_2048,
|
73 |
+
)
|
74 |
+
|
75 |
+
# Setting the x-axis and y-axis limits
|
76 |
+
plt.ylim(*ylim_values) # Set y-axis to go from 0 to 7
|
77 |
+
plt.yticks(fontsize=ytickslabel_fontsize)
|
78 |
+
plt.xlim(*xlim_values) # Set y-axis to go from 0 to 7
|
79 |
+
# Set x-axis to show only the values in the sample_ratio list
|
80 |
+
plt.xticks(xticks_values, fontsize=xtickslabel_fontsize)
|
81 |
+
|
82 |
+
# Adding labels and title
|
83 |
+
plt.xlabel(xlabel_value, fontsize=18)
|
84 |
+
plt.ylabel(ylabel_value, fontsize=18)
|
85 |
+
|
86 |
+
# Adding legend with increased font size
|
87 |
+
plt.legend(
|
88 |
+
fontsize="large",
|
89 |
+
loc="upper center",
|
90 |
+
ncol=3,
|
91 |
+
frameon=False,
|
92 |
+
bbox_to_anchor=(0.5, 1.1),
|
93 |
+
)
|
94 |
+
|
95 |
+
# Adding grid
|
96 |
+
plt.grid(True, alpha=0.6)
|
97 |
+
|
98 |
+
# ===================
|
99 |
+
# Part 4: Saving Output
|
100 |
+
# ===================
|
101 |
+
# Adjusting layout to reduce white space
|
102 |
+
plt.tight_layout()
|
103 |
+
plt.savefig('line_12.pdf', bbox_inches='tight')
|
ChartMimic/dataset/ori_500/line_13.png
ADDED
![]() |
ChartMimic/dataset/ori_500/line_13.py
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
import numpy as np; np.random.seed(0)
|
7 |
+
|
8 |
+
# ===================
|
9 |
+
# Part 2: Data Preparation
|
10 |
+
# ===================
|
11 |
+
# Variable extraction
|
12 |
+
line_label_base = "base"
|
13 |
+
line_label_ours = "ours"
|
14 |
+
xlim_values = (0, 200)
|
15 |
+
ylim_values_fid = (0.1, 0.6)
|
16 |
+
ylim_values_is = (0, 0.4)
|
17 |
+
ylim_values_cwfid = (0.1, 0.4)
|
18 |
+
ylim_values_cas = (0.1, 0.4)
|
19 |
+
xlabel_value = "Training iterations"
|
20 |
+
ylabel_value_fid = "FID (↓)"
|
21 |
+
ylabel_value_is = "IS (↑)"
|
22 |
+
ylabel_value_cwfid = "CW-FID (↓)"
|
23 |
+
ylabel_value_cas = "CAS (↑)"
|
24 |
+
yticks_values_fid = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6]
|
25 |
+
yticks_values_is = [0, 0.1, 0.2, 0.3, 0.4]
|
26 |
+
yticks_values_cwfid = [0.1, 0.2, 0.3, 0.4]
|
27 |
+
yticks_values_cas = [0.1, 0.2, 0.3, 0.4]
|
28 |
+
legend_location = "upper center"
|
29 |
+
legend_bbox_to_anchor = (0.5, 1.2)
|
30 |
+
legend_frameon = False
|
31 |
+
legend_ncol = 2
|
32 |
+
grid_value = True
|
33 |
+
|
34 |
+
# Create subplots
|
35 |
+
fig, axs = plt.subplots(4, 1, figsize=(8, 10))
|
36 |
+
|
37 |
+
# FID
|
38 |
+
# Simulated data to match the reference picture
|
39 |
+
iterations = np.linspace(0, 200, 21)
|
40 |
+
iterations = [0., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100., 110., 120., 130.,
|
41 |
+
140., 150., 160., 170., 180., 190., 200.]
|
42 |
+
base_data = [0.54, 0.49, 0.49, 0.5, 0.48, 0.41, 0.43, 0.39, 0.38, 0.37, 0.35, 0.36, 0.34, 0.31,
|
43 |
+
0.3, 0.28, 0.29, 0.24, 0.24, 0.2, 0.15]
|
44 |
+
ours_data = [0.41, 0.41, 0.38, 0.43, 0.35, 0.38, 0.37, 0.4, 0.39, 0.36, 0.36, 0.33, 0.3, 0.33,
|
45 |
+
0.33, 0.35, 0.34, 0.31, 0.3, 0.28, 0.27]
|
46 |
+
# IS
|
47 |
+
# Simulated data to match the reference picture
|
48 |
+
base_data_is = [0.27, 0.33, 0.27, 0.26, 0.23, 0.27, 0.21, 0.23, 0.2, 0.22, 0.19, 0.17, 0.18, 0.18,
|
49 |
+
0.16, 0.16, 0.13, 0.12, 0.11, 0.1, 0.08]
|
50 |
+
ours_data_is = [0.17, 0.21, 0.2, 0.18, 0.23, 0.21, 0.23, 0.25, 0.24, 0.27, 0.23, 0.26, 0.25, 0.25,
|
51 |
+
0.26, 0.27, 0.28, 0.26, 0.31, 0.3, 0.27]
|
52 |
+
|
53 |
+
# CW-FID
|
54 |
+
base_data_cwfid = [0.33, 0.34, 0.32, 0.3, 0.28, 0.32, 0.29, 0.32, 0.3, 0.32, 0.31, 0.31, 0.3, 0.34,
|
55 |
+
0.3, 0.31, 0.34, 0.27, 0.27, 0.32, 0.28]
|
56 |
+
ours_data_cwfid = [0.24, 0.19, 0.19, 0.24, 0.23, 0.24, 0.22, 0.18, 0.24, 0.19, 0.22, 0.22, 0.2, 0.21,
|
57 |
+
0.22, 0.21, 0.18, 0.21, 0.23, 0.19, 0.2]
|
58 |
+
|
59 |
+
# CAS
|
60 |
+
base_data_cas = [0.19, 0.24, 0.21, 0.21, 0.18, 0.21, 0.19, 0.2, 0.19, 0.21, 0.21, 0.2, 0.21, 0.18,
|
61 |
+
0.17, 0.21, 0.2, 0.21, 0.25, 0.22, 0.18]
|
62 |
+
ours_data_cas = [0.32, 0.27, 0.29, 0.3, 0.33, 0.29, 0.28, 0.3, 0.29, 0.32, 0.28, 0.28, 0.29, 0.29,
|
63 |
+
0.34, 0.32, 0.3, 0.28, 0.32, 0.28, 0.27]
|
64 |
+
# ===================
|
65 |
+
# Part 3: Plot Configuration and Rendering
|
66 |
+
# ===================
|
67 |
+
# Plotting FID
|
68 |
+
axs[0].plot(iterations, base_data, label=line_label_base, color="blue")
|
69 |
+
axs[0].plot(iterations, ours_data, label=line_label_ours, color="orange")
|
70 |
+
axs[0].set_xlabel(xlabel_value)
|
71 |
+
axs[0].set_ylabel(ylabel_value_fid)
|
72 |
+
axs[0].set_xlim(*xlim_values)
|
73 |
+
axs[0].set_yticks(yticks_values_fid)
|
74 |
+
axs[0].tick_params(axis="both", which="both", color="gray")
|
75 |
+
|
76 |
+
# Plotting IS
|
77 |
+
axs[1].plot(iterations, base_data_is, label=line_label_base, color="blue")
|
78 |
+
axs[1].plot(iterations, ours_data_is, label=line_label_ours, color="orange")
|
79 |
+
axs[1].set_xlabel(xlabel_value)
|
80 |
+
axs[1].set_ylabel(ylabel_value_is)
|
81 |
+
axs[1].set_xlim(*xlim_values)
|
82 |
+
axs[1].set_yticks(yticks_values_is)
|
83 |
+
axs[1].tick_params(axis="both", which="both", color="gray")
|
84 |
+
|
85 |
+
# Plotting CW-FID
|
86 |
+
axs[2].plot(iterations, base_data_cwfid, label=line_label_base, color="blue")
|
87 |
+
axs[2].plot(iterations, ours_data_cwfid, label=line_label_ours, color="orange")
|
88 |
+
axs[2].set_xlabel(xlabel_value)
|
89 |
+
axs[2].set_ylabel(ylabel_value_cwfid)
|
90 |
+
axs[2].set_xlim(*xlim_values)
|
91 |
+
axs[2].set_yticks(yticks_values_cwfid)
|
92 |
+
axs[2].tick_params(axis="both", which="both", color="gray")
|
93 |
+
|
94 |
+
# Plotting CAS
|
95 |
+
axs[3].plot(iterations, base_data_cas, label=line_label_base, color="blue")
|
96 |
+
axs[3].plot(iterations, ours_data_cas, label=line_label_ours, color="orange")
|
97 |
+
axs[3].set_xlabel(xlabel_value)
|
98 |
+
axs[3].set_ylabel(ylabel_value_cas)
|
99 |
+
axs[3].set_xlim(*xlim_values)
|
100 |
+
axs[3].set_yticks(yticks_values_cas)
|
101 |
+
axs[3].tick_params(axis="both", which="both", color="gray")
|
102 |
+
|
103 |
+
# Add legends and gridlines to each subplot
|
104 |
+
for ax in axs.flat:
|
105 |
+
ax.legend(loc=legend_location, bbox_to_anchor=legend_bbox_to_anchor, frameon=legend_frameon, ncol=legend_ncol)
|
106 |
+
ax.grid(grid_value) # Enable the grid
|
107 |
+
|
108 |
+
# ===================
|
109 |
+
# Part 4: Saving Output
|
110 |
+
# ===================
|
111 |
+
# Adjust layout and save the plot
|
112 |
+
plt.tight_layout()
|
113 |
+
plt.savefig('line_13.pdf', bbox_inches='tight')
|
ChartMimic/dataset/ori_500/line_15.png
ADDED
![]() |
ChartMimic/dataset/ori_500/line_15.py
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np; np.random.seed(0)
|
6 |
+
|
7 |
+
import matplotlib.ticker as ticker
|
8 |
+
|
9 |
+
# ===================
|
10 |
+
# Part 2: Data Preparation
|
11 |
+
# ===================
|
12 |
+
# Sample data to mimic the trends in the provided image
|
13 |
+
tasks = np.arange(1, 21)
|
14 |
+
baCE = np.linspace(90, 60, 20) + np.random.normal(0, 3, 20)
|
15 |
+
lwf = np.linspace(75, 50, 20) + np.random.normal(0, 3, 20)
|
16 |
+
ewc = np.linspace(50, 30, 20) + np.random.normal(0, 3, 20)
|
17 |
+
seq = np.linspace(20, 15, 20) + np.random.normal(0, 1, 20)
|
18 |
+
|
19 |
+
# Axes Limits and Labels
|
20 |
+
xlabel_value = "Task"
|
21 |
+
xlim_values = [0.5, 20.5]
|
22 |
+
xticks_values = np.arange(1, 21, 1)
|
23 |
+
|
24 |
+
ylabel_value = "Average Accuracy (%)"
|
25 |
+
ylim_values = [0, 100]
|
26 |
+
yticks_values = np.arange(0, 101, 10)
|
27 |
+
|
28 |
+
# Labels
|
29 |
+
label_BaCE = "BaCE"
|
30 |
+
label_LWF = "LWF"
|
31 |
+
label_EWC = "EWC"
|
32 |
+
label_SEQ = "SEQ"
|
33 |
+
|
34 |
+
# ===================
|
35 |
+
# Part 3: Plot Configuration and Rendering
|
36 |
+
# ===================
|
37 |
+
# Plotting the data
|
38 |
+
plt.figure(figsize=(8, 6))
|
39 |
+
plt.plot(
|
40 |
+
tasks,
|
41 |
+
baCE,
|
42 |
+
marker="s",
|
43 |
+
markersize=7,
|
44 |
+
color="#393b79",
|
45 |
+
mfc="w",
|
46 |
+
mew=2,
|
47 |
+
label=label_BaCE,
|
48 |
+
linewidth=2,
|
49 |
+
)
|
50 |
+
plt.plot(
|
51 |
+
tasks,
|
52 |
+
lwf,
|
53 |
+
marker="v",
|
54 |
+
markersize=7,
|
55 |
+
color="#e7969c",
|
56 |
+
mfc="w",
|
57 |
+
mew=2,
|
58 |
+
label=label_LWF,
|
59 |
+
linewidth=2,
|
60 |
+
)
|
61 |
+
plt.plot(
|
62 |
+
tasks,
|
63 |
+
ewc,
|
64 |
+
marker="D",
|
65 |
+
markersize=7,
|
66 |
+
color="#a55194",
|
67 |
+
mfc="w",
|
68 |
+
mew=2,
|
69 |
+
label=label_EWC,
|
70 |
+
linewidth=2,
|
71 |
+
)
|
72 |
+
plt.plot(
|
73 |
+
tasks,
|
74 |
+
seq,
|
75 |
+
marker="o",
|
76 |
+
markersize=4,
|
77 |
+
color="#de9ed6",
|
78 |
+
mfc="w",
|
79 |
+
mew=2,
|
80 |
+
label=label_SEQ,
|
81 |
+
linewidth=2,
|
82 |
+
) # Adjusted color for SEQ
|
83 |
+
|
84 |
+
# Set y-axis to only display specific ticks and extend y-axis to leave space at top
|
85 |
+
plt.yticks(yticks_values)
|
86 |
+
plt.ylim(ylim_values) # Adjusted y-axis limit
|
87 |
+
|
88 |
+
# Setting x-axis ticks
|
89 |
+
plt.xticks(xticks_values) # Ticks from 1 to 20, interval of 1
|
90 |
+
plt.xlim(xlim_values) # Slightly beyond 1 and 20 for a margin
|
91 |
+
|
92 |
+
# Adding labels and title
|
93 |
+
plt.xlabel(xlabel_value, fontsize=16)
|
94 |
+
plt.ylabel(ylabel_value, fontsize=16)
|
95 |
+
|
96 |
+
# Adding legend with a different style and position
|
97 |
+
plt.legend(frameon=True, fontsize=11, loc="upper right")
|
98 |
+
|
99 |
+
# Adding gridlines
|
100 |
+
plt.grid(True, linestyle="-", linewidth=0.5, axis="y", alpha=1)
|
101 |
+
|
102 |
+
# Adjusting tick label size
|
103 |
+
plt.xticks(fontsize=12)
|
104 |
+
plt.yticks(fontsize=12)
|
105 |
+
|
106 |
+
# ===================
|
107 |
+
# Part 4: Saving Output
|
108 |
+
# ===================
|
109 |
+
# Adjusting layout to reduce white space
|
110 |
+
plt.tight_layout()
|
111 |
+
plt.savefig('line_15.pdf', bbox_inches='tight')
|
ChartMimic/dataset/ori_500/line_16.png
ADDED
![]() |
ChartMimic/dataset/ori_500/line_16.py
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
import numpy as np; np.random.seed(0)
|
7 |
+
|
8 |
+
# ===================
|
9 |
+
# Part 2: Data Preparation
|
10 |
+
# ===================
|
11 |
+
# Data for plotting
|
12 |
+
uncertainty_threshold = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]
|
13 |
+
oesense_accuracy = [1.00, 0.97, 0.96, 0.97, 0.98, 0.96]
|
14 |
+
kws_accuracy = [0.97, 0.95, 0.93, 0.92, 0.94, 0.95]
|
15 |
+
ecg5000_accuracy = [0.96, 0.94, 0.92, 0.90, 0.88, 0.86]
|
16 |
+
|
17 |
+
# Extracted variables
|
18 |
+
oesense_label = "Oesense"
|
19 |
+
kws_label = "KWS"
|
20 |
+
ecg5000_label = "ECG5000"
|
21 |
+
|
22 |
+
ylim_values = [0.84, 1.02]
|
23 |
+
yticks_values = [0.84, 0.87, 0.9, 0.93, 0.96, 0.99, 1.02]
|
24 |
+
yticks_labels = ["$0.84$", "$0.87$", "$0.9$", "$0.93$", "$0.96$", "$0.99$", "$1.02$"]
|
25 |
+
xlabel_value = "Uncertainty threshold"
|
26 |
+
ylabel_value = "Accuracy"
|
27 |
+
xlim_values = [0, 1]
|
28 |
+
xticks_fontsize = "16"
|
29 |
+
yticks_fontsize = "16"
|
30 |
+
xlabel_fontsize = "14"
|
31 |
+
ylabel_fontsize = "14"
|
32 |
+
legend_location = "lower left"
|
33 |
+
legend_ncol = 3
|
34 |
+
legend_bbox_to_anchor = (0, -0.2)
|
35 |
+
legend_frameon = False
|
36 |
+
|
37 |
+
# ===================
|
38 |
+
# Part 3: Plot Configuration and Rendering
|
39 |
+
# ===================
|
40 |
+
# Create figure and axis
|
41 |
+
fig, ax = plt.subplots(figsize=(8, 6))
|
42 |
+
|
43 |
+
# Plot the data
|
44 |
+
ax.plot(uncertainty_threshold, oesense_accuracy, "o-", label=oesense_label, clip_on=False, zorder=10, color="blue", linewidth=1.6, markersize=12)
|
45 |
+
ax.plot(uncertainty_threshold, kws_accuracy, "d-", label=kws_label, clip_on=False, zorder=10, color="red", linewidth=1.6, markersize=12)
|
46 |
+
ax.plot(uncertainty_threshold, ecg5000_accuracy, "^-", label=ecg5000_label, clip_on=False, zorder=10, color="green", linewidth=1.6, markersize=12)
|
47 |
+
|
48 |
+
plt.ylim(ylim_values)
|
49 |
+
plt.yticks(yticks_values, yticks_labels, fontsize=yticks_fontsize)
|
50 |
+
|
51 |
+
# Set x-axis to only display specific ticks and extend x-axis to leave space at right
|
52 |
+
plt.xticks(fontsize=xticks_fontsize)
|
53 |
+
plt.xlim(xlim_values)
|
54 |
+
plt.tick_params(axis="both", which="both", color="gray")
|
55 |
+
|
56 |
+
# Add legend, labels, and grid
|
57 |
+
ax.legend(loc=legend_location, ncol=legend_ncol, bbox_to_anchor=legend_bbox_to_anchor, frameon=legend_frameon)
|
58 |
+
ax.set_xlabel(xlabel_value, fontsize=xlabel_fontsize)
|
59 |
+
ax.set_ylabel(ylabel_value, fontsize=ylabel_fontsize)
|
60 |
+
ax.grid(True)
|
61 |
+
|
62 |
+
# ===================
|
63 |
+
# Part 4: Saving Output
|
64 |
+
# ===================
|
65 |
+
# Adjusting layout to add more space on the right
|
66 |
+
plt.tight_layout()
|
67 |
+
plt.savefig('line_16.pdf', bbox_inches='tight')
|
ChartMimic/dataset/ori_500/line_17.png
ADDED
![]() |
ChartMimic/dataset/ori_500/line_17.py
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np; np.random.seed(0)
|
6 |
+
|
7 |
+
|
8 |
+
# ===================
|
9 |
+
# Part 2: Data Preparation
|
10 |
+
# ===================
|
11 |
+
# Data for plotting
|
12 |
+
parameters = np.array([10, 30, 50, 70, 90, 110])
|
13 |
+
kl_divergence = np.array([0.03, 0.04, 0.015, 0.006, 0.0025, 0.001])
|
14 |
+
|
15 |
+
# Axes Limits and Labels
|
16 |
+
xlabel_value = "Number of Parameters"
|
17 |
+
xlim_values = [0, 125]
|
18 |
+
xticks_values = np.arange(0, 121, 20)
|
19 |
+
|
20 |
+
ylabel_value = "Log KL Divergence"
|
21 |
+
ylim_values = [10**-5, 10**-1]
|
22 |
+
yticks_values = [10**-5, 10**-4, 10**-3, 10**-2, 10**-1]
|
23 |
+
yticklabels = ["$10^{-5}$", "$10^{-4}$", "$10^{-3}$", "$10^{-2}$", "$10^{-1}$"]
|
24 |
+
|
25 |
+
# ===================
|
26 |
+
# Part 3: Plot Configuration and Rendering
|
27 |
+
# ===================
|
28 |
+
# Create the plot
|
29 |
+
fig, ax = plt.subplots(figsize=(6, 4)) # Use subplots to get access to the axis object
|
30 |
+
ax.plot(parameters, kl_divergence, marker="o", linestyle="-", color="#1f77b4")
|
31 |
+
|
32 |
+
# Set the scale of the y-axis to logarithmic
|
33 |
+
ax.set_yscale("log")
|
34 |
+
|
35 |
+
# Set y-axis to only display specific ticks and extend y-axis to leave space at top
|
36 |
+
ax.set_yticks(yticks_values)
|
37 |
+
ax.set_yticklabels(yticklabels)
|
38 |
+
ax.set_ylim(ylim_values) # Set limits to include a small margin
|
39 |
+
|
40 |
+
# Remove minor ticks
|
41 |
+
ax.tick_params(axis="y", which="minor", left=False)
|
42 |
+
|
43 |
+
# Setting x-axis ticks
|
44 |
+
ax.set_xticks(xticks_values) # Set x-ticks to be every 20
|
45 |
+
ax.set_xlim(xlim_values) # Set limits to include a small margin
|
46 |
+
|
47 |
+
# Adjusting tick label size
|
48 |
+
plt.xticks(fontsize=10, fontweight="100")
|
49 |
+
plt.yticks(fontsize=10, fontweight="100")
|
50 |
+
|
51 |
+
# Remove tick lines outside the plotting area
|
52 |
+
ax.tick_params(
|
53 |
+
axis="both", which="both", length=0, color="#d2d2d2"
|
54 |
+
) # Remove tick marks and set their color
|
55 |
+
|
56 |
+
# Set labels and title
|
57 |
+
ax.set_xlabel(xlabel_value, fontsize=14)
|
58 |
+
ax.set_ylabel(ylabel_value, fontsize=14)
|
59 |
+
|
60 |
+
# Show grid with lighter color and only major lines
|
61 |
+
ax.grid(True, which="major", color="lightgrey", linestyle="-", linewidth=0.5)
|
62 |
+
|
63 |
+
# Change the axis colors
|
64 |
+
ax.spines["bottom"].set_color("#d2d2d2")
|
65 |
+
ax.spines["top"].set_color("#d2d2d2") # Optional: hide or set color
|
66 |
+
ax.spines["left"].set_color("#d2d2d2")
|
67 |
+
ax.spines["right"].set_color("#d2d2d2") # Optional: hide or set color
|
68 |
+
|
69 |
+
# ===================
|
70 |
+
# Part 4: Saving Output
|
71 |
+
# ===================
|
72 |
+
# Adjusting layout to add more space on the right
|
73 |
+
plt.tight_layout()
|
74 |
+
plt.savefig('line_17.pdf', bbox_inches='tight')
|
ChartMimic/dataset/ori_500/line_18.png
ADDED
![]() |
ChartMimic/dataset/ori_500/line_18.py
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np; np.random.seed(0)
|
6 |
+
|
7 |
+
|
8 |
+
# ===================
|
9 |
+
# Part 2: Data Preparation
|
10 |
+
# ===================
|
11 |
+
# Sample data
|
12 |
+
iterations = np.array([0, 250, 500, 750, 1000, 1250, 1500, 1750, 2000])
|
13 |
+
gpt4_7b = np.array([0.1, 0.4, 0.7, 0.85, 0.9, 0.92, 0.93, 0.94, 0.95])
|
14 |
+
gpt4_7b_ft = np.array([0.05, 0.2, 0.35, 0.5, 0.6, 0.65, 0.7, 0.72, 0.73])
|
15 |
+
llama_7b = np.array([0.1, 0.45, 0.75, 0.88, 0.9, 0.91, 0.92, 0.93, 0.94])
|
16 |
+
llama_7b_ft = np.array([0.05, 0.25, 0.4, 0.55, 0.65, 0.7, 0.75, 0.77, 0.78])
|
17 |
+
|
18 |
+
# Axes Limits and Labels
|
19 |
+
xlabel_value = "Iterations"
|
20 |
+
ylabel_value = "Attack Success Rate"
|
21 |
+
|
22 |
+
# Labels
|
23 |
+
label_1 = "7B"
|
24 |
+
label_2 = "7B (Fine-tuned)"
|
25 |
+
|
26 |
+
# Titles
|
27 |
+
title_1 = "GPT-4 Evaluation"
|
28 |
+
title_2 = "Llama Guard Evaluation"
|
29 |
+
|
30 |
+
|
31 |
+
# ===================
|
32 |
+
# Part 3: Plot Configuration and Rendering
|
33 |
+
# ===================
|
34 |
+
# Set the figure size to match the original image's dimensions
|
35 |
+
plt.figure(figsize=(9, 4))
|
36 |
+
|
37 |
+
# First subplot
|
38 |
+
plt.subplot(1, 2, 1)
|
39 |
+
plt.plot(
|
40 |
+
iterations,
|
41 |
+
gpt4_7b,
|
42 |
+
marker="o",
|
43 |
+
color="#0a6ae1",
|
44 |
+
label=label_1,
|
45 |
+
markerfacecolor="#0a6ae1",
|
46 |
+
linewidth=2,
|
47 |
+
markersize=5,
|
48 |
+
)
|
49 |
+
plt.plot(
|
50 |
+
iterations,
|
51 |
+
gpt4_7b_ft,
|
52 |
+
marker="o",
|
53 |
+
color="#d75faa",
|
54 |
+
label=label_2,
|
55 |
+
markerfacecolor="#d75faa",
|
56 |
+
linewidth=2,
|
57 |
+
markersize=5,
|
58 |
+
)
|
59 |
+
plt.fill_between(iterations, gpt4_7b - 0.05, gpt4_7b + 0.05, color="#0a6ae1", alpha=0.2)
|
60 |
+
plt.fill_between(
|
61 |
+
iterations, gpt4_7b_ft - 0.03, gpt4_7b_ft + 0.03, color="#d75faa", alpha=0.2
|
62 |
+
)
|
63 |
+
plt.title(title_1, fontsize=14)
|
64 |
+
plt.xlabel(xlabel_value, fontsize=12)
|
65 |
+
plt.ylabel(ylabel_value, fontsize=12)
|
66 |
+
|
67 |
+
# Second subplot
|
68 |
+
plt.subplot(1, 2, 2)
|
69 |
+
plt.plot(
|
70 |
+
iterations,
|
71 |
+
llama_7b,
|
72 |
+
marker="o",
|
73 |
+
color="#0a6ae1",
|
74 |
+
label=label_1,
|
75 |
+
markerfacecolor="#0a6ae1",
|
76 |
+
linewidth=2,
|
77 |
+
markersize=5,
|
78 |
+
)
|
79 |
+
plt.plot(
|
80 |
+
iterations,
|
81 |
+
llama_7b_ft,
|
82 |
+
marker="o",
|
83 |
+
color="#d75faa",
|
84 |
+
label=label_2,
|
85 |
+
markerfacecolor="#d75faa",
|
86 |
+
linewidth=2,
|
87 |
+
markersize=5,
|
88 |
+
)
|
89 |
+
plt.fill_between(
|
90 |
+
iterations, llama_7b - 0.05, llama_7b + 0.05, color="#0a6ae1", alpha=0.2
|
91 |
+
)
|
92 |
+
plt.fill_between(
|
93 |
+
iterations, llama_7b_ft - 0.03, llama_7b_ft + 0.03, color="#d75faa", alpha=0.2
|
94 |
+
)
|
95 |
+
plt.title(title_2, fontsize=14)
|
96 |
+
plt.xlabel(xlabel_value, fontsize=12)
|
97 |
+
plt.ylabel(ylabel_value, fontsize=12)
|
98 |
+
plt.legend(loc="lower right", frameon=True, bbox_to_anchor=(1, 0.1))
|
99 |
+
|
100 |
+
# ===================
|
101 |
+
# Part 4: Saving Output
|
102 |
+
# ===================
|
103 |
+
# Adjust layout and save plot
|
104 |
+
plt.tight_layout()
|
105 |
+
plt.savefig('line_18.pdf', bbox_inches='tight')
|
ChartMimic/dataset/ori_500/line_19.png
ADDED
![]() |
ChartMimic/dataset/ori_500/line_19.py
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np; np.random.seed(0)
|
6 |
+
|
7 |
+
|
8 |
+
# ===================
|
9 |
+
# Part 2: Data Preparation
|
10 |
+
# ===================
|
11 |
+
# Data for plotting
|
12 |
+
fraction_of_training_data = np.array([0.01, 0.1, 1])
|
13 |
+
full_accuracy = np.array([60, 70, 80])
|
14 |
+
spt_accuracy = np.array([55, 65, 78])
|
15 |
+
vpt_accuracy = np.array([42, 53, 65])
|
16 |
+
|
17 |
+
# Axes Limits and Labels
|
18 |
+
xlabel_value = "fraction of training data (log scale)"
|
19 |
+
xlim_values = [5, 25]
|
20 |
+
|
21 |
+
ylabel_value = "test accuracy (%)"
|
22 |
+
ylim_values = [38, 84]
|
23 |
+
yticks_values = np.arange(40, 82, 10)
|
24 |
+
|
25 |
+
# Labels
|
26 |
+
label_Full = "Full"
|
27 |
+
label_SPT = "SPT"
|
28 |
+
label_VPT = "VPT"
|
29 |
+
|
30 |
+
# ===================
|
31 |
+
# Part 3: Plot Configuration and Rendering
|
32 |
+
# ===================
|
33 |
+
# Plotting the data
|
34 |
+
plt.figure(figsize=(5, 4)) # Adjusting figure size to match original image dimensions
|
35 |
+
plt.plot(fraction_of_training_data, full_accuracy, "o-", color="green", label=label_Full)
|
36 |
+
plt.plot(fraction_of_training_data, spt_accuracy, "o-", color="red", label=label_SPT)
|
37 |
+
plt.plot(fraction_of_training_data, vpt_accuracy, "o-", color="blue", label=label_VPT)
|
38 |
+
|
39 |
+
# Set y-axis to only display specific ticks and extend y-axis to leave space at top
|
40 |
+
plt.yticks(yticks_values, fontsize=16)
|
41 |
+
plt.ylim(ylim_values) # Adjusted y-axis limit
|
42 |
+
|
43 |
+
# Set x-axis fontsize
|
44 |
+
plt.xticks(fontsize=16)
|
45 |
+
|
46 |
+
# Setting the x-axis to log scale
|
47 |
+
plt.xscale("log")
|
48 |
+
|
49 |
+
# Adding labels and title
|
50 |
+
plt.xlabel(xlabel_value, fontsize=16)
|
51 |
+
plt.ylabel(ylabel_value, fontsize=16)
|
52 |
+
|
53 |
+
# Adding grid
|
54 |
+
plt.grid(True, which="both", ls="-", linewidth=0.8)
|
55 |
+
|
56 |
+
# Adding legend, show it horizontally and place it at the lower right corner
|
57 |
+
plt.legend(loc="lower right", fontsize=12, ncol=3, columnspacing=0.5, edgecolor="black")
|
58 |
+
|
59 |
+
# ===================
|
60 |
+
# Part 4: Saving Output
|
61 |
+
# ===================
|
62 |
+
# Adjusting layout to add more space on the right
|
63 |
+
plt.tight_layout()
|
64 |
+
plt.savefig('line_19.pdf', bbox_inches='tight')
|
ChartMimic/dataset/ori_500/line_2.png
ADDED
![]() |
ChartMimic/dataset/ori_500/line_2.py
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ===================
|
2 |
+
# Part 1: Importing Libraries
|
3 |
+
# ===================
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np; np.random.seed(0)
|
6 |
+
|
7 |
+
|
8 |
+
# ===================
|
9 |
+
# Part 2: Data Preparation
|
10 |
+
# ===================
|
11 |
+
gradient_steps = [0, 50, 100, 150, 200] # 10 data points from 0 to 200
|
12 |
+
line1_values = [0.1, 0.8, 1.2, 1.5, 1.3] # Random values for line 1
|
13 |
+
line2_values = [1.0, 0.5, 0.8, 1.0, 1.8] # Random values for line 2
|
14 |
+
line3_values = [1.8, 1.2, 0.5, 0.4, 0.3] # Random values for line 3
|
15 |
+
|
16 |
+
# Simulating standard deviations for error
|
17 |
+
line1_std = np.random.rand(5) * 0.2
|
18 |
+
line2_std = np.random.rand(5) * 0.2
|
19 |
+
line3_std = np.random.rand(5) * 0.2
|
20 |
+
|
21 |
+
# Labels
|
22 |
+
label_Line_1 = "Line 1"
|
23 |
+
label_Line_2 = "Line 2"
|
24 |
+
label_Line_3 = "Line 3"
|
25 |
+
|
26 |
+
# Axes Limits and Labels
|
27 |
+
xlabel_value = "Gradient Steps (x 62.5K)"
|
28 |
+
yticks_values = np.arange(0, 2.1, 0.5)
|
29 |
+
|
30 |
+
# ===================
|
31 |
+
# Part 3: Plot Configuration and Rendering
|
32 |
+
# ===================
|
33 |
+
# Plotting the lines with error bands
|
34 |
+
plt.figure(figsize=(4, 3))
|
35 |
+
plt.plot(gradient_steps, line1_values, "o-", color="orange", label=label_Line_1)
|
36 |
+
plt.fill_between(
|
37 |
+
gradient_steps,
|
38 |
+
line1_values - line1_std,
|
39 |
+
line1_values + line1_std,
|
40 |
+
color="orange",
|
41 |
+
alpha=0.2,
|
42 |
+
)
|
43 |
+
|
44 |
+
plt.plot(gradient_steps, line2_values, "o-", color="blue", label=label_Line_2)
|
45 |
+
plt.fill_between(
|
46 |
+
gradient_steps,
|
47 |
+
line2_values - line2_std,
|
48 |
+
line2_values + line2_std,
|
49 |
+
color="blue",
|
50 |
+
alpha=0.2,
|
51 |
+
)
|
52 |
+
|
53 |
+
plt.plot(gradient_steps, line3_values, "o-", color="green", label=label_Line_3)
|
54 |
+
plt.fill_between(
|
55 |
+
gradient_steps,
|
56 |
+
line3_values - line3_std,
|
57 |
+
line3_values + line3_std,
|
58 |
+
color="green",
|
59 |
+
alpha=0.2,
|
60 |
+
)
|
61 |
+
|
62 |
+
# x labels
|
63 |
+
plt.xlabel(xlabel_value)
|
64 |
+
plt.xticks(gradient_steps)
|
65 |
+
plt.yticks(yticks_values)
|
66 |
+
|
67 |
+
# Moving axes spines
|
68 |
+
ax = plt.gca() # get current axes
|
69 |
+
ax.spines["left"].set_position(("outward", 10)) # move left y-axis outwards
|
70 |
+
ax.spines["bottom"].set_position(("outward", 10)) # move bottom x-axis outwards
|
71 |
+
ax.spines["right"].set_color("none") # hide the right spine
|
72 |
+
ax.spines["top"].set_color("none") # hide the top spine
|
73 |
+
ax.grid(
|
74 |
+
True, which="both", axis="both", color="lightgray", linestyle="--", linewidth=0.5
|
75 |
+
)
|
76 |
+
|
77 |
+
# ===================
|
78 |
+
# Part 4: Saving Output
|
79 |
+
# ===================
|
80 |
+
# Show the plot
|
81 |
+
plt.tight_layout()
|
82 |
+
plt.savefig('line_2.pdf', bbox_inches='tight')
|