小编dsh*_*les的帖子

如何在Seaborn boxplot中编辑胡须,传单,帽子等属性

我使用Seaborn包创建了一个带有重叠stripplot的嵌套boxplot.我在stackoverflow上看到了关于如何使用sns.boxplot生成的ax.artists 为单个框所有框编辑属性的答案.

有没有办法用类似的方法编辑whisker,cap,flier等属性?目前我必须手动编辑seaborn - > categorical.py文件中类的restyle_boxplot方法中的值,_BoxPlotter()以从默认绘图到所需的绘图:

默认情节: 默认情节

期望的情节: 期望的情节

这是我的代码供参考:

sns.set_style('whitegrid')

fig1, ax1 = plt.subplots()


ax1 = sns.boxplot(x="Facility", y="% Savings", hue="Analysis",
             data=totalSavings)

plt.setp(ax1.artists,fill=False) # <--- Current Artist functionality

ax1 = sns.stripplot(x="Facility", y="% Savings", hue="Analysis",
                    data=totalSavings, jitter=.05,edgecolor = 'gray',
                    split=True,linewidth = 0, size = 6,alpha = .6)

ax1.tick_params(axis='both', labelsize=13)
ax1.set_xticklabels(['Test 1','Test 2','Test 3','Test 4','Test 5'], rotation=90)
ax1.set_xlabel('')
ax1.set_ylabel('Percent Savings (%)', fontsize = 14)


handles, labels = ax1.get_legend_handles_labels()
legend1 = plt.legend(handles[0:3], ['A','B','C'],bbox_to_anchor=(1.05, 1), …
Run Code Online (Sandbox Code Playgroud)

python matplotlib boxplot pandas seaborn

5
推荐指数
2
解决办法
5726
查看次数

在Windows 10上使用f2py和Python 3.6编译fortran模块

我正在尝试(并且失败)在Windows 10上使用f2py和Python 3.6 编译fortran模块(特别来自BGS的igrf12.f).使用Anaconda 4.4.10安装Python.

我的设置:

  • Python 3.6.3 | Anaconda自定义(64位)| (默认情况下,2017年10月15日,03:27:45)[MSC v.1900 64位(AMD64)]在win32上
  • Windows 10企业版(1703版)
  • NumPy 1.14.0

我按照SciPy文档中的 f2py指示和Dr.Michael Hirsch 的非常有用的指导.Dr.Hirsch创建了pyigrf12模块,但是通过pip安装失败了,这最初引起了我对f2py的兴趣.

我将概述我正在使用的一些方法.无论方法如何,我总是首先使用f2py igrf12.f -m pyigrf12 -h igrf12.pyf并适当地添加intent(in/out)属性来创建*.pyf签名文件.

  • 方法1:使用C:\ MinGW和 --compiler=mingw32
  • 方法2:使用C:\ MinGW和 --compiler=msvc
  • 方法3:使用anaconda版本的mingw和 --compiler=mingw32
  • 方法4:使用anaconda版本的mingw和 --compiler=msvc

方法1:

对于后台,我在C:\ MinGW有MinGW,我已将C:\ MinGW\bin添加到我的用户Path.不幸的是,我没有安装这个版本的MinGW(我从同事那里继承了这台电脑),所以我不知道它的来源.gcc --version和gfortran --version是5.3.0.

我跑f2py -c igrf12.pyf igrf12.f --compiler=mingw32.此失败并显示以下错误消息:

Building import library (arch=AMD64):
"C:\Users\Sholes\AppData\Local\Continuum\anaconda3\libs\libpython36.a" 
(from C:\Users\Sholes\AppData\Local\Continuum\anaconda3\python36.dll)
    objdump.exe: C:\Users\Sholes\AppData\Local\Continuum\anaconda3\python36.dll: File format not recognized

Traceback (most recent call last):
  File "C:\Users\Sholes\AppData\Local\Continuum\anaconda3\Scripts\\f2py.py", line 28, in …
Run Code Online (Sandbox Code Playgroud)

mingw f2py anaconda windows-10 python-3.6

4
推荐指数
1
解决办法
4694
查看次数