In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces matplotlib how to achieve scale calibration, the article is very detailed, has a certain reference value, interested friends must read it!
1.5. Logarithm or other nonlinear axes
Use plt.xscal () to change the scale of the axis
Import numpy as npimport matplotlib.pyplot as pltfrom matplotlib.ticker import NullFormatter # useful for `logit` scale# Fixing random state for reproducibilitynp.random.seed (19680801) # make up some data in the interval] 0,1 [y = np.random.normal (loc=0.5, scale=0.4, size=1000) y = y [(y > 0) & (y < 1)] y.sort () x = np.arange (len (y)) # plot with various axes scalesplt.figure (1) # linearplt.subplot (221) plt.plot (x Y) plt.yscale ('linear') plt.title (' linear') plt.grid (True) # logplt.subplot plt.plot (x, y) plt.yscale ('log') plt.title (' log') plt.grid (True) # symmetric logplt.subplot (223) plt.plot (x, y-y.mean () plt.yscale ('symlog', linthreshy=0.01) plt.title (' symlog') plt.grid (True) # logitplt.subplot (224) plt.plot (x Y) plt.yscale ('logit') plt.title (' logit') plt.grid (True) # Format the minor tick labels of the y-axis into empty strings with# `NullFormatter`, to avoid cumbering the axis with too many labels.plt.gca (). Yaxis.set_minor_formatter (NullFormatter ()) # Adjust the subplot layout, because the logit one may take more space# than usual, due to y-tick labels like "1-10 ^ {- 3}" plt.subplots_adjust (top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25 Wspace=0.35) plt.show ()
The above is all the content of the article "how to achieve scale scale in matplotlib". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.