婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > Python 作圖實(shí)現(xiàn)坐標(biāo)軸截斷(打斷)的效果

Python 作圖實(shí)現(xiàn)坐標(biāo)軸截斷(打斷)的效果

熱門標(biāo)簽:電話機(jī)器人貸款詐騙 看懂地圖標(biāo)注方法 廣東旅游地圖標(biāo)注 打印谷歌地圖標(biāo)注 佛山通用400電話申請 京華圖書館地圖標(biāo)注 蘇州人工外呼系統(tǒng)軟件 淮安呼叫中心外呼系統(tǒng)如何 電話外呼系統(tǒng)招商代理

主題:利用python畫圖實(shí)現(xiàn)坐標(biāo)軸截斷或打斷

關(guān)鍵詞:python, plot, matplotlib, break axes

方法一:

首先介紹一種簡單快速的方法——調(diào)用包 brokenaxes。

詳細(xì)請點(diǎn)擊參考

import matplotlib.pyplot as plt
from brokenaxes import brokenaxes
import numpy as np
fig = plt.figure(figsize=(5,2))
bax = brokenaxes(xlims=((0, .1), (.4, .7)), ylims=((-1, .7), (.79, 1)), hspace=.05, despine=False)
x = np.linspace(0, 1, 100)
bax.plot(x, np.sin(10 * x), label='sin')
bax.plot(x, np.cos(10 * x), label='cos')
bax.legend(loc=3)
bax.set_xlabel('time')
bax.set_ylabel('value')

效果如下:

方法二:

拼接法,該種方法代碼更繁瑣,但更有可能滿足個性化的需求。

請點(diǎn)擊參考鏈接

"""
Broken axis example, where the y-axis will have a portion cut out.
"""
import matplotlib.pyplot as plt
import numpy as np
# 30 points between [0, 0.2) originally made using np.random.rand(30)*.2
pts = np.array([
    0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195, 0.039, 0.161, 0.018,
    0.143, 0.056, 0.125, 0.096, 0.094, 0.051, 0.043, 0.021, 0.138, 0.075,
    0.109, 0.195, 0.050, 0.074, 0.079, 0.155, 0.020, 0.010, 0.061, 0.008])
# Now let's make two outlier points which are far away from everything.
pts[[3, 14]] += .8
# If we were to simply plot pts, we'd lose most of the interesting
# details due to the outliers. So let's 'break' or 'cut-out' the y-axis
# into two portions - use the top (ax) for the outliers, and the bottom
# (ax2) for the details of the majority of our data
f, (ax, ax2) = plt.subplots(2, 1, sharex=True)
# plot the same data on both axes
ax.plot(pts)
ax2.plot(pts)
# zoom-in / limit the view to different portions of the data
ax.set_ylim(.78, 1.)  # outliers only
ax2.set_ylim(0, .22)  # most of the data
# hide the spines between ax and ax2
ax.spines['bottom'].set_visible(False)
ax2.spines['top'].set_visible(False)
ax.xaxis.tick_top()
ax.tick_params(labeltop='off')  # don't put tick labels at the top
ax2.xaxis.tick_bottom()
# This looks pretty good, and was fairly painless, but you can get that
# cut-out diagonal lines look with just a bit more work. The important
# thing to know here is that in axes coordinates, which are always
# between 0-1, spine endpoints are at these locations (0,0), (0,1),
# (1,0), and (1,1).  Thus, we just need to put the diagonals in the
# appropriate corners of each of our axes, and so long as we use the
# right transform and disable clipping.
d = .015  # how big to make the diagonal lines in axes coordinates
# arguments to pass to plot, just so we don't keep repeating them
kwargs = dict(transform=ax.transAxes, color='k', clip_on=False)
ax.plot((-d, +d), (-d, +d), **kwargs)        # top-left diagonal
ax.plot((1 - d, 1 + d), (-d, +d), **kwargs)  # top-right diagonal
kwargs.update(transform=ax2.transAxes)  # switch to the bottom axes
ax2.plot((-d, +d), (1 - d, 1 + d), **kwargs)  # bottom-left diagonal
ax2.plot((1 - d, 1 + d), (1 - d, 1 + d), **kwargs)  # bottom-right diagonal
# What's cool about this is that now if we vary the distance between
# ax and ax2 via f.subplots_adjust(hspace=...) or plt.subplot_tool(),
# the diagonal lines will move accordingly, and stay right at the tips
# of the spines they are 'breaking'
plt.show()

