问题标签 [direct-labels]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
r - 用 direct.labels 标记两个轮廓
我正在尝试比较两个标量字段,并希望使用等值线将它们绘制在同一个图中,使用直接标签标记它们的值。问题是,我不能在同一个情节中使用两个直接标签。
例子:
只有一个变量被标记。
另一种方式:
有什么解决办法吗?
谢谢!
r - directlabels: using different positioning methods for different panels in the same plot
I have a two-panel lattice lineplot. I want to use the directlabels
package to automatically label the lines in each plot. But I want to use a different positioning method for each plot. Specifically, I want to use the first.bumpup
method for the first panel, and the last.bumpup
method for the second panel. Here is a minimal example:
This code produces a plot in which labels appear on the left-hand side of each panel:
I want labels on the left-hand side of the left-hand panel (as in this example), but on the right-hand side of the right-hand panel. What is the simplest way to produce that sort of figure?
I've checked the advanced examples in the directlabels
documentation, and they make me think that it may be possible to use different methods for different panels by creating a custom positioning method or a custom panel. But I cannot quite see how to do it.
r - How to plot labels to corresponding line (on this plot) in ggplot2?
I have this data:
I plot each colum in this way:
the result is:
Now, i would like to not use the legend, but labels on plot line, one label for corresponding line. I tried with this code:
from this link: https://learnr.wordpress.com/2010/01/03/directlabels-adding-direct-labels-to-ggplot2-and-lattice-plots/
but r response is:
Do you know other possibility to plot labels on line plot, like (for example) in this way?
r - 在计算的 stat_smooth 线上添加标签 ggplot geom_dl
我一直在尝试将标签直接添加到我的线性模型散点图中,但有些困难。我已经阅读了这些文章(如何在 geom_smooth 之后而不是在 geom_line 之后显示直接标签?),我认为我需要geom_dl
在 ggplot 中使用该函数。
然而,目前我只能让标签落在最后的点上,而不是线条本身。我还设法在图表上绘制了名称,但是我再次无法将其与线条对齐。
任何想法将不胜感激!
谢谢
这是我的代码:
还有我的虚拟数据集:
r - 增加 geom_line 图的标签间距
假设我有一组线,我使用ggplot
和绘制geom_line
。我想标记这些行。我可以使用包中的方法来做到这一点geom_dl
,directlabels
但即使使用提供的方法来避免重叠(例如"last.qp"
),我仍然认为标签是两个靠得很近的。
如何增加这些标签之间的间距(此处为 y 方向),而不ggplot2::annotate
使用或类似的东西手动指定它们的每个位置?我对不涉及directlabels
包装的答案持开放态度,但如果可能的话,我想坚持使用它,因为它可以很好地完成 95% 的标签线工作。
这里有潜在的提示,tiebreak.big
但我无法让它工作......
r - 将直接标签添加到 geom_smooth 而不是 geom_line
我认识到这个问题与这个问题非常相似,但是那里的解决方案不再有效(使用method="last.qp"
),所以我再次问它。
基本问题是我想使用directlabels
(或等效)来标记每个组(来自stat_smooth()
)的平滑均值,而不是实际数据。下面的示例显示的与我所得到的一样接近,但标签无法识别分组,甚至无法识别平滑线。相反,我在最后一点得到了标签。我想要的是每条平滑线末尾的颜色协调文本,而不是图右侧的图例。
这是一个例子: