主要问题
1.介绍
如题,画双轴子图不能显示 x-轴坐标轴标签,似乎 “双轴”与交通事故赔偿协议书范本“子图”存在冲突有关,当前版本是 anaconda 3.7.4。比较奇葩的是 我家里的电脑,3.7.3 却没这个问题。但我把公司电脑换成 3.7.3 问题依旧,崩溃。高三励志口号
import pandas as pdimport matplotlib.pyplot as plta = 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 = 2ncol = 1fig = 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 pdimport matplotlib.pyplot as plta = 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 = 1ncol = 1fig = 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 pdimport matplotlib.pyplot as plta = 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 = 2ncol = 1fig = plt.figure(figsiz皮城出装e=(ncol*10,nrow*4))ax_1 = plt.subp女孩自拍lot2grid((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')
到此这篇关于matplotlib 画双轴子图无法显示x轴的解决方法的文章就介绍到这了,更多相关matplotlib 双轴子无法显示x轴内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章希望大家以后多多支持www.887551.com!
本文发布于:2023-04-04 00:50:53,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/4090f42960b0605eca00ec684f4caba2.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:matplotlib 画双轴子图无法显示x轴的解决方法.doc
本文 PDF 下载地址:matplotlib 画双轴子图无法显示x轴的解决方法.pdf
留言与评论(共有 0 条评论) |