首页 \ 问答 \ 使用散点图和世界地图图像在地图上显示流星撞击,宽高比问题(Using a scatter plot and world map image to display meteor impacts on a map, Aspect ratio problems)

使用散点图和世界地图图像在地图上显示流星撞击,宽高比问题(Using a scatter plot and world map image to display meteor impacts on a map, Aspect ratio problems)

因此,我试图在pycharm IDE中使用python在等矩形地图投影(作为标准图像加载)上绘制陨石撞击,这是通过时间递增来“动画”的,以显示从1500年到现在的50年期间的影响。

要做到这一点,我使用经过标准化(表示在0 - 1之间)的经纬度坐标(从NASA csv文件)到散点图上的绘图点的元组列表,然后与地图图像重叠。

简码解释:在第一部分中,normalize_lat_lon从我写过的数据处理文件中提取,该文件对经度和纬度进行了归一化处理。

影响是年,拉特,隆的元组列表。 img是世界地图图像,分辨率为2048 x 1025 1.998 * a是我试图纠正我所遇到的比率问题。 通过将x值乘以1.998(2048/1025),分辨率几乎为2:1。理论上应该允许我相应地进行绘图。

这是主要代码的一部分:

lat_lon = [data.normalise_lat_lon(b, c) fpr a, b, c in impacts]
x, y = [1.998*a for a, b in lat_lon], [b for a, b in lat_lon]

plt.scatter(x, y, s=200, color='red')
plt.imshow(img)

我的问题是缩放散点图以与世界地图图像对齐。 使用上面的修补程序乘以1.998 * a似乎将所有散点图卡在左上角,如下所示。

陨石影响 MCV:代码的简化版本,无需循环其他时间段或需要从nase文件中标准化经纬度

from matplotlib import pyplot as plt

plt.ion()
plot.title("Meteorite Impacts 1990 - 2000")

impacts = [(1994, 0.5, 0.3),(1991, 0.4, 0.3),(1998, 0.1, 0.1),(1992, 0.8, 
0.8)]
lat_lon = [(b, c) for a, b, c in impacts]
x, y = [1.9*a for a, b in lat_lon], [b for a, b in lat_lon]
plt.imread("Equirectangular-projection.jpg")
plt.scatter(x, y)
plt.show()

我可以将https放到项目的git上,供其他人克隆/分叉,不确定我是否允许这样做。


So I'm attempting to plot meteorite impacts using python in the pycharm IDE on a equirectangular map projection(loaded as a standard image) this is "animated" through time incrementing to show impacts in 50 year periods from 1500 to present.

To do this I am using a tuple list of lat and lon coordinates (from a NASA csv file) that have been normalized (represented between 0 - 1) to plot points on a scatter plot this is then overlapped with the map image.

Brief code explanation: In the first part the normalize_lat_lon pulls from a data processing file I have written that normalizes the latitude and longitude.

Impacts is a list of tuples that are Year, Lat, Lon. img is the world map image which resolution is 2048 x 1025 the 1.998*a is my attempt at rectifying the ratio problem I have. As the resolution is almost 2:1 by multiplying the x values by 1.998 (2048/1025) It in theory should allow me to plot accordingly.

This is part of the main code:

lat_lon = [data.normalise_lat_lon(b, c) fpr a, b, c in impacts]
x, y = [1.998*a for a, b in lat_lon], [b for a, b in lat_lon]

plt.scatter(x, y, s=200, color='red')
plt.imshow(img)

My problem is scaling the scatter plot to line up with the world map image. using the above fix multiplying the 1.998*a seems to have all the scatter plot points stuck in the top left hand corner as shown below.

Meteorite Impacts MCV: Simplified version of the code without looping through other time periods or needing to normalise the lat an lon from the nase file

from matplotlib import pyplot as plt

plt.ion()
plot.title("Meteorite Impacts 1990 - 2000")

impacts = [(1994, 0.5, 0.3),(1991, 0.4, 0.3),(1998, 0.1, 0.1),(1992, 0.8, 
0.8)]
lat_lon = [(b, c) for a, b, c in impacts]
x, y = [1.9*a for a, b in lat_lon], [b for a, b in lat_lon]
plt.imread("Equirectangular-projection.jpg")
plt.scatter(x, y)
plt.show()

I could put a https to a git of the project for others to clone/fork, not sure if I'm allowed to do that.


原文:https://stackoverflow.com/questions/33119505
更新时间:2022-11-16 17:11

最满意答案

打开EF设计器,单击要提供文档的任何内容,然后在属性选项卡中填写“ 文档 ”字段。

啊,你说的是属性,而不是注释。 请参阅此stackoverflow帖子

简而言之 - 你不能这样做。 如果您绝对需要属性,则必须编写自己的实体类(POCO),这只在新版本的Entity Framework中支持(在.Net 4.0中)


Open up the EF designer, click on whatever you want to give documentation to, and fill in the " Documentation" field in the properties tab.

Ah, you are talking about attributes, not annotations. See this stackoverflow post.

In short - you can't do it. If you absolutely need attributes, you'll have to write your own Entity classes (POCO), which is only supported in the new version of Entity Framework (in .Net 4.0)

相关问答

更多