merterm commited on
Commit
19126f6
·
verified ·
1 Parent(s): 2703cee

Upload 44 files

Browse files
Files changed (44) hide show
  1. ChartMimic/dataset/ori_500/bar_40.png +0 -0
  2. ChartMimic/dataset/ori_500/bar_40.py +80 -0
  3. ChartMimic/dataset/ori_500/bar_44.png +0 -0
  4. ChartMimic/dataset/ori_500/bar_44.py +78 -0
  5. ChartMimic/dataset/ori_500/bar_45.png +0 -0
  6. ChartMimic/dataset/ori_500/bar_45.py +99 -0
  7. ChartMimic/dataset/ori_500/bar_46.png +0 -0
  8. ChartMimic/dataset/ori_500/bar_46.py +48 -0
  9. ChartMimic/dataset/ori_500/bar_48.png +0 -0
  10. ChartMimic/dataset/ori_500/bar_48.py +92 -0
  11. ChartMimic/dataset/ori_500/bar_51.png +0 -0
  12. ChartMimic/dataset/ori_500/bar_51.py +50 -0
  13. ChartMimic/dataset/ori_500/bar_53.png +0 -0
  14. ChartMimic/dataset/ori_500/bar_53.py +126 -0
  15. ChartMimic/dataset/ori_500/bar_54.png +0 -0
  16. ChartMimic/dataset/ori_500/bar_54.py +45 -0
  17. ChartMimic/dataset/ori_500/bar_55.png +0 -0
  18. ChartMimic/dataset/ori_500/bar_55.py +51 -0
  19. ChartMimic/dataset/ori_500/bar_56.png +0 -0
  20. ChartMimic/dataset/ori_500/bar_56.py +75 -0
  21. ChartMimic/dataset/ori_500/bar_57.png +0 -0
  22. ChartMimic/dataset/ori_500/bar_57.py +81 -0
  23. ChartMimic/dataset/ori_500/bar_60.png +0 -0
  24. ChartMimic/dataset/ori_500/bar_60.py +58 -0
  25. ChartMimic/dataset/ori_500/bar_61.png +0 -0
  26. ChartMimic/dataset/ori_500/bar_61.py +77 -0
  27. ChartMimic/dataset/ori_500/bar_63.png +0 -0
  28. ChartMimic/dataset/ori_500/bar_63.py +85 -0
  29. ChartMimic/dataset/ori_500/bar_64.png +0 -0
  30. ChartMimic/dataset/ori_500/bar_64.py +89 -0
  31. ChartMimic/dataset/ori_500/bar_65.png +0 -0
  32. ChartMimic/dataset/ori_500/bar_65.py +128 -0
  33. ChartMimic/dataset/ori_500/bar_67.png +0 -0
  34. ChartMimic/dataset/ori_500/bar_67.py +81 -0
  35. ChartMimic/dataset/ori_500/bar_68.png +0 -0
  36. ChartMimic/dataset/ori_500/bar_68.py +75 -0
  37. ChartMimic/dataset/ori_500/bar_72.png +0 -0
  38. ChartMimic/dataset/ori_500/bar_72.py +78 -0
  39. ChartMimic/dataset/ori_500/bar_73.png +0 -0
  40. ChartMimic/dataset/ori_500/bar_73.py +84 -0
  41. ChartMimic/dataset/ori_500/bar_76.png +0 -0
  42. ChartMimic/dataset/ori_500/bar_76.py +65 -0
  43. ChartMimic/dataset/ori_500/bar_77.png +0 -0
  44. ChartMimic/dataset/ori_500/bar_77.py +28 -0
