colorbar

How to remove a colorbar

How to remove a colorbar Question: I want to remove a color bar from an axes in that way that the axes will return to its default position. To make it clear, have a look at this code (or better run it): import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable # …

Total answers: 1

using scientific notation kdeplot

using scientific notation kdeplot Question: I’m trying to create a kde plot using seaborn in python but when setting the colorbar values to show in scientific notation I see no difference. See – making colorbar with scientific notation in seaborn for a heavily related topic. See – https://seaborn.pydata.org/generated/seaborn.kdeplot.html for the documentation of seaborn’s kde class. …

Total answers: 1

How to add a colorbar to kdeplot and jointplot

How to add a colorbar to kdeplot and jointplot Question: When generating bivariate plots like hexbin, pandas generates a legend explaining frequency value for each color shade: pokemon.plot.hexbin(x=’HP’, y=’Attack’, gridsize=30) I cannot find a similar way to generate such a legend for jointplot and kdeplot in seaborn: sns.jointplot(data=pokemon, x=’HP’, y=’Attack’, kind=’hex’) sns.kdeplot(pokemon[‘HP’], pokemon[‘Attack’], shade=True) How …

Total answers: 1

Properly adding a second set of ticks to python matplotlib colorbar

Properly adding a second set of ticks to python matplotlib colorbar Question: I have a figure with three subplots. The top two subplots share a similar data range, while the bottom one shows data with a different data range. I’d like to use only one colorbar for the whole figure by having ticks for the …

Total answers: 2

Log scales with Seaborn kdeplot

Log scales with Seaborn kdeplot Question: I am trying to make a nice free energy surface (heat map) using Seaborn’s kdeplot. I am very close but can not figure out a way to change the color bar scale. The color bar scale is important since it is supposed to represent the difference in energy at …

Total answers: 3

How to "cut" the unwanted part of a colorbar

How to "cut" the unwanted part of a colorbar Question: Say you create an image with imshow like this: plt.set_cmap(‘viridis’) im=plt.imshow(mydata, interpolation=’nearest’,origin=’lower’) plt.title(‘mymap’) cbar=plt.colorbar() a=round(mydata.max(),0) cbar.set_ticks([17,23,a]) cbar.set_ticklabels([17,23,a]) Say you have a continuous-like dataset where most values are 0, but then there’s a jump leading to the range of highest values. How do you “cut” the …

Total answers: 2

How to use and plot only a part of a colorbar?

How to use and plot only a part of a colorbar? Question: I have multiple curves that differ in one parameter and which I want to plot in one figure. To distinguish them, I want to use one of matplotlib’s colorbars. To do so I produce a list of colors depending on said parameter. Additionally, …

Total answers: 1

How to add a colorbar to a seaborn kdeplot

How to add a colorbar to a seaborn kdeplot Question: I want to create a Kernel-Density-Estimation with seaborn.kdeplot with a colorbar on the side. import matplotlib.pyplot as plt import seaborn as sns import numpy as np; np.random.seed(10) import seaborn as sns; sns.set(color_codes=True) mean, cov = [0, 2], [(1, .5), (.5, 1)] x, y = np.random.multivariate_normal(mean, …

Total answers: 2

Matplotlib colorbar ticks on left/opposite side

Matplotlib colorbar ticks on left/opposite side Question: One could generate a vertical colorbar like so(simplified): import matplotlib.pyplot as plt import matplotlib as mpl plt.figure() c_ax=plt.subplot(111) cb = mpl.colorbar.ColorbarBase(c_ax,orientation=’vertical’) plt.savefig(‘my_colorbar.png’) Resulting in something like this(rotated for space reasons): Is it possible to get the ticks labels on the opposite side? Asked By: M.T || Source Answers: …

Total answers: 4

Top label for matplotlib colorbars

Top label for matplotlib colorbars Question: By default matplotlib would position colorbar labels alongside the vertical colorbars. What is the best way to force the label to be on top of a colorbar? Currently my solution needs adjusting labelpad and y values depending on size of the label: import numpy as np import matplotlib.pylab as …

Total answers: 1