帝王谷资源网 Design By www.wdxyy.com
主要问题
1.介绍
如题,画双轴子图不能显示 x-轴坐标轴标签,似乎 “双轴”与“子图”存在冲突有关,当前版本是 anaconda 3.7.4。比较奇葩的是 我家里的电脑,3.7.3 却没这个问题。但我把公司电脑换成 3.7.3 问题依旧,崩溃。
import pandas as pd import matplotlib.pyplot as plt a = pd.date_range('2020-07-01','2020-07-20') b = [2,3,4,5,7,9,20,20,11,13,1,2,3,9,23,2,6,7,7,7] c = [0.20,0.1,0.13,0.1,0.2,0.3,0.9,0.23,0.2,0.6,0.7,0.7,0.7,0.2,0.3,0.4,0.5,0.7,0.9,0.2] data = pd.DataFrame({'a':a,'b':b,'c':c}) data = data.groupby(['a'])['b','c'].sum() nrow = 2 ncol = 1 fig = plt.figure(figsize=(ncol*10,nrow*4)) ax_1 = plt.subplot2grid((nrow, ncol), (0, 0), colspan=1, rowspan=1,facecolor = 'black') ax_2 = plt.subplot2grid((nrow, ncol), (1, 0), colspan=1, rowspan=1,facecolor = 'black') data['b'].plot(ax = ax_1,color = 'r') data['c'].plot(ax = ax_1.twinx(),color = 'y')
2.只画双轴,正常显示
import pandas as pd import matplotlib.pyplot as plt a = pd.date_range('2020-07-01','2020-07-20') b = [2,3,4,5,7,9,20,20,11,13,1,2,3,9,23,2,6,7,7,7] c = [0.20,0.1,0.13,0.1,0.2,0.3,0.9,0.23,0.2,0.6,0.7,0.7,0.7,0.2,0.3,0.4,0.5,0.7,0.9,0.2] data = pd.DataFrame({'a':a,'b':b,'c':c}) data = data.groupby(['a'])['b','c'].sum() nrow = 1 ncol = 1 fig = plt.figure(figsize=(ncol*10,nrow*4)) ax_1 = plt.subplot2grid((nrow, ncol), (0, 0), colspan=1, rowspan=1,facecolor = 'black') # ax_2 = plt.subplot2grid((nrow, ncol), (1, 0), colspan=1, rowspan=1,facecolor = 'black') data['b'].plot(ax = ax_1,color = 'r') data['c'].plot(ax = ax_1.twinx(),color = 'y')
3.只画子图,也能正常显示
import pandas as pd import matplotlib.pyplot as plt a = pd.date_range('2020-07-01','2020-07-20') b = [2,3,4,5,7,9,20,20,11,13,1,2,3,9,23,2,6,7,7,7] c = [0.20,0.1,0.13,0.1,0.2,0.3,0.9,0.23,0.2,0.6,0.7,0.7,0.7,0.2,0.3,0.4,0.5,0.7,0.9,0.2] data = pd.DataFrame({'a':a,'b':b,'c':c}) data = data.groupby(['a'])['b','c'].sum() nrow = 2 ncol = 1 fig = plt.figure(figsize=(ncol*10,nrow*4)) ax_1 = plt.subplot2grid((nrow, ncol), (0, 0), colspan=1, rowspan=1,facecolor = 'black') ax_2 = plt.subplot2grid((nrow, ncol), (1, 0), colspan=1, rowspan=1,facecolor = 'black') data['b'].plot(ax = ax_1,color = 'r') data['c'].plot(ax = ax_2,color = 'y')
帝王谷资源网 Design By www.wdxyy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
帝王谷资源网 Design By www.wdxyy.com
暂无评论...
更新日志
2024年12月25日
2024年12月25日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]