ChartMimic/dataset/ori_500/bar_40.png ADDED
ChartMimic/dataset/ori_500/bar_40.py ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "Parameter",
12
+ "Method Declaration",
13
+ "Variable Declaration",
14
+ "Conditional Statement",
15
+ "Loop",
16
+ "Conditional Block",
17
+ "Argument",
18
+ "External Class",
19
+ "Variable",
20
+ "Return",
21
+ "External Variable/Method",
22
+ "Method Call",
23
+ "Exception Handling",
24
+ "Operation",
25
+ "Comment",
26
+ "Operator",
27
+ "Assignment",
28
+ "Literal",
29
+ ]
30
+ differences = [
31
+ -5,
32
+ 10,
33
+ -20,
34
+ -10,
35
+ 10,
36
+ 20,
37
+ 30,
38
+ -30,
39
+ -40,
40
+ 60,
41
+ 70,
42
+ 80,
43
+ 80,
44
+ 100,
45
+ 130,
46
+ 160,
47
+ 160,
48
+ 180,
49
+ ]
50
+ colors = ["#d1605e" if x < 0 else "#85b6b2" for x in differences]
51
+
52
+ title = "Relative Difference in Machine vs. Human Focus on Semantic Categories"
53
+ xlabel = "Difference (%)"
54
+ ylabel = "Semantic Category"
55
+ xlim = [-50, 200]
56
+ xticks = range(-50, 201, 50)
57
+
58
+ # ===================
59
+ # Part 3: Plot Configuration and Rendering
60
+ # ===================
61
+ # Create figure and plot
62
+ fig, ax = plt.subplots(figsize=(10, 5))
63
+ ax.barh(categories, differences, color=colors)
64
+
65
+ # Set title and labels
66
+ ax.set_title(title)
67
+ ax.set_xlabel(xlabel)
68
+ ax.set_ylabel(ylabel)
69
+
70
+ # Set x-axis limits and labels
71
+ ax.set_xlim(xlim)
72
+ ax.set_xticks(xticks)
73
+ ax.xaxis.grid(True)
74
+
75
+ # ===================
76
+ # Part 4: Saving Output
77
+ # ===================
78
+ # Save the plot with tight layout to minimize white space
79
+ plt.tight_layout()
80
+ plt.savefig("bar_40.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_44.png ADDED
ChartMimic/dataset/ori_500/bar_44.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Placeholder data
14
+ categories = [
15
+ "AFAN",
16
+ "AFBE",
17
+ "AFCE",
18
+ "AFEO",
19
+ "AFEX",
20
+ "AFIG",
21
+ "AFPK",
22
+ "AFPO",
23
+ "AFPP",
24
+ "AFPR",
25
+ "AFRL",
26
+ "AFSC",
27
+ "AFSI",
28
+ "AFTH",
29
+ "AFVC",
30
+ "AFWS",
31
+ "AFWT",
32
+ "DAH",
33
+ "IC",
34
+ "SS",
35
+ ]
36
+ gpt_3_5_turbo_values = np.random.randint(5, 30, size=len(categories))
37
+ gpt_4_values = np.random.randint(5, 20, size=len(categories))
38
+
39
+ # Bar width
40
+ bar_width = 0.6
41
+
42
+ # Positions of the bars on the x-axis
43
+ r = np.arange(len(categories))
44
+
45
+ labels = ["GPT-3.5-Turbo", "GPT-4"]
46
+ xlabel = "Categories"
47
+ ylabel = "Non-valid NLAs"
48
+
49
+ # ===================
50
+ # Part 3: Plot Configuration and Rendering
51
+ # ===================
52
+ # Create the figure and the axes
53
+ fig, ax = plt.subplots(figsize=(8, 6))
54
+
55
+ # Plot the bars
56
+ ax.bar(
57
+ r,
58
+ gpt_3_5_turbo_values,
59
+ bottom=gpt_4_values,
60
+ color="blue",
61
+ width=bar_width,
62
+ label=labels[0],
63
+ )
64
+ ax.bar(r, gpt_4_values, color="orange", width=bar_width, label=labels[1])
65
+
66
+ # Add labels, title, and legend
67
+ ax.set_xlabel(xlabel)
68
+ ax.set_ylabel(ylabel)
69
+ ax.set_xticks(r)
70
+ ax.set_xticklabels(categories, rotation=45, ha="right")
71
+ ax.legend(loc="upper left")
72
+
73
+ # ===================
74
+ # Part 4: Saving Output
75
+ # ===================
76
+ # Show the plot with tight layout
77
+ plt.tight_layout()
78
+ plt.savefig("bar_44.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_45.png ADDED
ChartMimic/dataset/ori_500/bar_45.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Part 2: Data Preparation
11
+ # ===================
12
+ # Data
13
+ constraint_words = [3, 5, 7, 10]
14
+ LLAMA_Default = [-1, -1.5, -2, -3]
15
+ LLAMA_HAG = [-0.5, -1, -1.5, -2.5]
16
+ Vicuna_Default = [-1.5, -2, -2.5, -3.5]
17
+ Vicuna_HAG = [-1, -1.5, -2, -3]
18
+
19
+ # X-axis positions for each group
20
+ x = np.arange(len(constraint_words))
21
+
22
+ # Bar width
23
+ bar_width = 0.2
24
+
25
+ # Labels and Titles
26
+ ylabel = "Score"
27
+ xlabel = "Num of Constraint Words"
28
+ title = "Taboo"
29
+
30
+ # Legend labels
31
+ legend_labels = ["LLAMA-Default", "LLAMA-HAG", "Vicuna-Default", "Vicuna-HAG"]
32
+
33
+ # Colors
34
+ colors = ["#f1c5c1", "#dc7870", "#b9d0e5", "#8ab1d2"]
35
+
36
+ # Axis limits
37
+ ylim = (-3.5, 0)
38
+
39
+ # Axis tick labels
40
+ xticks = x
41
+ xticklabels = constraint_words
42
+
43
+ # ===================
44
+ # Part 3: Plot Configuration and Rendering
45
+ # ===================
46
+ # Figure and axis
47
+ fig, ax = plt.subplots(figsize=(10, 7))
48
+
49
+ # Plotting bars
50
+ ax.bar(
51
+ x - bar_width * 1.5,
52
+ LLAMA_Default,
53
+ width=bar_width,
54
+ label=legend_labels[0],
55
+ color=colors[0],
56
+ )
57
+ ax.bar(
58
+ x - bar_width / 2,
59
+ LLAMA_HAG,
60
+ width=bar_width,
61
+ label=legend_labels[1],
62
+ color=colors[1],
63
+ )
64
+ ax.bar(
65
+ x + bar_width / 2,
66
+ Vicuna_Default,
67
+ width=bar_width,
68
+ label=legend_labels[2],
69
+ color=colors[2],
70
+ )
71
+ ax.bar(
72
+ x + bar_width * 1.5,
73
+ Vicuna_HAG,
74
+ width=bar_width,
75
+ label=legend_labels[3],
76
+ color=colors[3],
77
+ )
78
+
79
+ # Adding labels and title
80
+ ax.set_ylim(ylim)
81
+ ax.set_ylabel(ylabel)
82
+ ax.set_xlabel(xlabel)
83
+ ax.set_title(title)
84
+
85
+ # Adding x-axis tick labels
86
+ ax.set_xticks(xticks)
87
+ ax.set_xticklabels(xticklabels)
88
+
89
+ plt.tick_params(axis="both", which="both", length=0)
90
+
91
+ # Adding legend
92
+ ax.legend(loc="lower center", bbox_to_anchor=(0.5, -0.15), frameon=False, ncol=4)
93
+
94
+ # ===================
95
+ # Part 4: Saving Output
96
+ # ===================
97
+ # Displaying the plot with tight layout to minimize white space
98
+ plt.tight_layout()
99
+ plt.savefig("bar_45.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_46.png ADDED
ChartMimic/dataset/ori_500/bar_46.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===================
2
+ # Part 1: Importing Libraries
3
+ # ===================
4
+ import matplotlib.pyplot as plt
5
+
6
+ # ===================
7
+ # Part 2: Data Preparation
8
+ # ===================
9
+ # Data
10
+ models = ["Lavila", "Video-LLaMA", "BLIP1", "BLIP2", "LLaVA", "OSCaR", "GPT4V"]
11
+ percentages = [0.0, 0.71, 4.64, 4.64, 31.79, 73.93, 82.5]
12
+ title = "Human Study"
13
+ xlabel = "Model"
14
+ ylabel = "Percentage (%)"
15
+ ylim = [0, 90]
16
+
17
+ # ===================
18
+ # Part 3: Plot Configuration and Rendering
19
+ # ===================
20
+ # Create figure and bar chart
21
+ plt.figure(figsize=(10, 6))
22
+ bars = plt.bar(models, percentages, color="skyblue")
23
+
24
+ # Add percentage labels on top of each bar
25
+ for bar in bars:
26
+ yval = bar.get_height()
27
+ plt.text(
28
+ bar.get_x() + bar.get_width() / 2, yval, f"{yval}%", ha="center", va="bottom"
29
+ )
30
+
31
+ # Set chart title and labels
32
+ plt.title(title)
33
+ plt.xlabel(xlabel)
34
+ plt.ylabel(ylabel)
35
+
36
+ # Set y-axis range and gridlines
37
+ plt.ylim(0, 90)
38
+ plt.grid(axis="both", linestyle="--", alpha=0.7)
39
+
40
+ plt.gca().spines["top"].set_visible(False)
41
+ plt.gca().spines["right"].set_visible(False)
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("bar_46.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_48.png ADDED
ChartMimic/dataset/ori_500/bar_48.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Part 2: Data Preparation
11
+ # ===================
12
+ # Data
13
+ algorithms = ["GD", "GD w. SA", "ITFR w/o SA", "ITFR"]
14
+ accuracy_movielens = [0.355, 0.360, 0.365, 0.360]
15
+ unfairness_movielens = [0.10, 0.08, 0.06, 0.08]
16
+ accuracy_tenrec = [0.175, 0.180, 0.185, 0.180]
17
+ unfairness_tenrec = [0.125, 0.100, 0.075, 0.100]
18
+ colors = ["#736aa6", "#983530", "#f2bf42", "#5384ed"]
19
+ labels = ["Accuracy", "Unfairness"]
20
+
21
+ # X-axis positions
22
+ x = np.arange(len(algorithms))
23
+ indexs = [2, 4]
24
+
25
+ # Plot labels
26
+ movielens_title = "(a) Movielens"
27
+ tenrec_title = "(b) Tenrec"
28
+ ylabel_movielens = "NDCG@20"
29
+ ylabel_tenrec = "CV@20"
30
+ yticks_movielens = [0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40]
31
+ yticks_tenrec = [0, 0.02, 0.04, 0.06, 0.08, 0.10, 0.12, 0.14, 0.16, 0.18, 0.20]
32
+
33
+ # ===================
34
+ # Part 3: Plot Configuration and Rendering
35
+ # ===================
36
+ # Create subplots
37
+ fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(5, 6))
38
+
39
+ barwidth = 0.3
40
+ # Movielens subplot
41
+ for i in range(len(x)):
42
+ ax1.bar(
43
+ (i - 2) * 0.3 + indexs[0],
44
+ accuracy_movielens[i],
45
+ width=0.3,
46
+ label="Accuracy",
47
+ color=colors[i],
48
+ )
49
+ ax1.bar(
50
+ (i - 2) * 0.3 + indexs[1],
51
+ unfairness_movielens[i],
52
+ width=0.3,
53
+ label="Unfairness",
54
+ color=colors[i],
55
+ )
56
+ ax1.set_title(movielens_title)
57
+ ax1.set_xticks([index - 0.15 for index in indexs])
58
+ ax1.set_xticklabels(labels)
59
+ ax1.set_ylabel(ylabel_movielens)
60
+ ax1.set_yticks(yticks_movielens)
61
+ ax1.tick_params(axis="both", which="both", length=0)
62
+
63
+ # Tenrec subplot
64
+ for i in range(len(x)):
65
+ ax2.bar(
66
+ (i - 2) * 0.3 + indexs[0],
67
+ accuracy_tenrec[i],
68
+ width=0.3,
69
+ label="Accuracy",
70
+ color=colors[i],
71
+ )
72
+ ax2.bar(
73
+ (i - 2) * 0.3 + indexs[1],
74
+ unfairness_tenrec[i],
75
+ width=0.3,
76
+ label="Unfairness",
77
+ color=colors[i],
78
+ )
79
+ ax2.set_title(tenrec_title)
80
+ ax2.set_xticks([index - 0.15 for index in indexs])
81
+ ax2.set_xticklabels(labels)
82
+ ax2.set_ylabel(ylabel_tenrec)
83
+ ax2.set_yticks(yticks_tenrec)
84
+
85
+ ax2.tick_params(axis="both", which="both", length=0)
86
+
87
+ # ===================
88
+ # Part 4: Saving Output
89
+ # ===================
90
+ # Adjust layout and save the figure
91
+ plt.tight_layout()
92
+ plt.savefig("bar_48.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_51.png ADDED
ChartMimic/dataset/ori_500/bar_51.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===================
2
+ # Part 1: Importing Libraries
3
+ # ===================
4
+ import matplotlib.pyplot as plt
5
+
6
+ # ===================
7
+ # Part 2: Data Preparation
8
+ # ===================
9
+ # Data
10
+ professions = [
11
+ "Farmer",
12
+ "Scooter mechanic",
13
+ "Household management",
14
+ "Construction/Renovation",
15
+ "Gardening",
16
+ "Making Bricks",
17
+ "Carpenter",
18
+ "Baker",
19
+ "Crafting/knitting",
20
+ "Cleaning / laundry",
21
+ ]
22
+ number_of_videos = [2008, 2060, 2158, 2343, 2548, 2915, 3216, 3543, 4190, 5375]
23
+
24
+ # Axes Limits and Labels
25
+ xlabel_value = "Number of Videos"
26
+ title = "Number of Videos by Profession"
27
+
28
+ # ===================
29
+ # Part 3: Plot Configuration and Rendering
30
+ # ===================
31
+ # Create horizontal bar chart
32
+ plt.figure(figsize=(12, 8)) # Adjust figure size to match original image's dimensions
33
+ plt.barh(professions, number_of_videos, color="#685bc6") # Change bar color to purple
34
+ plt.xlabel(xlabel_value)
35
+ plt.title(title)
36
+
37
+ # Add data labels
38
+ for index, value in enumerate(number_of_videos):
39
+ plt.text(
40
+ value + 50, index, str(value), va="center", fontsize=10
41
+ ) # Adjust text position and font size
42
+
43
+ plt.yticks(rotation=45)
44
+
45
+ # ===================
46
+ # Part 4: Saving Output
47
+ # ===================
48
+ # Displaying the plot with tight layout to minimize white space
49
+ plt.tight_layout()
50
+ plt.savefig("bar_51.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_53.png ADDED
ChartMimic/dataset/ori_500/bar_53.py ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ words = [
15
+ "small",
16
+ "certain",
17
+ "little",
18
+ "fraction",
19
+ "limited",
20
+ "a",
21
+ "day",
22
+ "few",
23
+ "new",
24
+ "specific",
25
+ "substantial",
26
+ "tiny",
27
+ "very",
28
+ "single",
29
+ "slight",
30
+ "relatively",
31
+ "moderate",
32
+ "handful",
33
+ "low",
34
+ ]
35
+ human_distribution = [
36
+ 0.19,
37
+ 0.18,
38
+ 0.15,
39
+ 0.1,
40
+ 0.05,
41
+ 0.03,
42
+ 0.16,
43
+ 0.08,
44
+ 0.04,
45
+ 0.06,
46
+ 0.02,
47
+ 0.01,
48
+ 0.05,
49
+ 0.03,
50
+ 0.02,
51
+ 0.01,
52
+ 0.04,
53
+ 0.02,
54
+ 0.01,
55
+ ]
56
+ model_distribution = [
57
+ 0.1,
58
+ 0.08,
59
+ 0.06,
60
+ 0.04,
61
+ 0.02,
62
+ 0.14,
63
+ 0.12,
64
+ 0.1,
65
+ 0.08,
66
+ 0.06,
67
+ 0.04,
68
+ 0.02,
69
+ 0.01,
70
+ 0.03,
71
+ 0.02,
72
+ 0.01,
73
+ 0.03,
74
+ 0.02,
75
+ 0.01,
76
+ ]
77
+
78
+ x = np.arange(len(words)) # the label locations
79
+ labels = ["Human Distribution", "Model Distribution"]
80
+ ylabel = "Probability"
81
+ title = "Context: The human body can tolerate only a"
82
+ xlabel = "Word"
83
+
84
+ # ===================
85
+ # Part 3: Plot Configuration and Rendering
86
+ # ===================
87
+ fig, ax = plt.subplots(
88
+ figsize=(10, 8)
89
+ ) # Adjust the figure size to match the original image's dimensions
90
+
91
+ # Create the bars
92
+ for i in range(len(words)):
93
+ ax.bar(
94
+ x[i],
95
+ human_distribution[i],
96
+ color="#FFA07A",
97
+ label=labels[0] if i == 0 else "",
98
+ hatch="///",
99
+ edgecolor="black",
100
+ )
101
+ ax.bar(
102
+ x[i],
103
+ model_distribution[i],
104
+ bottom=human_distribution[i],
105
+ color="#87CEFA",
106
+ label=labels[1] if i == 0 else "",
107
+ alpha=0.5,
108
+ hatch="..",
109
+ edgecolor="black",
110
+ )
111
+
112
+ # Add some text for labels, title and custom x-axis tick labels, etc.
113
+ ax.set_ylabel(ylabel)
114
+ ax.set_title(title)
115
+ ax.set_xticks(x)
116
+ ax.set_xticklabels(words, rotation=90, ha="center")
117
+ ax.set_xlabel(xlabel)
118
+ ax.legend()
119
+
120
+ # ===================
121
+ # Part 4: Saving Output
122
+ # ===================
123
+ # Adjust layout
124
+ plt.tight_layout()
125
+
126
+ plt.savefig("bar_53.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_54.png ADDED
ChartMimic/dataset/ori_500/bar_54.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===================
2
+ # Part 1: Importing Libraries
3
+ # ===================
4
+ import matplotlib.pyplot as plt
5
+ import matplotlib.cm as cm
6
+ import numpy as np
7
+
8
+ np.random.seed(0)
9
+
10
+
11
+ # ===================
12
+ # Part 2: Data Preparation
13
+ # ===================
14
+ # Data
15
+ categories = ["Sedan", "SUV", "Truck", "Coupe", "Convertible"]
16
+ values = [15, 26, 20, 30, 17]
17
+ titles = "Probability of Improvement over VLM Image Encoder Baseline Returns"
18
+ xlabel = "Probability of Improvement"
19
+
20
+ # Create color map
21
+ colors = cm.viridis(np.linspace(0, 1, len(values)))
22
+
23
+ # ===================
24
+ # Part 3: Plot Configuration and Rendering
25
+ # ===================
26
+ # Create horizontal bar chart
27
+ plt.figure(figsize=(6, 2)) # Adjusting figure size to match original image dimensions
28
+ plt.barh(categories, values, color=colors)
29
+
30
+ # Adding title and labels
31
+ plt.title(titles)
32
+ plt.xlabel(xlabel)
33
+ xticks = []
34
+ xlabels = []
35
+ # Apply the xticks and labels
36
+ plt.xticks(xticks, xlabels)
37
+ for spine in plt.gca().spines.values():
38
+ spine.set_visible(False)
39
+
40
+ # ===================
41
+ # Part 4: Saving Output
42
+ # ===================
43
+ # Show plot with tight layout
44
+ plt.tight_layout()
45
+ plt.savefig("bar_54.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_55.png ADDED
ChartMimic/dataset/ori_500/bar_55.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===================
2
+ # Part 1: Importing Libraries
3
+ # ===================
4
+ import matplotlib.pyplot as plt
5
+
6
+ # ===================
7
+ # Part 2: Data Preparation
8
+ # ===================
9
+ # Emotion labels
10
+ emotions = [
11
+ "Amusement",
12
+ "Unbothered",
13
+ "Sadness",
14
+ "Pride",
15
+ "Nervousness",
16
+ "Annoyance",
17
+ "Gratitude",
18
+ "Relief",
19
+ "Joy",
20
+ "Disapproval",
21
+ ]
22
+
23
+ # Approximate frequency values based on the image
24
+ frequencies = [7.6, 7.0, 6.7, 6.6, 6.0, 6.0, 3.5, 3.5, 3.0, 2.1]
25
+ xlabel = "Frequency (%)"
26
+ ylabel = "Emotion"
27
+
28
+ # ===================
29
+ # Part 3: Plot Configuration and Rendering
30
+ # ===================
31
+ # Create horizontal bar chart
32
+ plt.figure(figsize=(8, 8)) # Adjust figure size
33
+ plt.barh(emotions, frequencies, color="lightcoral", edgecolor="gray")
34
+
35
+ # Adding data labels
36
+ for index, value in enumerate(frequencies):
37
+ plt.text(value, index, f" {value}%", va="center")
38
+ # Set labels and title
39
+ plt.xlabel(xlabel)
40
+ plt.ylabel(ylabel)
41
+ plt.gca().spines["top"].set_visible(False)
42
+ plt.gca().spines["right"].set_visible(False)
43
+ plt.gca().spines["bottom"].set_visible(False)
44
+ plt.gca().spines["left"].set_visible(False)
45
+
46
+ # ===================
47
+ # Part 4: Saving Output
48
+ # ===================
49
+ # Show the plot with tight layout to minimize white space
50
+ plt.tight_layout()
51
+ plt.savefig("bar_55.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_56.png ADDED
ChartMimic/dataset/ori_500/bar_56.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===================
2
+ # Part 1: Importing Libraries
3
+ # ===================
4
+ import matplotlib.pyplot as plt
5
+ import matplotlib.colors as mcolors
6
+ import matplotlib.ticker as ticker
7
+ import numpy as np
8
+
9
+ np.random.seed(0)
10
+
11
+ # ===================
12
+ # Part 2: Data Preparation
13
+ # ===================
14
+ # Data
15
+ professions = [
16
+ "Cleaning / laundry",
17
+ "Crafting/knitting",
18
+ "Baker",
19
+ "Carpenter",
20
+ "Making Bricks",
21
+ "Gardening",
22
+ ]
23
+ number_of_videos = [8062.5, 6285.0, 5314.5, 4824.0, 4372.5, 3822.0]
24
+ colors = [
25
+ "lightskyblue",
26
+ "turquoise",
27
+ "lightgreen",
28
+ "navajowhite",
29
+ "lightsalmon",
30
+ "lightcoral",
31
+ ]
32
+
33
+ # Plot Configuration
34
+ xlabel = "Number of Videos"
35
+ xlim_values = (0, 9000)
36
+ ylim_values = (-0.5, 5.5)
37
+ title_text = "Number of Videos by Profession"
38
+ yticks_rotation = 45
39
+
40
+ # ===================
41
+ # Part 3: Plot Configuration and Rendering
42
+ # ===================
43
+ # Create horizontal bar chart
44
+ plt.figure(figsize=(12, 8)) # Adjust figure size to match original image's dimensions
45
+ plt.barh(
46
+ professions, number_of_videos, color=colors, edgecolor="white"
47
+ ) # Change bar color to purple
48
+ plt.xlabel(xlabel)
49
+ plt.xlim(*xlim_values)
50
+ plt.ylim(*ylim_values)
51
+ plt.title(title_text)
52
+
53
+ basetick = [0, 1, 2, 3, 4, 5]
54
+ offsetticks = [-0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5]
55
+ plt.gca().yaxis.set_major_locator(ticker.FixedLocator(basetick))
56
+ plt.gca().yaxis.set_major_formatter(
57
+ ticker.FuncFormatter(lambda x, _: f"{professions[x-1]}")
58
+ )
59
+ plt.gca().yaxis.set_minor_locator(ticker.FixedLocator(offsetticks))
60
+ plt.gca().grid(True, which="minor", axis="y", color="gray", linestyle="--")
61
+ plt.gca().grid(True, which="major", axis="x", color="gray", linestyle="--")
62
+ plt.gca().set_axisbelow(True)
63
+ plt.tick_params(axis="both", which="major", length=0)
64
+ plt.tick_params(axis="y", which="minor", color="gray", length=3)
65
+ plt.gca().spines["top"].set_visible(False)
66
+ plt.gca().spines["right"].set_visible(False)
67
+ plt.gca().spines["bottom"].set_visible(False)
68
+ plt.gca().spines["left"].set_visible(False)
69
+ plt.yticks(rotation=yticks_rotation)
70
+
71
+ # ===================
72
+ # Part 4: Saving Output
73
+ # ===================
74
+ plt.tight_layout()
75
+ plt.savefig("bar_56.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_57.png ADDED
ChartMimic/dataset/ori_500/bar_57.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
+ # Economic Data Example
14
+ categories = [
15
+ "GDP Growth",
16
+ "Unemployment Rate",
17
+ "Inflation Rate",
18
+ "NASDAQ",
19
+ "Exchange Rate",
20
+ "Real Estate Prices",
21
+ "Corporate Profits",
22
+ ][::-1]
23
+ us_data = [3.1, 5.3, 2.2, 13.8, 1.1, 4.5, 7.0][::-1]
24
+ eu_data = [2.4, 7.5, 1.7, 11.6, 0.9, 3.0, 6.5][::-1]
25
+ china_data = [6.5, 4.2, 2.5, 14.2, 6.5, 8.9, 9.4][::-1]
26
+ india_data = [7.1, 6.6, 4.0, 16.3, 3.3, 7.2, 10.5][::-1]
27
+ brazil_data = [1.2, 12.1, 3.8, 5.4, 2.2, 1.5, 3.6][::-1]
28
+ labels = ["US", "EU", "China", "India", "Brazil"]
29
+
30
+ # ===================
31
+ # Part 3: Plot Configuration and Rendering
32
+ # ===================
33
+ # Stacked Bar Chart
34
+ fig, ax = plt.subplots(
35
+ figsize=(8, 5)
36
+ ) # Adjusted to match the original image's dimensions
37
+ bar_width = 0.5
38
+ y_pos = range(len(categories))
39
+
40
+ ax.barh(y_pos, us_data, bar_width, color="tomato", label=labels[0])
41
+ ax.barh(y_pos, eu_data, bar_width, left=us_data, color="wheat", label=labels[1])
42
+ ax.barh(
43
+ y_pos,
44
+ china_data,
45
+ bar_width,
46
+ left=[i + j for i, j in zip(us_data, eu_data)],
47
+ color="#81acce",
48
+ label=labels[2],
49
+ )
50
+ ax.barh(
51
+ y_pos,
52
+ india_data,
53
+ bar_width,
54
+ left=[i + j + k for i, j, k in zip(us_data, eu_data, china_data)],
55
+ color="darkseagreen",
56
+ label=labels[3],
57
+ )
58
+ ax.barh(
59
+ y_pos,
60
+ brazil_data,
61
+ bar_width,
62
+ left=[
63
+ i + j + k + l for i, j, k, l in zip(us_data, eu_data, china_data, india_data)
64
+ ],
65
+ color="cornflowerblue",
66
+ label=labels[4],
67
+ )
68
+
69
+ # Labels and Legend
70
+ ax.set_xticks(np.arange(0, 51, 5))
71
+ ax.set_yticks(y_pos)
72
+ ax.grid(axis="x", color="gray", linestyle="--")
73
+ ax.set_axisbelow(True)
74
+ ax.set_yticklabels(categories)
75
+ ax.legend(loc="upper center", bbox_to_anchor=(0.5, 1.2), ncols=3)
76
+
77
+ # ===================
78
+ # Part 4: Saving Output
79
+ # ===================
80
+ plt.tight_layout()
81
+ plt.savefig("bar_57.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_60.png ADDED
ChartMimic/dataset/ori_500/bar_60.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===================
2
+ # Part 1: Importing Libraries
3
+ # ===================
4
+ import matplotlib.pyplot as plt
5
+
6
+ # ===================
7
+ # Part 2: Data Preparation
8
+ # ===================
9
+ # Data for the plots
10
+ models = ["GRU4Rec", "Caser", "SASRec", "BERT4Rec", "FMLP-Rec"]
11
+ yelp_values = [19.7, -15.9, -8.5, 4.8, -0.7]
12
+
13
+ # Axes Limits and Labels
14
+ ax_title = "Yelp"
15
+ xticks_values = range(-20, 21, 5)
16
+ xlabel = "▲%"
17
+
18
+ # ===================
19
+ # Part 3: Plot Configuration and Rendering
20
+ # ===================
21
+ # Set the figure size to match the original image's dimensions
22
+ fig, ax = plt.subplots(figsize=(10, 8))
23
+
24
+ # Plot for Yelp
25
+ bars = ax.barh(models, yelp_values, color="white", edgecolor="black", hatch="//")
26
+ for bar, value in zip(bars, yelp_values):
27
+ if value < 0:
28
+ bar.set_hatch("\\\\")
29
+ bar.set_edgecolor("red")
30
+ ax.set_title(ax_title)
31
+ for i, v in enumerate(yelp_values):
32
+ ax.text(
33
+ v - 0.5 if v < 0 else v + 0.5,
34
+ i,
35
+ f"{v}%",
36
+ color="black" if v > 0 else "red",
37
+ va="center",
38
+ ha="right" if v < 0 else "left",
39
+ )
40
+ # Add a vertical line at x=0
41
+ ax.axvline(0, color="black")
42
+ ax.set_xticks(xticks_values)
43
+ # Remove y-axis tick marks
44
+ ax.tick_params(axis="y", which="both", left=False)
45
+
46
+ # Hide all axes except the bottom one
47
+ for spine in ["left", "right", "top"]:
48
+ ax.spines[spine].set_visible(False)
49
+
50
+ # Add x-axis label
51
+ ax.set_xlabel(xlabel)
52
+
53
+ # ===================
54
+ # Part 4: Saving Output
55
+ # ===================
56
+ # Displaying the plot with tight layout to minimize white space
57
+ plt.tight_layout()
58
+ plt.savefig("bar_60.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_61.png ADDED
ChartMimic/dataset/ori_500/bar_61.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 = [
15
+ "Internet Penetration",
16
+ "Smartphone Usage",
17
+ "Research Investment",
18
+ "Patents Filed",
19
+ ]
20
+ internet_penetration = [585, 920, 760, 686] # Example data in percentage
21
+ smartphone_usage = [900, 350, 718, 634] # Example data in percentage
22
+ research_investment = [1500, 1400, 800, 450] # Example data in numbers of patents
23
+ labels = ["Internet Penetration (%)", "Smartphone Usage (%)", "Research Investment (% of GDP)"]
24
+ xticks = np.arange(0, 3500, 250)
25
+
26
+ # ===================
27
+ # Part 3: Plot Configuration and Rendering
28
+ # ===================
29
+ # Stacked Bar Chart
30
+ fig, ax = plt.subplots(figsize=(8, 5))
31
+ bar_width = 0.5
32
+ y_pos = range(len(categories))
33
+
34
+ ax.barh(
35
+ y_pos,
36
+ internet_penetration,
37
+ bar_width,
38
+ color="#d66555",
39
+ edgecolor="#2a3b4d",
40
+ hatch="*",
41
+ label=labels[0]
42
+ )
43
+ ax.barh(
44
+ y_pos,
45
+ smartphone_usage,
46
+ bar_width,
47
+ left=internet_penetration,
48
+ color="#88a27d",
49
+ edgecolor="#2a3b4d",
50
+ hatch="+",
51
+ label=labels[1]
52
+ )
53
+ ax.barh(
54
+ y_pos,
55
+ research_investment,
56
+ bar_width,
57
+ left=[i + j for i, j in zip(internet_penetration, smartphone_usage)],
58
+ color="#a1b5ce",
59
+ edgecolor="#2a3b4d",
60
+ hatch="/",
61
+ label=labels[2],
62
+ )
63
+
64
+ # Labels and Legend
65
+ ax.set_xticks(xticks)
66
+ ax.set_yticks(y_pos)
67
+ ax.grid(axis="x", color="gray", linestyle="--")
68
+ ax.set_axisbelow(True)
69
+ ax.set_yticklabels(categories)
70
+ ax.legend(loc="upper center", bbox_to_anchor=(0.5, 1.2), ncols=3)
71
+
72
+ # ===================
73
+ # Part 4: Saving Output
74
+ # ===================
75
+ # Displaying the plot with tight layout to minimize white space
76
+ plt.tight_layout()
77
+ plt.savefig("bar_61.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_63.png ADDED
ChartMimic/dataset/ori_500/bar_63.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===================
2
+ # Part 1: Importing Libraries
3
+ # ===================
4
+ import matplotlib.pyplot as plt
5
+
6
+ # ===================
7
+ # Part 2: Data Preparation
8
+ # ===================
9
+ # Sample data similar to the provided image
10
+ categories = [
11
+ "Notre-Dame de Paris",
12
+ "Demi-Gods and Semi-Devils",
13
+ "The Count of Monte Cristo",
14
+ "Game of Thrones",
15
+ "Attack on Titan",
16
+ ]
17
+ scores_0 = [0.6, 0.4, 0.3, 0.5, 0.2]
18
+ scores_20 = [0.7, 0.5, 0.35, 0.45, 0.25]
19
+ scores_40 = [0.4, 0.3, 0.25, 0.35, 0.15]
20
+ scores_60 = [0.6, 0.5, 0.4, 0.55, 0.3]
21
+ labels = ["Time 0", "Time 20", "Time 40", "Time 60"]
22
+ xlabel = "Scores"
23
+ ylabel = "Categories"
24
+ title = "Scores by Category Over Time"
25
+
26
+ # ===================
27
+ # Part 3: Plot Configuration and Rendering
28
+ # ===================
29
+ # Size of the plot
30
+ plt.figure(figsize=(10, 8))
31
+
32
+ # Adjust the position of the bars on the x-axis to prevent overlap
33
+ bar_height = 0.15
34
+ ind = [i * (bar_height * len(categories)) for i in range(len(scores_0))]
35
+
36
+ # Creating the bar plot with adjusted positions to prevent overlap
37
+ plt.barh(
38
+ [pos + bar_height * 0 for pos in ind],
39
+ scores_0,
40
+ color="navy",
41
+ height=bar_height,
42
+ label=labels[0],
43
+ )
44
+ plt.barh(
45
+ [pos + bar_height * 1 for pos in ind],
46
+ scores_20,
47
+ color="blue",
48
+ height=bar_height,
49
+ label=labels[1],
50
+ )
51
+ plt.barh(
52
+ [pos + bar_height * 2 for pos in ind],
53
+ scores_40,
54
+ color="royalblue",
55
+ height=bar_height,
56
+ label=labels[2],
57
+ )
58
+ plt.barh(
59
+ [pos + bar_height * 3 for pos in ind],
60
+ scores_60,
61
+ color="lightblue",
62
+ height=bar_height,
63
+ label=labels[3],
64
+ )
65
+
66
+ # X and Y axis Labels
67
+ plt.xlabel(xlabel)
68
+ plt.ylabel(ylabel)
69
+
70
+ # Title of the plot
71
+ plt.title(title)
72
+
73
+ # Adding legend
74
+ plt.legend()
75
+
76
+ # Setting the labels for y-axis with adjusted positions
77
+ plt.yticks([pos + bar_height * 1.5 for pos in ind], categories)
78
+
79
+ # ===================
80
+ # Part 4: Saving Output
81
+ # ===================
82
+ # Display the plot with enough space
83
+ plt.tight_layout()
84
+
85
+ plt.savefig("bar_63.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_64.png ADDED
ChartMimic/dataset/ori_500/bar_64.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===================
2
+ # Part 1: Importing Libraries
3
+ # ===================
4
+ import numpy as np
5
+
6
+ np.random.seed(0)
7
+
8
+ import matplotlib.pyplot as plt
9
+
10
+ # ===================
11
+ # Part 2: Data Preparation
12
+ # ===================
13
+ # Environmental data for air quality metrics
14
+ regions = ["North", "South", "East", "West"]
15
+ CO2_levels = np.array([60, 85, 50, 95]) + np.random.rand(4) * 10 # CO2 levels in ppm
16
+ PM_levels = (
17
+ np.array([35, 45, 30, 50]) + np.random.rand(4) * 5
18
+ ) # Particulate matter in µg/m3
19
+ SO2_levels = np.array([20, 25, 15, 10]) + np.random.rand(4) * 3 # SO2 levels in µg/m3
20
+ NO2_levels = np.array([30, 35, 25, 40]) + np.random.rand(4) * 5 # NO2 levels in µg/m3
21
+
22
+ labels = ["CO2 (ppm)", "PM (µg/m3)", "SO2 (µg/m3)", "NO2 (µg/m3)"]
23
+ xlabel = "Concentration"
24
+ ylabel = "Regions"
25
+ title = "Air Quality Metrics by Region"
26
+
27
+ # ===================
28
+ # Part 3: Plot Configuration and Rendering
29
+ # ===================
30
+ # Size of the plot
31
+ plt.figure(figsize=(10, 7))
32
+
33
+ # Adjust the position of the bars on the x-axis to prevent overlap
34
+ bar_height = 0.3
35
+ indices = np.arange(len(CO2_levels)) * 1.5 # Increase space between groups
36
+
37
+ # Define some hatch patterns and colors to use for bars
38
+ hatch_patterns = ["/", "\\", "|", "-", "+", "*"]
39
+ colors = ["#66c4d5", "#eca198", "#5886c7", "#a791e8"]
40
+
41
+ # Plot bars for each air quality metric
42
+ for i, level in enumerate([CO2_levels, PM_levels, SO2_levels, NO2_levels]):
43
+ bars = plt.barh(
44
+ [pos + bar_height * i for pos in indices],
45
+ level,
46
+ color=colors[i],
47
+ height=bar_height,
48
+ hatch=hatch_patterns[i],
49
+ label=f'{labels[i]}',
50
+ )
51
+
52
+ # Add text annotations to the right of the bars
53
+ for bar in bars:
54
+ plt.text(
55
+ bar.get_width(), # X position
56
+ bar.get_y() + bar.get_height() / 2, # Y position
57
+ f"{bar.get_width():.2f}", # Text to display
58
+ va="center",
59
+ )
60
+
61
+ # X and Y axis Labels and limits
62
+ plt.xlabel(xlabel)
63
+ plt.ylabel(ylabel)
64
+ plt.xlim(
65
+ 0,
66
+ max(np.max(CO2_levels), np.max(PM_levels), np.max(SO2_levels), np.max(NO2_levels))
67
+ + 10,
68
+ )
69
+
70
+ # Title of the plot
71
+ plt.title(title)
72
+
73
+ # Adding legend
74
+ plt.legend()
75
+
76
+ # Setting the labels for y-axis with adjusted positions
77
+ plt.yticks([pos + bar_height * 1.5 for pos in indices], regions)
78
+
79
+ # Adding grids
80
+ plt.grid(True, linestyle="--", which="both", axis="x", color="grey", alpha=0.7)
81
+
82
+ # ===================
83
+ # Part 4: Saving Output
84
+ # ===================
85
+ # Display the plot with enough space
86
+ plt.tight_layout()
87
+
88
+ # Save the plot as a PDF file
89
+ plt.savefig("bar_64.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_65.png ADDED
ChartMimic/dataset/ori_500/bar_65.py ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===================
2
+ # Part 1: Importing Libraries
3
+ # ===================
4
+ import numpy as np
5
+
6
+ np.random.seed(0)
7
+
8
+ import matplotlib.pyplot as plt
9
+
10
+ # ===================
11
+ # Part 2: Data Preparation
12
+ # ===================
13
+ # Define the categories and scores
14
+ categories = ["LLAMA-Default", "LLAMA-HAG", "Vicuna-Default", "Vicuna-HAG"]
15
+ num_scores = 4
16
+ score_range = (-3.5, -0.5)
17
+ scores_3 = np.random.uniform(score_range[0], score_range[1], num_scores).tolist()
18
+ scores_5 = np.random.uniform(score_range[0], score_range[1], num_scores).tolist()
19
+ scores_7 = np.random.uniform(score_range[0], score_range[1], num_scores).tolist()
20
+ scores_10 = np.random.uniform(score_range[0], score_range[1], num_scores).tolist()
21
+
22
+ # The x locations for the groups
23
+ ind = np.arange(len(scores_3))
24
+
25
+ # The width of the bars
26
+ bar_width = 0.2
27
+
28
+ # Labels and Plot Types
29
+ label_3_Constraint_Words = "3 Constraint Words"
30
+ label_5_Constraint_Words = "5 Constraint Words"
31
+ label_7_Constraint_Words = "7 Constraint Words"
32
+ label_10_Constraint_Words = "10 Constraint Words"
33
+
34
+ # Axes Limits and Labels
35
+ xlabel_value = "Score"
36
+ ax_title = "Scores by group and constraint word count"
37
+
38
+ # ===================
39
+ # Part 3: Plot Configuration and Rendering
40
+ # ===================
41
+ # Create the figure and axes objects
42
+ fig, ax = plt.subplots(figsize=(10, 6))
43
+
44
+ # Plotting data
45
+ bars_3 = ax.barh(
46
+ ind - bar_width * 1.5,
47
+ scores_3,
48
+ bar_width,
49
+ label=label_3_Constraint_Words,
50
+ color="salmon",
51
+ )
52
+ bars_5 = ax.barh(
53
+ ind - bar_width * 0.5,
54
+ scores_5,
55
+ bar_width,
56
+ label=label_5_Constraint_Words,
57
+ color="skyblue",
58
+ )
59
+ bars_7 = ax.barh(
60
+ ind + bar_width * 0.5,
61
+ scores_7,
62
+ bar_width,
63
+ label=label_7_Constraint_Words,
64
+ color="coral",
65
+ )
66
+ bars_10 = ax.barh(
67
+ ind + bar_width * 1.5,
68
+ scores_10,
69
+ bar_width,
70
+ label=label_10_Constraint_Words,
71
+ color="lightblue",
72
+ )
73
+
74
+ # Adding text inside the bars
75
+ for i, (score_3, score_5, score_7, score_10) in enumerate(
76
+ zip(scores_3, scores_5, scores_7, scores_10)
77
+ ):
78
+ ax.text(
79
+ score_3,
80
+ i - bar_width * 1.5,
81
+ f"{score_3:.1f}",
82
+ va="center",
83
+ ha="right",
84
+ color="black",
85
+ )
86
+ ax.text(
87
+ score_5,
88
+ i - bar_width * 0.5,
89
+ f"{score_5:.1f}",
90
+ va="center",
91
+ ha="right",
92
+ color="black",
93
+ )
94
+ ax.text(
95
+ score_7,
96
+ i + bar_width * 0.5,
97
+ f"{score_7:.1f}",
98
+ va="center",
99
+ ha="right",
100
+ color="black",
101
+ )
102
+ ax.text(
103
+ score_10,
104
+ i + bar_width * 1.5,
105
+ f"{score_10:.1f}",
106
+ va="center",
107
+ ha="right",
108
+ color="black",
109
+ )
110
+
111
+ # Adding labels, title, and custom x-axis tick labels, etc.
112
+ ax.set_xlabel(xlabel_value)
113
+ ax.set_title(ax_title)
114
+ ax.set_yticks(ind)
115
+ ax.set_yticklabels(categories)
116
+ ax.legend()
117
+
118
+ # Invert y-axis to have the first entry at the top
119
+ plt.gca().invert_yaxis()
120
+
121
+ # Show grid lines for x-axis
122
+ ax.xaxis.grid(True)
123
+
124
+ # ===================
125
+ # Part 4: Saving Output
126
+ # ===================
127
+ plt.tight_layout()
128
+ plt.savefig("bar_65.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_67.png ADDED
ChartMimic/dataset/ori_500/bar_67.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===================
2
+ # Part 1: Importing Libraries
3
+ # ===================
4
+ import numpy as np
5
+
6
+ np.random.seed(0)
7
+
8
+ import matplotlib.pyplot as plt
9
+ import colorsys
10
+
11
+ # ===================
12
+ # Part 2: Data Preparation
13
+ # ===================
14
+ # Redefining the data
15
+ models = ["Lavila", "Video-LLaMA", "BLIP1", "BLIP2", "LLaVA", "OSCaR", "GPT4V"]
16
+ percentages = [0.0, 0.71, 4.64, 4.64, 31.79, 73.93, 82.5]
17
+
18
+ # Sorting the data in descending order while keeping track of the models order
19
+ sorted_data = sorted(zip(percentages, models), reverse=True)
20
+ sorted_percentages, sorted_models = zip(*sorted_data)
21
+
22
+ title = "Human Study"
23
+ xlabel = "Model"
24
+ ylabel = "Percentage (%)"
25
+ ylim = [0, np.max(sorted_percentages) + 10]
26
+
27
+
28
+ # Generate random colors with lower saturation
29
+ def hsl_to_rgb(h, s, l):
30
+ return colorsys.hls_to_rgb(h, l, s)
31
+
32
+
33
+ # Randomly generate colors
34
+ colors = [hsl_to_rgb(hue, 0.5, 0.6) for hue in np.linspace(0, 1, len(models) + 1)[:-1]]
35
+
36
+ # ===================
37
+ # Part 3: Plot Configuration and Rendering
38
+ # ===================
39
+ # Create figure and bar chart with the sorted data
40
+ plt.figure(figsize=(12, 8))
41
+ bars = plt.bar(sorted_models, sorted_percentages, color=colors)
42
+
43
+ # Randomly decide where to put the text based on the value of the bar
44
+ for bar in bars:
45
+ yval = bar.get_height()
46
+ text_y = (
47
+ yval - 5 if yval > 10 else yval + 1
48
+ ) # Slight modification to avoid negative values
49
+ plt.text(
50
+ bar.get_x() + bar.get_width() / 2,
51
+ text_y,
52
+ f"{yval}%",
53
+ ha="center",
54
+ va="top" if text_y < yval else "bottom",
55
+ )
56
+
57
+ # Set chart title and labels
58
+ plt.title(title)
59
+ plt.xlabel(xlabel)
60
+ plt.ylabel(ylabel)
61
+
62
+ # Randomly set y-axis range to a bit higher than the max value
63
+ plt.ylim(ylim)
64
+
65
+ # Randomize the gridlines and ticks
66
+ plt.grid(axis="y", linestyle="--", alpha=0.7)
67
+
68
+ # Randomize tick rotation
69
+ plt.xticks(rotation=45)
70
+
71
+ # Hide the top and right spines
72
+ plt.gca().spines["top"].set_visible(False)
73
+ plt.gca().spines["right"].set_visible(False)
74
+
75
+ # ===================
76
+ # Part 4: Saving Output
77
+ # ===================
78
+ # Apply tight layout
79
+ plt.tight_layout()
80
+
81
+ plt.savefig("bar_67.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_68.png ADDED
ChartMimic/dataset/ori_500/bar_68.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===================
2
+ # Part 1: Importing Libraries
3
+ # ===================
4
+ import numpy as np
5
+
6
+ np.random.seed(0)
7
+
8
+ import matplotlib.pyplot as plt
9
+
10
+ # ===================
11
+ # Part 2: Data Preparation
12
+ # ===================
13
+ # Example transportation data
14
+ categories = [
15
+ "Traffic Flow",
16
+ "Accident Rate",
17
+ "Public Transport Usage",
18
+ "Road Condition",
19
+ ]
20
+ layer_data = {
21
+ "Cars": np.array([70, 50, 30, 80]),
22
+ "Buses": np.array([30, 30, 40, 75]),
23
+ "Bikes": np.array([15, 20, 20, 85]),
24
+ "Pedestrians": np.array([50, 20, 20, 90]),
25
+ }
26
+
27
+ # Colors for each layer (from dark blue to light blue)
28
+ colors = ["#08306b", "#2171b5", "#6baed6", "#bdd7e7"]
29
+
30
+ title = "Stacked Bar Chart of Transportation Data"
31
+ xlabel = "Categories"
32
+ ylabel = "Values"
33
+
34
+ # ===================
35
+ # Part 3: Plot Configuration and Rendering
36
+ # ===================
37
+ # Create the figure and axes objects
38
+ fig, ax = plt.subplots(figsize=(10, 6))
39
+
40
+ # Variables to store the bottom position for each stack
41
+ bottoms = np.array([0] * len(categories))
42
+
43
+ for i, (layer, values) in enumerate(layer_data.items()):
44
+ bars = ax.bar(categories, values, bottom=bottoms, color=colors[i], label=layer)
45
+
46
+ # Add data labels on each bar
47
+ for bar, bottom in zip(bars, bottoms):
48
+ height = bar.get_height()
49
+ ax.text(
50
+ bar.get_x() + bar.get_width() / 2,
51
+ bottom + height / 2,
52
+ str(height),
53
+ ha="center",
54
+ va="center",
55
+ color="white",
56
+ )
57
+
58
+ # Update the bottoms position
59
+ bottoms += values
60
+
61
+ # Chart title and labels
62
+ plt.title("Stacked Bar Chart of Transportation Data")
63
+ plt.xlabel("Categories")
64
+ plt.ylabel("Values")
65
+
66
+ # Adding legend
67
+ plt.legend()
68
+
69
+ # ===================
70
+ # Part 4: Saving Output
71
+ # ===================
72
+ # Displaying the plot with tight layout to minimize white space
73
+ plt.tight_layout()
74
+ # Save the plot as PDF
75
+ plt.savefig("bar_68.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_72.png ADDED
ChartMimic/dataset/ori_500/bar_72.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ models = ["Bactrian-X EN", "Lima-X DE", "Bactrian-X FR", "Lima-X IT", "Bactrian-X ES"]
15
+ improvements = {"EN": [3.5], "DE": [2.3], "FR": [4.4], "IT": [1.3], "ES": [-0.7]}
16
+
17
+ xlabel = "Model with Language"
18
+ ylabel = "Improvement [%]"
19
+ ylim = [-1.5, 5]
20
+ legendtitle = "Language"
21
+ title = "Model Performance Improvement by Language"
22
+
23
+ # Colors for each language
24
+ colors = ["#8171d7", "#af4b3d", "#d07035", "#d6a741", "#639b48"]
25
+
26
+ # ===================
27
+ # Part 3: Plot Configuration and Rendering
28
+ # ===================
29
+ # Figure and axis
30
+ fig, ax = plt.subplots(figsize=(10, 6))
31
+
32
+ # Bar width
33
+ bar_width = 0.75
34
+
35
+ # Positions of the bars on the x-axis
36
+ r = np.arange(len(models))
37
+
38
+ # Plotting the bars
39
+ for i, language in enumerate(improvements):
40
+ bars = plt.bar(
41
+ r[i],
42
+ improvements[language],
43
+ color=colors[i],
44
+ width=bar_width,
45
+ label=language,
46
+ hatch="//",
47
+ edgecolor="white",
48
+ )
49
+ # Add text labels
50
+ for bar, val in zip(bars, improvements[language]):
51
+ height = bar.get_height()
52
+ ax.text(
53
+ bar.get_x() + bar.get_width() / 2,
54
+ height + 0.1 if height > 0 else height - 0.4,
55
+ f"{val:.1f}",
56
+ ha="center",
57
+ )
58
+
59
+ # Add xticks on the middle of the group bars
60
+ plt.xlabel(xlabel)
61
+ plt.xticks(r, models, rotation=45)
62
+
63
+ # Add ylabel
64
+ plt.ylabel(ylabel)
65
+ plt.ylim(ylim)
66
+
67
+ plt.gca().grid(color="gray", linewidth=0.5)
68
+ plt.gca().set_axisbelow(True)
69
+
70
+ # Create legend & Show graphic
71
+ plt.legend(title=legendtitle, loc="upper right")
72
+ plt.title(title)
73
+
74
+ # ===================
75
+ # Part 4: Saving Output
76
+ # ===================
77
+ plt.tight_layout()
78
+ plt.savefig("bar_72.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_73.png ADDED
ChartMimic/dataset/ori_500/bar_73.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Set a seed for reproducibility
14
+
15
+ # Define fiscal quarters
16
+ quarters = np.array([1, 2, 3, 4, 5])
17
+
18
+ # Generate synthetic stock market index changes for two different indexes
19
+ index_changes_dow_jones = np.random.uniform(
20
+ -5, 5, 5
21
+ ) # Example changes in Dow Jones index
22
+ index_changes_nasdaq = np.random.uniform(-5, 5, 5) # Example changes in Nasdaq index
23
+
24
+ labels = ["Dow Jones Index", "Nasdaq Index"]
25
+ axline = 0
26
+ xlabel = "Fiscal Quarter"
27
+ ylabel = "Index Change (%)"
28
+ ylim = [-5, 5]
29
+ yticks = np.arange(-5, 5, 5)
30
+
31
+ # ===================
32
+ # Part 3: Plot Configuration and Renderingåå
33
+ # ===================
34
+ # Create figure and subplots
35
+ fig, axs = plt.subplots(figsize=(10, 5))
36
+ width = 0.4
37
+
38
+ # Plotting bars for each index
39
+ bars1 = axs.bar(
40
+ quarters - width / 2,
41
+ index_changes_dow_jones,
42
+ width=width,
43
+ color="#78a083",
44
+ label="Dow Jones Index",
45
+ )
46
+ bars2 = axs.bar(
47
+ quarters + width / 2,
48
+ index_changes_nasdaq,
49
+ width=width,
50
+ color="#d27a41",
51
+ label="Nasdaq Index",
52
+ )
53
+
54
+ # Adding text labels on the bars
55
+ for bars in [bars1, bars2]:
56
+ for bar in bars:
57
+ height = bar.get_height()
58
+ axs.text(
59
+ bar.get_x() + bar.get_width() / 2,
60
+ height,
61
+ f"{height:.1f}",
62
+ ha="center",
63
+ va="bottom" if height > 0 else "top",
64
+ )
65
+
66
+ # Additional plot settings
67
+ axs.axhline(axline, color="black")
68
+ axs.set_xlabel(xlabel)
69
+ axs.set_ylabel(ylabel)
70
+ axs.set_ylim(ylim)
71
+ axs.set_yticks(yticks)
72
+ axs.set_xticks(quarters)
73
+ axs.yaxis.grid(True)
74
+ axs.set_axisbelow(True)
75
+
76
+ # Adding legend and adjusting layout
77
+ plt.legend(loc="upper center", bbox_to_anchor=(0.5, 1.10), ncol=2)
78
+
79
+ # ===================
80
+ # Part 4: Saving Output
81
+ # ===================
82
+ # Save the figure as a PDF
83
+ plt.tight_layout()
84
+ plt.savefig("bar_73.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_76.png ADDED
ChartMimic/dataset/ori_500/bar_76.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 some example environmental data
14
+ categories = ["Light Industry", "Heavy Industry", "Transportation", "Residential"]
15
+
16
+ # Data for the graph: negative values for pollution emissions (in thousands of metric tons)
17
+ values1_A = [-np.random.uniform(300, 1000) for _ in categories] # Current Year
18
+ values2_A = [-np.random.uniform(300, 1000) for _ in categories] # Previous Year
19
+ labels = ["Current Year", "Previous Year"]
20
+ xlabel = "Industry Sectors"
21
+ ylabel = "Pollution Emissions (thousands of metric tons)"
22
+ title = "Environmental Impact by Sector"
23
+
24
+ # ===================
25
+ # Part 3: Plot Configuration and Rendering
26
+ # ===================
27
+ # Set up the figure size
28
+ fig, ax = plt.subplots(figsize=(10, 6))
29
+
30
+ # Make the bar plot with hatch patterns
31
+ ax.bar(
32
+ categories,
33
+ values1_A,
34
+ color="skyblue",
35
+ hatch="/",
36
+ label="Current Year",
37
+ edgecolor="black",
38
+ )
39
+ ax.bar(
40
+ categories,
41
+ values2_A,
42
+ color="sandybrown",
43
+ hatch="\\",
44
+ label="Previous Year",
45
+ bottom=values1_A,
46
+ edgecolor="black",
47
+ )
48
+
49
+ # Labeling and customizing
50
+ plt.xlabel(xlabel)
51
+ plt.ylabel(ylabel)
52
+ plt.title(title)
53
+ plt.legend()
54
+
55
+ # Adding grid lines for better readability
56
+ plt.grid(axis="y", linestyle="--", alpha=0.7)
57
+
58
+ # ===================
59
+ # Part 4: Saving Output
60
+ # ===================
61
+ # Adjust layout and display
62
+ plt.tight_layout()
63
+
64
+ # Save the plot as a PDF file
65
+ plt.savefig("bar_76.pdf", bbox_inches="tight")
ChartMimic/dataset/ori_500/bar_77.png ADDED
ChartMimic/dataset/ori_500/bar_77.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===================
2
+ # Part 1: Importing Libraries
3
+ # ===================
4
+ import matplotlib.pyplot as plt
5
+
6
+ # ===================
7
+ # Part 2: Data Preparation
8
+ # ===================
9
+ cities = ["Beijing", "Shanghai", "Guangzhou", "Shenzhen", "Chengdu"]
10
+ temperatures = [11.2, 16.1, 21.9, 23.2, 16.3]
11
+ xlabel = "City"
12
+ ylabel = "Average Temperature (°C)"
13
+ title = "Average City Temperatures"
14
+
15
+ # ===================
16
+ # Part 3: Plot Configuration and Rendering
17
+ # ===================
18
+ plt.figure(figsize=(8, 4))
19
+ plt.bar(cities, temperatures, color="skyblue", edgecolor="black")
20
+ plt.xlabel(xlabel)
21
+ plt.ylabel(ylabel)
22
+ plt.title(title)
23
+
24
+ # ===================
25
+ # Part 4: Saving Output
26
+ # ===================
27
+ plt.tight_layout()
28
+ plt.savefig("bar_77.pdf", bbox_inches="tight")