Colorbar inherit from Axes by greglucas · Pull Request #20350 · matplotlib/matplotlib · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions doc/api/next_api_changes/behavior/20XXX-GL.rst
4 changes: 2 additions & 2 deletions doc/api/prev_api_changes/api_changes_2.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@ The ``shading`` kwarg to `~matplotlib.axes.Axes.pcolor` has been
removed. Set ``edgecolors`` appropriately instead.


Functions removed from the `.lines` module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Functions removed from the `matplotlib.lines` module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The :mod:`matplotlib.lines` module no longer imports the
``pts_to_prestep``, ``pts_to_midstep`` and ``pts_to_poststep``
Expand Down
2 changes: 1 addition & 1 deletion examples/axes_grid1/demo_axes_divider.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def demo_simple_image(ax):

im = ax.imshow(Z, extent=extent)
cb = plt.colorbar(im)
plt.setp(cb.ax.get_yticklabels(), visible=False)
plt.setp(cb.get_yticklabels(), visible=False)


def demo_locatable_axes_hard(fig):
Expand Down
4 changes: 2 additions & 2 deletions examples/images_contours_and_fields/contour_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
# so let's improve its position.

l, b, w, h = ax.get_position().bounds
ll, bb, ww, hh = CB.ax.get_position().bounds
CB.ax.set_position([ll, b + 0.1*h, ww, h*0.8])
ll, bb, ww, hh = CB.get_position().bounds
CB.set_position([ll, b + 0.1*h, ww, h*0.8])

plt.show()

Expand Down
2 changes: 1 addition & 1 deletion examples/images_contours_and_fields/contourf_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

# Make a colorbar for the ContourSet returned by the contourf call.
cbar = fig1.colorbar(CS)
cbar.ax.set_ylabel('verbosity coefficient')
cbar.set_ylabel('verbosity coefficient')
# Add the contour line levels to the colorbar
cbar.add_lines(CS2)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def heatmap(data, row_labels, col_labels, ax=None,

# Create colorbar
cbar = ax.figure.colorbar(im, ax=ax, **cbar_kw)
cbar.ax.set_ylabel(cbarlabel, rotation=-90, va="bottom")
cbar.set_ylabel(cbarlabel, rotation=-90, va="bottom")

# We want to show all ticks...
ax.set_xticks(np.arange(data.shape[1]))
Expand Down
4 changes: 2 additions & 2 deletions examples/ticks_and_spines/colorbar_tick_labelling_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

# Add colorbar, make sure to specify tick locations to match desired ticklabels
cbar = fig.colorbar(cax, ticks=[-1, 0, 1])
cbar.ax.set_yticklabels(['< -1', '0', '> 1']) # vertically oriented colorbar
cbar.set_yticklabels(['< -1', '0', '> 1']) # vertically oriented colorbar

###############################################################################
# Make plot with horizontal colorbar
Expand All @@ -42,6 +42,6 @@
ax.set_title('Gaussian noise with horizontal colorbar')

cbar = fig.colorbar(cax, ticks=[-1, 0, 1], orientation='horizontal')
cbar.ax.set_xticklabels(['Low', 'Medium', 'High']) # horizontal colorbar
cbar.set_xticklabels(['Low', 'Medium', 'High']) # horizontal colorbar

plt.show()
102 changes: 49 additions & 53 deletions lib/matplotlib/colorbar.py
Loading