效果如下:

補(bǔ)充:python繪制折線圖--縱坐標(biāo)y軸截斷

看代碼吧~

# -*- coding: utf-8 -*-
"""
Created on Wed Dec  4 21:50:38 2019
@author: muli
"""
import matplotlib.pyplot as plt
from pylab import *                 
mpl.rcParams['font.sans-serif'] = ['SimHei'] #支持中文
 
names = ["1","2","3","4","5"]  # 刻度值命名
x = [1,2,3,4,5]    # 橫坐標(biāo)
y3= [2,3,1,4,5]    # 縱坐標(biāo)
y4= [4,6,8,5,9]    # 縱坐標(biāo)
y5=[24,27,22,26,28]     # 縱坐標(biāo)
f, (ax3, ax) = plt.subplots(2, 1, sharex=False)  # 繪制兩個子圖
plt.subplots_adjust(wspace=0,hspace=0.08) # 設(shè)置 子圖間距
ax.plot(x, y3, color='red', marker='o', linestyle='solid',label=u'1')   # 繪制折線
ax.plot(x, y4, color='g', marker='o', linestyle='solid',label=u'2')  # 繪制折線
plt.xticks(x, names, rotation=45) # 刻度值
ax3.xaxis.set_major_locator(plt.NullLocator()) # 刪除坐標(biāo)軸的刻度顯示
ax3.plot(x, y5, color='blue', marker='o', linestyle='solid',label=u'3')  # 繪制折線
ax3.plot(x, y3, color='red', marker='o', linestyle='solid',label=u'1') # 起圖例作用
ax3.plot(x, y4, color='g', marker='o', linestyle='solid',label=u'2') # 起圖例作用
ax3.set_ylim(21, 30) # 設(shè)置縱坐標(biāo)范圍
ax.set_ylim(0, 10)  # 設(shè)置縱坐標(biāo)范圍
ax3.grid(axis='both',linestyle='-.') # 打開網(wǎng)格線
ax.grid(axis='y',linestyle='-.')   # 打開網(wǎng)格線
ax3.legend() # 讓圖例生效
plt.xlabel(u"λ") #X軸標(biāo)簽
plt.ylabel("mAP") #Y軸標(biāo)簽
ax.spines['top'].set_visible(False)    # 邊框控制
ax.spines['bottom'].set_visible(True) # 邊框控制
ax.spines['right'].set_visible(False)  # 邊框控制
ax3.spines['top'].set_visible(False)   # 邊框控制
ax3.spines['bottom'].set_visible(False) # 邊框控制
ax3.spines['right'].set_visible(False)  # 邊框控制
ax.tick_params(labeltop='off')  
# 繪制斷層線
d = 0.01  # 斷層線的大小
kwargs = dict(transform=ax3.transAxes, color='k', clip_on=False)
ax3.plot((-d, +d), (-d, +d), **kwargs)        # top-left diagonal
kwargs.update(transform=ax.transAxes, color='k')  # switch to the bottom axes
ax.plot((-d, +d), (1 - d, 1 + d), **kwargs)  # bottom-left diagonal
plt.show()

結(jié)果如圖所示:

以上為個人經(jīng)驗(yàn),希望能給大家一個參考,也希望大家多多支持腳本之家。如有錯誤或未考慮完全的地方,望不吝賜教。

