Optimize plot resolution with larger figures and balanced fonts
Browse files- Increased figsize to 12x7 inches for 1800x1050px output
- Reduced font sizes to prevent overcrowding while maintaining readability
- Set DPI to 150 for optimal balance of quality and file size
- Display width increased to 1200px for better viewing experience
- Creates crisp, professional visualizations with proper text spacing
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
- app.py +2 -2
- new_system_prompt.txt +2 -2
- src.py +9 -9
- vayuchat.mplstyle +10 -10
app.py
CHANGED
@@ -503,7 +503,7 @@ def show_custom_response(response):
|
|
503 |
<div style='margin: 1rem 0; display: flex; justify-content: center;'>
|
504 |
</div>
|
505 |
""", unsafe_allow_html=True)
|
506 |
-
st.image(content, width=
|
507 |
return {"is_image": True}
|
508 |
# Also handle case where content shows filename but we want to show image
|
509 |
elif isinstance(content, str) and any(ext in content for ext in ['.png', '.jpg']):
|
@@ -517,7 +517,7 @@ def show_custom_response(response):
|
|
517 |
<div style='margin: 1rem 0; display: flex; justify-content: center;'>
|
518 |
</div>
|
519 |
""", unsafe_allow_html=True)
|
520 |
-
st.image(filename, width=
|
521 |
return {"is_image": True}
|
522 |
except:
|
523 |
pass
|
|
|
503 |
<div style='margin: 1rem 0; display: flex; justify-content: center;'>
|
504 |
</div>
|
505 |
""", unsafe_allow_html=True)
|
506 |
+
st.image(content, width=1200, caption="Generated Visualization")
|
507 |
return {"is_image": True}
|
508 |
# Also handle case where content shows filename but we want to show image
|
509 |
elif isinstance(content, str) and any(ext in content for ext in ['.png', '.jpg']):
|
|
|
517 |
<div style='margin: 1rem 0; display: flex; justify-content: center;'>
|
518 |
</div>
|
519 |
""", unsafe_allow_html=True)
|
520 |
+
st.image(filename, width=1200, caption="Generated Visualization")
|
521 |
return {"is_image": True}
|
522 |
except:
|
523 |
pass
|
new_system_prompt.txt
CHANGED
@@ -33,8 +33,8 @@ DATA SAFETY:
|
|
33 |
- Use .dropna() to remove missing values before analysis
|
34 |
|
35 |
PLOTTING REQUIREMENTS:
|
36 |
-
- Create plots for visualization requests: plt.figure(figsize=(
|
37 |
-
- Save plots with high resolution: filename = f"plot_{uuid.uuid4().hex[:8]}.png"; plt.savefig(filename, dpi=
|
38 |
- Close plots: plt.close()
|
39 |
- Store filename: answer = filename
|
40 |
- For non-plots: answer = "text result"
|
|
|
33 |
- Use .dropna() to remove missing values before analysis
|
34 |
|
35 |
PLOTTING REQUIREMENTS:
|
36 |
+
- Create plots for visualization requests: plt.figure(figsize=(12, 7))
|
37 |
+
- Save plots with high resolution: filename = f"plot_{uuid.uuid4().hex[:8]}.png"; plt.savefig(filename, dpi=150, bbox_inches='tight', facecolor='white', edgecolor='none')
|
38 |
- Close plots: plt.close()
|
39 |
- Store filename: answer = filename
|
40 |
- For non-plots: answer = "text result"
|
src.py
CHANGED
@@ -147,15 +147,15 @@ def ask_question(model_name, question):
|
|
147 |
|
148 |
# Force matplotlib to use high resolution settings in exec environment
|
149 |
plt.style.use('vayuchat.mplstyle')
|
150 |
-
plt.rcParams['figure.dpi'] =
|
151 |
-
plt.rcParams['savefig.dpi'] =
|
152 |
-
plt.rcParams['figure.figsize'] = [
|
153 |
-
plt.rcParams['font.size'] =
|
154 |
-
plt.rcParams['axes.titlesize'] =
|
155 |
-
plt.rcParams['axes.labelsize'] =
|
156 |
-
plt.rcParams['xtick.labelsize'] =
|
157 |
-
plt.rcParams['ytick.labelsize'] =
|
158 |
-
plt.rcParams['legend.fontsize'] =
|
159 |
|
160 |
global_vars = {
|
161 |
'pd': pd, 'plt': plt, 'os': os,
|
|
|
147 |
|
148 |
# Force matplotlib to use high resolution settings in exec environment
|
149 |
plt.style.use('vayuchat.mplstyle')
|
150 |
+
plt.rcParams['figure.dpi'] = 150
|
151 |
+
plt.rcParams['savefig.dpi'] = 150
|
152 |
+
plt.rcParams['figure.figsize'] = [12, 7]
|
153 |
+
plt.rcParams['font.size'] = 11
|
154 |
+
plt.rcParams['axes.titlesize'] = 14
|
155 |
+
plt.rcParams['axes.labelsize'] = 12
|
156 |
+
plt.rcParams['xtick.labelsize'] = 10
|
157 |
+
plt.rcParams['ytick.labelsize'] = 10
|
158 |
+
plt.rcParams['legend.fontsize'] = 10
|
159 |
|
160 |
global_vars = {
|
161 |
'pd': pd, 'plt': plt, 'os': os,
|
vayuchat.mplstyle
CHANGED
@@ -2,21 +2,21 @@
|
|
2 |
# Inspired by modern data visualization best practices
|
3 |
|
4 |
# Typography & Layout
|
5 |
-
font.size:
|
6 |
font.family: sans-serif
|
7 |
font.sans-serif: Inter, SF Pro Display, Segoe UI, system-ui, Arial
|
8 |
-
figure.titlesize:
|
9 |
-
axes.titlesize:
|
10 |
-
axes.labelsize:
|
11 |
-
xtick.labelsize:
|
12 |
-
ytick.labelsize:
|
13 |
-
legend.fontsize:
|
14 |
|
15 |
# Figure & DPI - Ultra High Resolution
|
16 |
-
figure.dpi:
|
17 |
figure.facecolor: white
|
18 |
figure.edgecolor: none
|
19 |
-
figure.figsize:
|
20 |
figure.autolayout: True
|
21 |
|
22 |
# Modern Color Palette (inspired by Tailwind/GitHub)
|
@@ -85,7 +85,7 @@ text.color: 1f2937
|
|
85 |
text.antialiased: True
|
86 |
|
87 |
# Savefig - Ultra High Resolution
|
88 |
-
savefig.dpi:
|
89 |
savefig.facecolor: white
|
90 |
savefig.edgecolor: none
|
91 |
savefig.bbox: tight
|
|
|
2 |
# Inspired by modern data visualization best practices
|
3 |
|
4 |
# Typography & Layout
|
5 |
+
font.size: 11
|
6 |
font.family: sans-serif
|
7 |
font.sans-serif: Inter, SF Pro Display, Segoe UI, system-ui, Arial
|
8 |
+
figure.titlesize: 14
|
9 |
+
axes.titlesize: 12
|
10 |
+
axes.labelsize: 10
|
11 |
+
xtick.labelsize: 9
|
12 |
+
ytick.labelsize: 9
|
13 |
+
legend.fontsize: 9
|
14 |
|
15 |
# Figure & DPI - Ultra High Resolution
|
16 |
+
figure.dpi: 150
|
17 |
figure.facecolor: white
|
18 |
figure.edgecolor: none
|
19 |
+
figure.figsize: 12, 7
|
20 |
figure.autolayout: True
|
21 |
|
22 |
# Modern Color Palette (inspired by Tailwind/GitHub)
|
|
|
85 |
text.antialiased: True
|
86 |
|
87 |
# Savefig - Ultra High Resolution
|
88 |
+
savefig.dpi: 150
|
89 |
savefig.facecolor: white
|
90 |
savefig.edgecolor: none
|
91 |
savefig.bbox: tight
|