seaborn heatmap's colorbar is generating random ticks
See original GitHub issueI am trying to make a heatmap with logarithmic colorbar. But it keeps generating it’s own ticks and ticklabels.
import numpy as np
import seaborn as sns
from matplotlib.colors import LogNorm
import matplotlib.ticker as tkr
matrix = np.random.rand(10, 10)/0.4
vmax=2
vmin=0.5
cbar_ticks = [0.5, 0.75, 1, 1.33, 2]
formatter = tkr.ScalarFormatter(useMathText=True)
formatter.set_scientific(False)
log_norm = LogNorm(vmin=vmin, vmax=vmax)
ax = sns.heatmap(matrix, square=True, vmax=vmax, vmin=vmin, norm=log_norm, cbar_kws={"ticks": cbar_ticks, "format": formatter})
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Seaborn heatmap is generating additional ticks on colorbar ...
python - Seaborn heatmap is generating additional ticks on colorbar when using log scale - Stack Overflow. Stack Overflow for Teams – Start ......
Read more >seaborn.heatmap — seaborn 0.12.1 documentation
Part of this Axes space will be taken and used to plot a colormap, unless cbar is False or a separate Axes is...
Read more >How to manually define color bar scale in seaborn heatmap
I want to define color bar, how to define manually. The automatic color bar ticks getting here are 0.2,0.4,0.6,0.8, but I want to...
Read more >How to remove the axis tick marks on a Seaborn heatmap?
Create random data points with 4×4 dimension. Plot the rectangular data as a color-encoded matrix. Use tick_params() for changing the ...
Read more >How to include labels in sns heatmap
I got your problem like this way: You want to show labels on the x and y-axis on the seaborn heatmap. So for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That
ax.collections[0].colorbar.ax
object is the same as thecax
object in my code, fyi.The following completely removes the ticks and the label.