diff --git a/plotly/figure_factory/_annotated_heatmap.py b/plotly/figure_factory/_annotated_heatmap.py
index f40d7f26b..605b7d825 100644
--- a/plotly/figure_factory/_annotated_heatmap.py
+++ b/plotly/figure_factory/_annotated_heatmap.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import
+from __future__ import absolute_import, division
 
 from plotly import exceptions, optional_imports
 import plotly.colors as clrs
@@ -234,8 +234,8 @@ class _AnnotatedHeatmap(object):
             z_min = np.amin(self.z)
             z_max = np.amax(self.z)
         else:
-            z_min = min(min(self.z))
-            z_max = max(max(self.z))
+            z_min = min([v for row in self.z for v in row])
+            z_max = max([v for row in self.z for v in row])
         z_mid = (z_max+z_min) / 2
         return z_mid
 

Annotated heatmaps: font colour blends with the colour of the square.
When using the default color scheme, the font color contrasts normally with the fill of the each heatmap square. But if you try other standard color schemes with `reversescale=True`, when values are close to zero, the colors will merge. I think this is the wrong default behavior.
diff --git a/plotly/tests/test_optional/test_tools/test_figure_factory.py b/plotly/tests/test_optional/test_tools/test_figure_factory.py
index b3ddc298b..655be1570 100644
--- a/plotly/tests/test_optional/test_tools/test_figure_factory.py
+++ b/plotly/tests/test_optional/test_tools/test_figure_factory.py
@@ -773,7 +773,7 @@ class TestAnnotatedHeatmap(TestCase, NumpyTestUtilsMixin):
                                         'xref': 'x',
                                         'y': 0,
                                         'yref': 'y'},
