Commit 5f354ca
authored
BUG: Handle overlapping line and bar on the same plot (#61173)
* Handle line and box on the same plot
* Handle line and box on the same plot
* Refactor PeriodConverter to separate frequency handling.
Introduce `convert_from_freq` method and streamline the conversion process by passing `freq` directly instead of using `axis.freq`. This improves modularity and ensures clearer separation of concerns for frequency handling in Period conversion.
* Refactor time series plotting logic in Matplotlib backend.
Simplified `tick_pos` calculation by reusing helper methods and added a decorator to register pandas Matplotlib converters in the `_plot` method. This improves clarity and ensures proper integration with the pandas Matplotlib ecosystem.
* Add test for bar and line plot superposition with same x values
This test ensures that bar and line plots with identical x values are correctly superposed on the same axes. It verifies that the x-tick positions remain consistent across plot types.
* Fix alignment issue in Series.plot with line and bar.
Resolved a bug that prevented a line and bar from aligning on the same plot in `Series.plot`. This addresses issue #61161 and improves plot consistency when combining these chart types.
* Refactor time series handling in matplotlib plotting.
Move `x_compat` logic and time series helper methods from `LinePlot` to `MPLPlot` for better reusability and maintainability. This simplifies the `LinePlot` class and centralizes common functionality.
* Update doc/source/whatsnew/v3.0.0.rst
* Apply suggestions from code review
* Fix bar and line plot alignment and x-axis visibility in tests
Ensure bar and line plots share consistent x-axis tick labels and verify that x-axis limits are adjusted to make all plotted elements visible in `test_bar_line_plot` test. These changes improve the robustness of visual alignment and boundary checks.
* Ensure bar_xticks length matches index in test_series.py
Add an assertion to verify the length of `bar_xticks` aligns with the length of the index. This improves the test's robustness by ensuring the data and ticks remain consistent.1 parent 5fef979 commit 5f354ca
File tree
4 files changed
+54
-12
lines changed- doc/source/whatsnew
- pandas
- plotting/_matplotlib
- tests/plotting
4 files changed
+54
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
769 | 769 | | |
770 | 770 | | |
771 | 771 | | |
| 772 | + | |
772 | 773 | | |
773 | 774 | | |
774 | 775 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
228 | 234 | | |
229 | | - | |
| 235 | + | |
230 | 236 | | |
231 | | - | |
| 237 | + | |
232 | 238 | | |
233 | 239 | | |
234 | 240 | | |
235 | | - | |
236 | | - | |
237 | | - | |
| 241 | + | |
238 | 242 | | |
239 | 243 | | |
240 | 244 | | |
| |||
248 | 252 | | |
249 | 253 | | |
250 | 254 | | |
251 | | - | |
| 255 | + | |
252 | 256 | | |
253 | | - | |
| 257 | + | |
254 | 258 | | |
255 | | - | |
| 259 | + | |
256 | 260 | | |
257 | 261 | | |
258 | 262 | | |
259 | | - | |
| 263 | + | |
260 | 264 | | |
261 | | - | |
| 265 | + | |
262 | 266 | | |
263 | 267 | | |
264 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| |||
1858 | 1861 | | |
1859 | 1862 | | |
1860 | 1863 | | |
1861 | | - | |
1862 | 1864 | | |
1863 | 1865 | | |
1864 | 1866 | | |
| |||
1871 | 1873 | | |
1872 | 1874 | | |
1873 | 1875 | | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
1874 | 1886 | | |
1875 | 1887 | | |
1876 | 1888 | | |
| |||
1900 | 1912 | | |
1901 | 1913 | | |
1902 | 1914 | | |
| 1915 | + | |
1903 | 1916 | | |
1904 | 1917 | | |
1905 | 1918 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
971 | 971 | | |
972 | 972 | | |
973 | 973 | | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
0 commit comments