You could use colorbar
‘s format
parameter:
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.ticker as ticker
img = np.random.randn(300,300)
myplot = plt.imshow(img)
def fmt(x, pos):
a, b = '{:.2e}'.format(x).split('e')
b = int(b)
return r'${} \times 10^{{{}}}$'.format(a, b)
plt.colorbar(myplot, format=ticker.FuncFormatter(fmt))
plt.show()
Related Contents:
- How to have one colorbar for all subplots
- Set Colorbar Range in matplotlib
- Matplotlib – add colorbar to a sequence of line plots
- matplotlib: colorbars and its text labels
- add colorbar to a sequence of line plots
- How to animate the colorbar in matplotlib
- How can I create a standard colorbar for a series of plots in python
- Remove colorbar from figure
- Matplotlib scatter plot with different text at each data point
- matplotlib: can I create AxesSubplot objects, then add them to a Figure instance?
- What’s the fastest way of checking if a point is inside a polygon in python
- How do I change the size of figures drawn with Matplotlib?
- How can I plot separate Pandas DataFrames as subplots?
- Purpose of “%matplotlib inline”
- Reverse Y-Axis in PyPlot
- How to manually create a legend
- How to add percentages on top of bars in seaborn
- How to put the legend outside the plot
- matplotlib: format axis offset-values to whole numbers or specific number
- Plot two histograms on single chart with matplotlib
- pylab.ion() in python 2, matplotlib 1.1.1 and updating of the plot while the program runs
- Drawing lines between two plots in Matplotlib
- Adding a background image to a plot
- Store mouse click event coordinates with matplotlib
- Plot Pandas DataFrame as Bar and Line on the same one chart
- How can I rotate a matplotlib plot through 90 degrees?
- Matplotlib connect scatterplot points with line – Python
- Managing dynamic plotting in matplotlib Animation module
- matplotlib Legend Markers Only Once
- How to plot different groups of data from a dataframe into a single figure
- Adding a y-axis label to secondary y-axis in matplotlib
- What does the argument mean in fig.add_subplot(111)?
- How to obscure a line behind a surface plot in matplotlib?
- Seaborn Catplot set values over the bars
- How to make a 4d plot using Python with matplotlib
- Imshow: extent and aspect
- How to prevent x-axis labels from overlapping
- Show decimal places and scientific notation on the axis of a matplotlib plot
- Changing plot scale by a factor in matplotlib
- Setting aspect ratio of 3D plot
- How to convert a .wav file to a spectrogram in python3
- Add image annotations to bar plots
- How to rotate matplotlib annotation to match a line?
- Add legends to LineCollection plot
- Adding subplots to a subplot
- Colorbar for matplotlib plot_surface command
- making matplotlib scatter plots from dataframes in Python’s pandas
- view and then close the figure automatically in matplotlib?
- How to plot a gradient color line
- How to create a density plot