Code Execution & Rendering Issues in Exercise 8.3 Subplots – Chapter 8.3 (Pages 253–254)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- content
Hướng nghiên cứu
Start with _graphuniv.m and compare its subplot layout and bar3 panel with the Exercise 8.3 code and the attached rendering. Check the figure output for label overlap and readability across all eight panels. Done means the rendering issues described in the report are resolved while preserving the exercise’s intended plots.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Dear Professors,
Following up on the layout issue, I performed a full code execution test in MATLAB using the exact snippet provided for Exercise 8.3 on pages 253–254:
- #230
T = readtable("graphuniv2series.xlsx", 'Sheet', 'data', 'ReadRowNames', true);
Y = T{:, 1:2};
months = categorical(T.Properties.RowNames, T.Properties.RowNames);
nr = 2; nc = 4;
subplot(nr, nc, 1); bar(months, Y); title('Grouped vertical bars')
% ... subplots 2 to 7 ...
subplot(nr, nc, 6); bar3(months, Y); title('3D bars')
Upon running the code, I observed a couple of notable rendering discrepancies and formatting issues in the resulting figure:
-
Subplot Overlap & Label Clipping:
Arranging 8 subplots in a $2 \times 4$ grid (nr = 2, nc = 4) without adjusting spacing causes the rotated vertical x-axis labels of the top row (e.g.,Jan,Feb...Dec) to overlap directly with the titles of the subplots on the bottom row (such as100% stacked area). -
3D Bar Display (
bar3) with Categorical Input:
Whilebar3(months, Y)executes without syntax errors in recent MATLAB releases, passing a categorical array directly tobar3places all 12 month labels along the 3D depth axis in a skewed orientation. Depending on the window resolution, this makes the labels hard to read and visually inconsistent with the rest of the 2D panels.
Suggested Refinements:
- Using
tiledlayout(2, 4, 'Padding', 'compact')instead ofsubplot(nr, nc, i)automatically resolves the label-title overlaps. - For
bar3, explicitly formatting the tick labels or providing a dedicated viewing angle (e.g., viaview()) improves the readability of the 3D bar chart.
Also, this is all the code i rewritten along the original file in the repo : graphuniv.m
% 1. Read data from Excel file
T = readtable("graphuniv2series.xlsx", 'Sheet', 'data', 'ReadRowNames', true);
Y = T{:, 1:2};
% 2. Define categorical month labels preserving chronological order
months = categorical(T.Properties.RowNames, T.Properties.RowNames, 'Ordinal', true);
% 3. Set subplot layout dimensions
nr = 2;
nc = 4;
% Panel 1: Grouped vertical bars
subplot(nr, nc, 1)
bar(months, Y)
title('Grouped vertical bars')
% Panel 2: Grouped horizontal bars
subplot(nr, nc, 2)
barh(months, Y)
title('Grouped horizontal bars')
% Panel 3: Stacked bars
subplot(nr, nc, 3)
bar(months, Y, 'stacked')
title('Stacked bars')
% Panel 4: 100% stacked bars
subplot(nr, nc, 4)
bar(months, 100 * Y ./ sum(Y, 2), 'stacked')
title('100% stacked bars')
% Panel 5: 100% stacked area
subplot(nr, nc, 5)
area(months, 100 * Y ./ sum(Y, 2))
title('100% stacked area')
% Panel 6: 3D bars (Fix for categorical array compatibility)
subplot(nr, nc, 6)
bar3(Y)
set(gca, 'XTickLabel', string(months))
title('3D bars')
% Panel 7: Stairs plot
subplot(nr, nc, 7)
stairs(months, Y)
title('Stairs plot')
% Panel 8: Custom-coloured bars (Example customization)
subplot(nr, nc, 8)
b = bar(months, Y);
b(1).FaceColor = [0.2 0.6 0.8];
b(2).FaceColor = [0.8 0.3 0.3];
title('Custom-coloured bars')
With those different results:
- Ngôn ngữ chính
- MATLAB
- Star
- 30
- Fork
- 1
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của UniprJRC/DSwithMATLAB
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 69/100
UniprJRC/DSwithMATLAB#232 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
UniprJRC/DSwithMATLAB#229 · 2 bình luận ·
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
UniprJRC/DSwithMATLAB#228 · 3 bình luận ·
-
Small typo Page 137Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 77/100
UniprJRC/DSwithMATLAB#198 · 1 bình luận · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 53/100
UniprJRC/DSwithMATLAB#230 ·
Tất cả issue của UniprJRC/DSwithMATLAB
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
windows clang 20 warnings buildĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
wissem01chiha/slxio#51 ·
-
census digest: print a denominator for EDGE-FAMILY CARDINALITY VIOLATIONS (did-schema OPEN_WORK #79)Đang mởV2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
VH-Lab/DID-matlab#399 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
VH-Lab/NDI-matlab#1183 ·
Maintainer thường phản hồi trong vòng 1 ngày