-                                       {'font': {'color': '#FFFFFF'},
+                                       {'font': {'color': '#000000'},
                                         'showarrow': False,
                                         'text': '0.5',
                                         'x': 2,
@@ -872,7 +872,7 @@ class TestAnnotatedHeatmap(TestCase, NumpyTestUtilsMixin):
                                   'xref': 'x',
                                   'y': 'Three',
                                   'yref': 'y'},
-                                 {'font': {'color': '#000000'},
+                                 {'font': {'color': '#FFFFFF'},
                                   'showarrow': False,
                                   'text': 'sixth',
                                   'x': 'B',
@@ -951,7 +951,7 @@ class TestAnnotatedHeatmap(TestCase, NumpyTestUtilsMixin):
                            'xref': 'x',
                            'y': 'Three',
                            'yref': 'y'},
-                          {'font': {'color': '#FFFFFF'},
+                          {'font': {'color': '#000000'},
                            'showarrow': False,
                            'text': 'sixth',
                            'x': 'B',
@@ -972,6 +972,91 @@ class TestAnnotatedHeatmap(TestCase, NumpyTestUtilsMixin):
         self.assert_fig_equal(a['layout'],
                               expected_a['layout'])
 
+    def test_bug_1300(self):
+        # https://github.com/plotly/plotly.py/issues/1300
+        sub_z = [
+            [0.1, 0.0, 0.0],
+            [0.0, 1.0, 0.1]]
+
+        # sub_z = sub_z.tolist()
+
+        # Standard scale direction
+        fig = ff.create_annotated_heatmap(
+            sub_z, colorscale='Greens', showscale=True, reversescale=True)
+
+        expected = graph_objs.Figure({
+            'data': [{'colorscale': 'Greens',
+                      'reversescale': True,
+                      'showscale': True,
+                      'type': 'heatmap',
+                      'uid': 'baeae9f0-d650-4507-99ba-97226bb8fe6c',
+                      'z': [[0.1, 0., 0.],
+                            [0.,  1., 0.1]]}],
+            'layout': {
+                'annotations': [
+                    {'font': {'color': '#000000'},
+                     'showarrow': False,
+                     'text': '0.1',
+                     'x': 0,
+                     'xref': 'x',
+                     'y': 0,
+                     'yref': 'y'},
+                    {'font': {'color': '#000000'},
+                     'showarrow': False,
+                     'text': '0.0',
+                     'x': 1,
+                     'xref': 'x',
+                     'y': 0,
+                     'yref': 'y'},
+                    {'font': {'color': '#000000'},
+                     'showarrow': False,
+                     'text': '0.0',
+                     'x': 2,
+                     'xref': 'x',
+                     'y': 0,
+                     'yref': 'y'},
+                    {'font': {'color': '#000000'},
+                     'showarrow': False,
+                     'text': '0.0',
+                     'x': 0,
+                     'xref': 'x',
+                     'y': 1,
+                     'yref': 'y'},
+                    {'font': {'color': '#FFFFFF'},
+                     'showarrow': False,
+                     'text': '1.0',
+                     'x': 1,
+                     'xref': 'x',
+                     'y': 1,
+                     'yref': 'y'},
+                    {'font': {'color': '#000000'},
+                     'showarrow': False,
+                     'text': '0.1',
+                     'x': 2,
+                     'xref': 'x',
+                     'y': 1,
+                     'yref': 'y'}
+                ],
+                'xaxis': {
+                    'gridcolor': 'rgb(0, 0, 0)',
+                    'showticklabels': False,
+                    'side': 'top',
+                    'ticks': ''},
+                'yaxis': {
+                    'showticklabels': False,
+                    'ticks': '',
+                    'ticksuffix': '  '}}
+        })
+
+        # Remove uids
+        for trace in fig.data:
+            trace.update(uid=None)
+        for trace in expected.data:
+            trace.update(uid=None)
+
+        # Perform comparison
+        self.assert_fig_equal(fig, expected)
+
 
 class TestTable(TestCase, NumpyTestUtilsMixin):
 

pip install -e .[dev]
parse_log_pytest
requirements.txt
numpy>=1.16.0 pandas>=1.0.0 scipy pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
3.7
requirements/base.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==24.2.0
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
coverage==7.2.7
decorator==5.1.1
exceptiongroup==1.2.2
execnet==2.0.2
fastjsonschema==2.21.1
idna==3.10
importlib-metadata==6.7.0
importlib-resources==5.12.0
iniconfig==2.0.0
jsonschema==4.17.3
jupyter_core==4.12.0
nbformat==5.8.0
numpy==1.21.6
packaging==24.0
pandas==1.3.5
pkgutil_resolve_name==1.3.10
-e git+https://github.com/plotly/plotly.py.git@7fa25ae6d0dfee4ea0df775b80ac1b734d0a1c2f#egg=plotly
pluggy==1.2.0
pyrsistent==0.19.3
pytest==7.4.4
pytest-asyncio==0.21.2
pytest-cov==4.1.0
pytest-mock==3.11.1
pytest-xdist==3.5.0
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.31.0
retrying==1.3.4
scipy==1.7.3
six==1.17.0
tomli==2.0.1
traitlets==5.9.0
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0

name: plotly.py
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==24.2.0
      - charset-normalizer==3.4.1
      - coverage==7.2.7
      - decorator==5.1.1
      - exceptiongroup==1.2.2
      - execnet==2.0.2
      - fastjsonschema==2.21.1
      - idna==3.10
      - importlib-metadata==6.7.0
      - importlib-resources==5.12.0
      - iniconfig==2.0.0
      - jsonschema==4.17.3
      - jupyter-core==4.12.0
      - nbformat==5.8.0
      - numpy==1.21.6
      - packaging==24.0
      - pandas==1.3.5
      - pkgutil-resolve-name==1.3.10
      - pluggy==1.2.0
      - pyrsistent==0.19.3
      - pytest==7.4.4
      - pytest-asyncio==0.21.2
      - pytest-cov==4.1.0
      - pytest-mock==3.11.1
      - pytest-xdist==3.5.0
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - requests==2.31.0
      - retrying==1.3.4
      - scipy==1.7.3
      - six==1.17.0
      - tomli==2.0.1
      - traitlets==5.9.0
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - zipp==3.15.0
prefix: /opt/conda/envs/plotly.py

plotly/tests/test_optional/test_tools/test_figure_factory.py::TestAnnotatedHeatmap::test_annotated_heatmap_kwargs plotly/tests/test_optional/test_tools/test_figure_factory.py::TestAnnotatedHeatmap::test_annotated_heatmap_reversescale plotly/tests/test_optional/test_tools/test_figure_factory.py::TestAnnotatedHeatmap::test_bug_1300 plotly/tests/test_optional/test_tools/test_figure_factory.py::TestAnnotatedHeatmap::test_simple_annotated_heatmap
plotly/tests/test_optional/test_tools/test_figure_factory.py::TestQuiver::test_more_kwargs plotly/tests/test_optional/test_tools/test_figure_factory.py::TestQuiver::test_one_arrow plotly/tests/test_optional/test_tools/test_figure_factory.py::TestQuiver::test_unequal_xy_length plotly/tests/test_optional/test_tools/test_figure_factory.py::TestQuiver::test_wrong_arrow_scale plotly/tests/test_optional/test_tools/test_figure_factory.py::TestQuiver::test_wrong_scale plotly/tests/test_optional/test_tools/test_figure_factory.py::TestFinanceCharts::test_datetime_candlestick plotly/tests/test_optional/test_tools/test_figure_factory.py::TestFinanceCharts::test_datetime_ohlc plotly/tests/test_optional/test_tools/test_figure_factory.py::TestFinanceCharts::test_direction_arg plotly/tests/test_optional/test_tools/test_figure_factory.py::TestFinanceCharts::test_high_highest_value plotly/tests/test_optional/test_tools/test_figure_factory.py::TestFinanceCharts::test_low_lowest_value plotly/tests/test_optional/test_tools/test_figure_factory.py::TestFinanceCharts::test_one_candlestick plotly/tests/test_optional/test_tools/test_figure_factory.py::TestFinanceCharts::test_one_ohlc plotly/tests/test_optional/test_tools/test_figure_factory.py::TestFinanceCharts::test_one_ohlc_decrease plotly/tests/test_optional/test_tools/test_figure_factory.py::TestFinanceCharts::test_one_ohlc_increase plotly/tests/test_optional/test_tools/test_figure_factory.py::TestFinanceCharts::test_unequal_ohlc_length plotly/tests/test_optional/test_tools/test_figure_factory.py::TestAnnotatedHeatmap::test_incorrect_x_size plotly/tests/test_optional/test_tools/test_figure_factory.py::TestAnnotatedHeatmap::test_incorrect_y_size plotly/tests/test_optional/test_tools/test_figure_factory.py::TestAnnotatedHeatmap::test_unequal_z_text_size plotly/tests/test_optional/test_tools/test_figure_factory.py::TestTable::test_fontcolor_input plotly/tests/test_optional/test_tools/test_figure_factory.py::TestTable::test_simple_table plotly/tests/test_optional/test_tools/test_figure_factory.py::TestTable::test_table_with_index plotly/tests/test_optional/test_tools/test_figure_factory.py::TestGantt::test_gannt_groups_and_descriptions plotly/tests/test_optional/test_tools/test_figure_factory.py::TestGantt::test_gantt_all_args plotly/tests/test_optional/test_tools/test_figure_factory.py::TestGantt::test_gantt_index plotly/tests/test_optional/test_tools/test_figure_factory.py::TestGantt::test_gantt_validate_colors plotly/tests/test_optional/test_tools/test_figure_factory.py::TestGantt::test_validate_gantt plotly/tests/test_optional/test_tools/test_figure_factory.py::Test2D_Density::test_2D_density_all_args plotly/tests/test_optional/test_tools/test_figure_factory.py::Test2D_Density::test_validate_2D_density
plotly/figure_factory/_annotated_heatmap.py
plotly/figure_factory/_annotated_heatmap.py