我有一组 2D 点(未排序)形成闭合轮廓,我想将它们重新采样为 14 个等距点。它是图像上肾脏的轮廓。有任何想法吗?
假设我有数据:
x <- c(1900,1930,1944,1950,1970,1980,1983,1984)
y <- c(100,300,500,1500,2500,3500,4330,6703)
Run Code Online (Sandbox Code Playgroud)
然后,我绘制这些数据并在已知的 x 和 y 坐标之间添加一个折线图:
plot(x,y)
lines(x,y)
Run Code Online (Sandbox Code Playgroud)
有没有办法预测沿图形线的未知点的坐标?
我需要将 IPCC(风格)点画添加到全球地图中,如本文所示。不过,我想使用其中一个功能ggplot2来执行此操作。
这是数据和绘图的示例:
df=read.csv("/home/my_folder/test.csv")
library(ggplot2)
library(metR)
plot_df = ggplot() +
geom_contour_fill(data=df, aes(x=V1, y=V2, z = value)) +
scale_fill_steps2(name = "", low = "#0571b0", mid = '#ffffbf', high = '#ca0020')
print(plot_df)
Run Code Online (Sandbox Code Playgroud)
如何向此图像添加 IPCC 点画?
我尝试使用geom_point(),但点画太大并掩盖了背景颜色。
谢谢
编辑
根据@Allan 的回答,我确实可以添加点画,如下所示:
library(ggplot2)
library(ggpattern)
df=read.csv("~/...../test.csv")
df_stippl=df[c(10:47, 100:250, 500:510, 707:1000, 1508:1699, 2500:2600, 2680:2690, 3400:4300),]
plot_df = ggplot() +
geom_contour_fill(data=df, aes(x=V1, y=V2, z = value)) +
stat_contour_fill(data=df_stippl, aes(x=V1, y=V2, z = value), geom = "polygon_pattern",
pattern_fill = "black", pattern_size …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我需要检查2D坐标(x,y)的集合,以查看给定坐标是否在集合中,它需要尽可能快,并且只能从一个线程访问.(这是用于碰撞检查)
有人能给我一个正确的方向吗?
我有两个设备 - HTC Tattoo和索尼爱立信Xperia X10.一个有145 DPI,另一个有245 DPI.
当我以点为单位指定TextView的字体大小时,如下所示:
textView.setTextSize(TypedValue.COMPLEX_UNIT_PT, 6.5f);
Run Code Online (Sandbox Code Playgroud)
我在这两个设备上获得了不同的文本物理大小.在245 DPI上,文本几乎不可读.
现在,"pt"大小应该是物理的.即,在我的测试中,两个文本块都应该具有相同物理高度的字母.事实并非如此.
这可能有什么不对?
谢谢你的帮助,尤里.
有没有办法向HTML textarea添加项目符号?
我想添加一个简单的功能,为文本区域中的每一行添加一个项目符号点(类似于列表项目符号点).
即使我认为有限的集合有数据(我在调试中检查过),我当前的实现也没有在表单上显示任何内容.
这是一些代码:
public event PropertyChangedEventHandler PropertyChanged;
PointCollection imagePoints;
public PointCollection ImagePoints
{
get
{
return this.imagePoints;
}
set
{
if (this.imagePoints != value)
{
this.imagePoints = value;
if (this.PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("ImagePoints"));
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
和相应的xaml:
<Polygon x:Name="imagePolygon" Points="{Binding ImagePoints}" Stretch="Fill" Fill="Black" Opacity="0.8" />
Run Code Online (Sandbox Code Playgroud)
现在,我通过编写代码完成了所有绑定.在这个例子中,它工作正常,但在我的情况下,点不会出现在多边形上.
有智慧的珍珠吗?
编辑:这是完整的xaml代码
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="WpfApplication2.HistogramWindow"
Title="HistogramWindow" Height="436" Width="604">
<Grid>
<TabControl HorizontalAlignment="Left" Height="406" VerticalAlignment="Top" Width="596" >
<TabItem x:Name="imageTab" Header="Full Image" Height="23" VerticalAlignment="Top">
<Border BorderBrush="Black" BorderThickness="1" Margin="10"> …Run Code Online (Sandbox Code Playgroud) 我有很多x,y坐标,我根据它们之间的距离聚集在一起.现在我想计算每个x,y坐标簇的质心量度.有没有办法做到这一点?
我的坐标格式为:
coordinates_cluster = [[x1,x2,x3,...],[y1,y2,y3,...]]
Run Code Online (Sandbox Code Playgroud)
每个簇的最小长度为三个点,并且所有点都可以具有负x和y值.我希望有人可以帮助我.
最好,马丁
(我在Windows 7系统上使用带有canopy 1.1.1(32位)的python 2.7.)
如何在R中获得以下可视化(见下文):让我们考虑一个简单的三点情况.
# Define two vectors
x <- c(12,21,54)
y <- c(2, 7, 11)
# OLS regression
ols <- lm(y ~ x)
# Visualisation
plot(x,y, xlim = c(0,60), ylim =c(0,15))
abline(ols, col="red")
Run Code Online (Sandbox Code Playgroud)
我想要的是,从OLS线(红线)到点绘制垂直距离线.
我有两组需要在同一图表上绘制的数据.一个集非常大(~10⁶),我想用hexbin绘图,另一个集非常小(~10),我想绘制点.如何在hexbin上绘制点?我得到的成功更接近于此:
bin = hexbin(x, y)
plot(bin)
pushViewport(dataViewport(x, y))
grid.points(x, y)
Run Code Online (Sandbox Code Playgroud)
我感谢任何帮助:)