Skip to content

Commit

Permalink
BUG: don't set aspect when plotting missing values (#3438)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Richards <mrichards7@outlook.com.au>
martinfleis and m-richards authored Nov 17, 2024
1 parent 2276f62 commit e908d32
Showing 3 changed files with 27 additions and 21 deletions.
35 changes: 15 additions & 20 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,32 +2,16 @@

## Version 1.1.0

Notes on dependencies:

- GeoPandas 1.1 now requires Python 3.10 or greater and pandas 2.0, numpy 1.24, pyproj 3.5,
are now the minimum required version for these dependencies.
Furthermore, the minimum tested version for optional dependencies has been updated to
fiona 1.8.21, scipy 1.9, matplotlib 3.7, mapclassify 2.5, folium 0.12 and
SQLAlchemy 2.0. Older versions of these libraries may continue to work, but are no longer
considered supported (#3371).

New features and improvements:

- Add ``grid_size`` parameter to ``union_all`` and ``dissolve`` (#3445).

Bug fixes:

- Fix an issue that showed numpy dtypes in bbox in `to_geo_dict` and `__geo_interface__`. (#3436)
- Fix an issue in `sample_points` that could occasionally result in non-uniform distribution (#3470)

New features and improvements:

- `GeoDataFrame.plot` now supports `pd.Index` as an input for the `column` keyword (#3463).

## Version 1.0.2 (???)
- Avoid change of the plot aspect when plotting missing values (#3438).

Bug fixes:

- Fix an issue that showed numpy dtypes in bbox in `to_geo_dict` and `__geo_interface__`. (#3436)
- Fix an issue in `sample_points` that could occasionally result in non-uniform distribution (#3470).
- Fix unspecified layer warning being emitted while reading multilayer datasets, even
when layer is specified when using the mask or bbox keywords (#3378).
- Properly support named aggregations over a geometry column in `GroupBy.agg` (#3368).
@@ -38,7 +22,18 @@ Bug fixes:
- Fix regression where `overlay` with `keep_geom_type` returns wrong results if the
input contains invalid geometries (#3395).
- Fix the dtype of the GeometryArray backing data being incorrect for zero length
GeoDataFrames causing errors in `overlay` (3424).
GeoDataFrames causing errors in `overlay` (#3424).
- Fix regression where constructing a GeoSeries from a pd.Series with GeometryDtype values
failed when `crs` was provided (#3383).

Notes on dependencies:

- GeoPandas 1.1 now requires Python 3.10 or greater and pandas 2.0, numpy 1.24, pyproj 3.5,
are now the minimum required version for these dependencies.
Furthermore, the minimum tested version for optional dependencies has been updated to
fiona 1.8.21, scipy 1.9, matplotlib 3.7, mapclassify 2.5, folium 0.12 and
SQLAlchemy 2.0. Older versions of these libraries may continue to work, but are no longer
considered supported (#3371).

Deprecations and compatibility notes:

2 changes: 1 addition & 1 deletion geopandas/plotting.py
Original file line number Diff line number Diff line change
@@ -882,7 +882,7 @@ def plot_dataframe(
merged_kwds = style_kwds.copy()
merged_kwds.update(missing_kwds)

plot_series(expl_series[nan_idx], ax=ax, **merged_kwds)
plot_series(expl_series[nan_idx], ax=ax, **merged_kwds, aspect=None)

if legend and not color:
if legend_kwds is None:
11 changes: 11 additions & 0 deletions geopandas/tests/test_plotting.py
Original file line number Diff line number Diff line change
@@ -451,6 +451,17 @@ def test_no_missing_and_missing_kwds(self):
df["category"] = df["values"].astype("str")
df.plot("category", missing_kwds={"facecolor": "none"}, legend=True)

def test_missing_aspect(self):
self.df.loc[0, "values"] = np.nan
ax = self.df.plot(
"values",
missing_kwds={"color": "r"},
categorical=True,
legend=True,
aspect=2,
)
assert ax.get_aspect() == 2


class TestPointZPlotting:
def setup_method(self):

0 comments on commit e908d32

Please sign in to comment.