julia - Add tag with coordinates to plot in Plots.jl
问题描述
I have a plot with intersecting lines:
And I would like to add a tag or pointer which point to the intersection and display the coordinates of the intersection. Something like this:
I know the coordinates of the intersection and I know that the function annotate!
adds text to the plot. However, I do not know how to add a line or arrow to point to the intersection and how to determine the right position for the text.
解决方案
我同意这不是最用户友好的事情,但我认为它也不是那么容易实现(实际上,当我在实践中这样做时,我经常诉诸于仅导出到 PowerPoint,然后手动注释绘图) - 但这是一种方法:
julia> using Plots
julia> plot(x -> x^2, 0:0.01:2); hline!([1], color = :red, linestyle = :dash); vline!([1], color = :green, linestyle = :dash)
julia> quiver!([0.5], [2], quiver = ([0.475], [-0.95]))
julia> annotate!([0.5], [2.1], text("This point is (1,1)"), valign = :top)
推荐阅读
- python - Pandas:基于条件的广泛数据框
- opencv - 使用 opencv2 和 numpy 使用其边界框旋转图像以 45 度角产生更差的框
- bash - 如何在 bash 文件中正确添加和删除符号链接
- javascript - 表元素断言
- android - com.app.MainActivity 不能转换为 com.facebook.react.ReactActivity
- sql - SQL 性能对约束或唯一索引中的多个列的影响
- vb.net - VB.NET 数据库不在 MS Access 和登录错误
- python - 解析 HTML——为什么这个文档必须用文本而不是标签来解析?
- r - 使用 effsize 包中的 cohen.d 函数时出错(“row.names”长度无效)
- python - /api/register/ 'module' 对象的 TypeError 不可调用