Skip to content

Instantly share code, notes, and snippets.

@YiHui-Liu
Created February 1, 2024 13:49
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save YiHui-Liu/1ed2f9484c5e20587d016e5d7854c273 to your computer and use it in GitHub Desktop.
Save YiHui-Liu/1ed2f9484c5e20587d016e5d7854c273 to your computer and use it in GitHub Desktop.
WeChatMsgAnalysis.ipynb
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Endragon2003
Copy link

东西做的很好很全,但是因为python1的版本问题,我使用的时候产生了不少错误。
首先,每周活跃分析ax = sns.barplot(data=data, errorbar=None)这句话导致最终的图像x轴只有0,通过修改为ax = sns.barplot(x=data.index, y=data.values, order=["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], errorbar=None)能正常显示七个x轴,但是颜色不统一。
另外在后面但凡包括hue_norm=norm的图像(后面绝大部分都包括),全部显示AttributeError: 'Rectangle' object has no property 'hue_norm',而删掉之后图像中就缺失了柱子。
另外虽然paddlenlp我已经安装了好几次但是程序就是获取不到。
我的python版本是3.7,paddlenlp获取不到可能与python版本过低有关。至于hue_norm参数,很可能也是版本问题,但是我不知道是谁的问题,您的文档中也没有版本说明,可以补全以下方便我们修改查证吗?
另外有几点,首先那个根据句子长度的图表,很多时候x轴数据太长(但凡互相发过小作文),就导致之前看不清,那个sN我没看明白,最好把ax.set_xlim(0, xlim)后面的xlim改成想要的数字。
然后词云的分辨率有点低,没看到参数可以改。
感觉做的蛮好的,都怪python更新从来不考虑兼容性罢了。

@CalvinSMU
Copy link

CalvinSMU commented Feb 14, 2024

1.词汇的分辨率可以修改的
def wordCloud(text, font, mask, cmap,img): wc = WordCloud( background_color="white", scale=5, font_path=font, mask=mask, colormap=cmap, collocations=False, ).generate(text) plt.imshow(wc) plt.axis("off") plt.savefig(img+"_wordcloud.png",dpi=300)
2. hue_norm的问题是我在绘制的时候柱形会消失,我的版本是python3.9,这个不知道怎么解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment