如何将X/Y轴的缩放尺度更改为绘制Pandas DataFrame中的异常值?
在我试图在散点图上绘制的一组数据点中,有几个巨大的异常点。作为参考,大多数值范围在0-100之间,但偶尔有一个异常点为100000。因此,当我在散点图,盒子图或任何绘图上绘制图形时,它会缩小太大的放大以适合所有指出,范围为0-100的99%的点看起来像一个小点。有什么方法可以缩放它,以便对点的前99%进行相应的缩放,并使刻度跳到异常点的值,以使其适合图表?
这是图表的外观:
框图:
散点图:
In a set of datapoints I am trying to graph on a scatterplot, there are a couple of huge anomaly points. For reference, most values range between 0-100 but occasionally there is an anomalous point of 100000. Because of this, when I graph on a scatterplot, box plot, or any plot that is, it zooms out so much to fit in all the points that the 99% of the points that range between 0-100 just looks like a tiny dot. Is there any way I can scale it so that the first 99% of the points are scaled accordingly and have the scale skip to the anomaly point's value so it fits in the graph?
Here is how the graphs look:
Box Plot:
Scatter Plot:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用限制使用plt.axis()函数。
plt.axis([x_min,x_max,y_min,y_max])
其中x_min,x_max,y_min和y_max是两个斧头的坐标极限
Use the plt.axis() function with your limits.
plt.axis([x_min, x_max, y_min, y_max])
where x_min, x_max, y_min, and y_max are the coordinate limits for both axe
您可以将X/Y轴刻度设置为记录,也可以将X/Y上的限制设置为X/Y(例如
plt.xlim(0,200)
)以从图表中隐藏异常:You can set x/y axis scale to log or just set limit on x/y (with
plt.xlim(0,200)
for example) to hide anomalies from your chart:otset
library 可以帮助您进行多尺度可视化以考虑大型含量超级超级距离。示例
绘制所有数据,包括离群值,然后绘制一个仅显示非外观的变焦面板。
这个两轴网格很容易被重新排列到插图中。
只需在显示或保存之前添加以下行,
Outset.inset_outsets
提供了kwarg选项,如果需要,可以微调插图放置。安装
以安装启动库,
python3 -m pip安装启动
。除了上面显示的面向数据的变焦区域选择外,该库还
提供了明确的API,可以手动指定缩放区域以及许多样式和布局选项。
请参阅发明 QuickStart Guide 和 gallery 有关更多信息。
披露:AM图书馆作者
The
outset
library can help make multiscale visualizations to account for large-magnitude outliers.Example
Plot all data, including outliers and then a zoom panel showing only non-outliers.
This two-axes grid can easily be rearranged into an inset.
Just add the following line before showing or saving,
outset.inset_outsets
provides kwarg options to fine tune inset placement, if desired.Installation
To install the outset library,
python3 -m pip install outset
.Additional Features
In addition to data-oriented zoom area selection shown above, the library also provides an explicit API to manually specify zoom areas as well as many styling and layout options.
Refer to the outset quickstart guide and gallery for more info.
Disclosure: am library author