我试图制作与下面相同的图表,不知道matplotlib是否有类似的图表
下表是R包中STM主题模型的结果
我在Python中使用DMR获得probs值:
array([[0.07204196, 0.04238116],
[0.04518877, 0.30546978],
[0.0587892 , 0.19870868],
[0.16710107, 0.07182639],
[0.128209 , 0.02422131],
[0.15264449, 0.07237352],
[0.2250081 , 0.06986096],
[0.1337716 , 0.10750801],
[0.01197221, 0.06736039],
[0.00527367, 0.04028973]], dtype=float32)
这些是结果,左边是否定的,右边是肯定的
负-正比例图示例:
可以创建与您包含的图像非常接近的内容。我知道右栏应该是负数,而右栏应该是正数
首先将数据设为负数:
然后我们可以这样画:
哪些产出:
如果需要更改打印或x轴上文本的位置,可以调整对
ax.annotate
和ax.text
的调用中的值我不确定问题的关键部分是什么。也就是说,您更感兴趣的是基于类别标记各个点,还是更关心带有一条直线的唯一圆。对于提供的数组,数据表示的内容有点混乱
我假设每个子列表代表一个类别。考虑到这一点,我所做的是为值的差异制作一个单独的列(delta),然后将它们与索引进行对比
从中可以看出:
相关问题 更多 >
编程相关推荐