您可能感興趣的文章:
  • Python坐標(biāo)軸操作及設(shè)置代碼實(shí)例
  • 使用Python matplotlib作圖時,設(shè)置橫縱坐標(biāo)軸數(shù)值以百分比(%)顯示
  • python matplotlib畫盒圖、子圖解決坐標(biāo)軸標(biāo)簽重疊的問題
  • python使用Matplotlib改變坐標(biāo)軸的默認(rèn)位置
  • python 設(shè)置xlabel,ylabel 坐標(biāo)軸字體大小,字體類型
  • Python利用matplotlib做圖中圖及次坐標(biāo)軸的實(shí)例

標(biāo)簽:中山 江蘇 畢節(jié) 湖州 呼和浩特 駐馬店 衡水 股票

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Python 作圖實(shí)現(xiàn)坐標(biāo)軸截斷(打斷)的效果》,本文關(guān)鍵詞  Python,作圖,實(shí)現(xiàn),坐標(biāo)軸,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Python 作圖實(shí)現(xiàn)坐標(biāo)軸截斷(打斷)的效果》相關(guān)的同類信息!
  • 本頁收集關(guān)于Python 作圖實(shí)現(xiàn)坐標(biāo)軸截斷(打斷)的效果的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av
    亚洲午夜私人影院| 午夜免费欧美电影| 国产欧美日韩在线看| 蜜桃一区二区三区在线| 国产99久久久精品| 日韩美女精品在线| 欧美国产国产综合| 大尺度一区二区| 奇米影视7777精品一区二区| 中文字幕在线视频一区| 91精品国产综合久久精品| 91国偷自产一区二区使用方法| 精品一区二区三区久久| 蜜臀av一级做a爰片久久| 一区二区三国产精华液| 中文字幕一区二区三区在线播放| 欧美精品一区二区在线播放| 欧美高清视频在线高清观看mv色露露十八 | 午夜一区二区三区视频| 欧美午夜一区二区三区免费大片| 91精品国产综合久久久久久漫画| 精品视频免费看| 一区二区三区在线播放| 欧美日韩第一区日日骚| 性久久久久久久久久久久| 日韩久久免费av| 国产盗摄精品一区二区三区在线| 中文字幕在线免费不卡| 成人一区二区三区中文字幕| 一区二区三区欧美视频| 国产成人综合亚洲网站| 亚洲精选视频免费看| 欧美在线视频你懂得| 欧美日韩一区二区三区在线看| 亚洲小说欧美激情另类| 欧美人xxxx| 国产一区二区三区久久久| 中文字幕精品一区二区精品绿巨人 | 激情综合网最新| 亚洲欧洲在线观看av| 亚洲精品久久7777| 欧美一区二区大片| 亚洲成av人片在线观看| 日韩毛片高清在线播放| www国产精品av| 日韩午夜精品视频| 欧美乱熟臀69xxxxxx| 成人福利视频网站| 国产曰批免费观看久久久| 日本三级韩国三级欧美三级| 亚洲精品国久久99热| 中文字幕一区二区三区视频| 国产亚洲一二三区| 26uuu色噜噜精品一区| 日韩一区二区在线播放| 欧美日韩中文精品| 色综合久久久久综合体桃花网| 国产成人亚洲综合a∨婷婷| 麻豆精品久久精品色综合| 日韩二区在线观看| 日韩不卡一二三区| 蜜臀久久99精品久久久画质超高清| 亚洲国产wwwccc36天堂| 亚洲国产一区二区在线播放| 洋洋成人永久网站入口| 亚洲午夜久久久久久久久电影院 | 欧美日韩高清在线| 日本韩国精品一区二区在线观看| 波多野结衣在线一区| 国产精品18久久久久久久久 | 亚洲人精品一区| 久久福利视频一区二区| 一区二区三区四区在线| 一区二区三区在线播| 亚洲国产cao| 麻豆专区一区二区三区四区五区| 人禽交欧美网站| 精品在线一区二区| 国产·精品毛片| 一本一本久久a久久精品综合麻豆| 91一区二区在线| 欧美精品精品一区| 日韩欧美二区三区| 国产精品福利一区| 视频一区二区不卡| 国产v日产∨综合v精品视频| 91啪九色porn原创视频在线观看| 色综合天天综合在线视频| 在线观看视频一区二区| 日韩欧美一级二级三级| 中文av一区特黄| 亚洲sss视频在线视频| 国产成人午夜高潮毛片| 欧美日韩专区在线| 国产欧美一区二区三区网站| 亚洲影视在线播放| 国产a视频精品免费观看| 欧美综合天天夜夜久久| 欧美xfplay| 一区二区三区视频在线观看| 久久草av在线| 欧美亚洲免费在线一区| 欧美国产一区二区| 久久精品国产久精国产| 色美美综合视频| 国产日本欧美一区二区| 五月开心婷婷久久| 99精品国产91久久久久久| 欧美mv日韩mv亚洲| 亚洲成人黄色影院| 91在线丨porny丨国产| 欧美不卡在线视频| 肉色丝袜一区二区| 在线观看视频欧美| 1024成人网| 国产不卡高清在线观看视频| 日韩欧美一级特黄在线播放| 亚洲综合丝袜美腿| av中文一区二区三区| 久久午夜电影网| 日韩电影一区二区三区四区| 91捆绑美女网站| 国产精品久久精品日日| 麻豆一区二区在线| 91精品国产麻豆| 亚洲成人免费影院| 欧美三级视频在线观看| 亚洲综合免费观看高清完整版在线 | 成人av先锋影音| 久久亚洲一级片| 久久国产婷婷国产香蕉| 91精品国产综合久久久久久| 一区二区三区波多野结衣在线观看| 99久久99久久精品免费看蜜桃| 国产欧美一区二区精品性色| 国产大片一区二区| 国产欧美精品国产国产专区| 国产精品一品视频| 国产精品素人视频| www.激情成人| 亚洲美女屁股眼交3| 欧美综合天天夜夜久久| 亚洲国产欧美在线| 在线观看91av| 国产综合久久久久影院| 欧美国产精品一区| 一本大道av一区二区在线播放| 一区二区三区精品视频在线| 欧美性大战久久久久久久| 亚洲一区二区3| 日韩一区二区三区在线视频| 九九九久久久精品| 久久综合久色欧美综合狠狠| 国产成人综合自拍| 一区二区三区国产精品| 制服.丝袜.亚洲.另类.中文| 国产一区二区三区在线观看免费 | 精品亚洲免费视频| 欧美高清在线一区二区| 97久久超碰国产精品电影| 亚洲蜜臀av乱码久久精品蜜桃| 欧美最猛黑人xxxxx猛交| 免费欧美在线视频| 欧美国产日韩精品免费观看| 不卡的电视剧免费网站有什么| 国产精品成人网| 欧美一区二区私人影院日本| 韩国中文字幕2020精品| 亚洲天堂av老司机| 日韩一级欧美一级| 色女孩综合影院| 国产一区二区三区蝌蚪| 樱桃视频在线观看一区| 欧美大片拔萝卜| 在线欧美日韩精品| 国产不卡在线视频| 美女诱惑一区二区| 亚洲麻豆国产自偷在线| www久久久久| 日韩美女视频一区| 欧美剧在线免费观看网站| 不卡av免费在线观看| 九九热在线视频观看这里只有精品| 亚洲欧美日韩精品久久久久| 欧美mv和日韩mv国产网站| 欧美亚洲动漫另类| 99久久综合国产精品| 国模娜娜一区二区三区| 欧美aaa在线| 五月天激情综合| 亚洲乱码国产乱码精品精小说| 久久综合久久综合九色| 4438x成人网最大色成网站| 色哟哟在线观看一区二区三区| 国产麻豆精品theporn| 久久福利视频一区二区| 老汉av免费一区二区三区 | 亚洲人成网站影音先锋播放| 国产亚洲短视频| 久久女同精品一区二区|