小编Mar*_*n B的帖子

"subl"命令无法正常工作

我在终端中使用"subl"命令时遇到问题.它过去工作正常,但最近我运行它确实打开我想要的文件,但我无法编辑它们,而且Sublime Text没有显示在我的Mac的顶部栏中,好像它根本没有运行(有)除了码头上的图标之外没有任何点.我打开它就好像它只是一个窗口而不是一个应用程序......但是当我点击停靠栏中的图标时它工作得很好!

我从2008年开始在Lion上运行旧的macbook.

谢谢你的帮助(我是新手),

赞赏

macos terminal osx-lion sublimetext2

13
推荐指数
1
解决办法
1万
查看次数

如何使用matplotlib防止对字符串进行字母排序?

我正在使用条形图绘制一些分类数据.即使我对数据帧值进行排序,Matplotlib也会按字母顺序对x轴进行排序.这是我的代码:

fig3, new_ax = plt.subplots(1,1, figsize=(25/3,5))
summary = tsa.source.sum().sort_values(ascending=False)
new_ax.bar(summary.index, summary.values, color=my_colors)
new_ax.legend()
bar_heights(new_ax) # custom function to get the values on top of bars
simpleaxis(new_ax) # custom function to define an axis to please my boss...
new_ax.set_ylabel('Effectifs')
new_ax.set_xlabel("Type d'arme")
new_ax.grid(False)
Run Code Online (Sandbox Code Playgroud)

输出: 在此输入图像描述

然而,这是总结的样子,这是我想在我的图表上看到的顺序:

famas            2214.0
aut_typebruit     759.0
grena             200.0
flg                78.0
douze              72.0
sept               53.0
dtype: float64
Run Code Online (Sandbox Code Playgroud)

这是我的数据样本的链接:https: //files.fm/u/wumscb4q 用以下行导入它:

tsa.source = pd.read_csv('sample.csv', sep=';', index_col=0)
Run Code Online (Sandbox Code Playgroud)

在这里我的功能:

def simpleaxis(ax):
    ax.spines['top'].set_visible(False)
    ax.spines['right'].set_visible(False)
    ax.get_xaxis().tick_bottom()
    ax.get_yaxis().tick_left()

def bar_heights(axes):
    for rect in axes.containers[0]: …
Run Code Online (Sandbox Code Playgroud)

python matplotlib python-3.x

8
推荐指数
2
解决办法
4283
查看次数

线条不显示在条形图上

我正在尝试在条形图上绘制一条线。

这是我的数据框:

       meh  fiches     ratio
2007  1412    1338  0.947592
2008  1356    1324  0.976401
2009  1394    1298  0.931133
2010  1352    1275  0.943047
2011  1398    1325  0.947783
2012  1261    1215  0.963521
2013  1144     845  0.738636
2014  1203    1167  0.970075
2015  1024    1004  0.980469
2016  1197    1180  0.985798
Run Code Online (Sandbox Code Playgroud)

当我运行这两行时,我得到:

ax = graph[['meh', 'fiches']].plot(kind='bar', color=['#666666','#999999'])
graph[['ratio']].plot(kind='line',color='red', linestyle='-', secondary_y=True, ax=ax)
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

但是,如果我删除 kind='bar' 我会得到三行,如果我将 kind='line' 更改为 kind='bar' 我得到三行...

python matplotlib dataframe python-3.x pandas

5
推荐指数
1
解决办法
451
查看次数