File:Workweeks-map.svg
来自Wikimedia Commons
跳转到导航
跳转到搜索
此SVG文件的PNG预览的大小:800 × 406像素。 其他分辨率:320 × 162像素 | 640 × 325像素 | 1,024 × 520像素 | 1,280 × 650像素 | 2,560 × 1,300像素 | 2,754 × 1,398像素。
原始文件 (SVG文件,尺寸为2,754 × 1,398像素,文件大小:1.06 MB)
文件信息
结构化数据
说明
摘要
[编辑]描述Workweeks-map.svg |
English: Countries of the world by their work-week.
|
日期 | |
来源 | 自己的作品 |
作者 | MartinThoma |
Script to create the map:
#!/usr/bin/env python
# 3rd party modules
from lxml import etree
import mpu.pd
def main(filename="weekend.svg"):
mon_fri = ['Dominican Republic', 'Lebanon', 'Serbia', 'Albania', 'Angola',
'Argentina', 'Armenia', 'Azerbaijan', 'Austria', 'Australia',
'Benin',
'Belarus', 'Belgium', 'Brazil', 'Burundi', 'Bulgaria', 'Canada',
'Cambodia', 'Cameroon', 'Chile', 'China', 'Croatia',
'Costa Rica', 'Czech Republic', 'Denmark', 'Ethiopia',
'Estonia', 'Finland', 'France', 'Gabon',
'Gambia', 'Germany', 'Ghana', 'Greece', 'Hungary', 'Indonesia',
'Ireland',
'Italy', 'Côte d\'Ivoire', 'Japan', 'Kazakhstan', 'Kenya',
'Lao People\'s Democratic Republic', 'Latvia', 'Lesotho',
'Lithuania', 'Madagascar',
'Malawi', 'Mali', 'Malta', 'Mauritania', 'Mongolia', 'Morocco',
'Mozambique', 'Netherlands', 'New Zealand', 'Nigeria',
'Norway',
'Pakistan', 'Poland', 'Portugal', 'Romania', 'Russia', 'Rwanda',
'Senegal',
'Singapore', 'Slovakia', 'Spain', 'Sri Lanka',
'South Africa', 'South Korea', 'Suriname', 'Swaziland',
'Sweden', 'Switzerland',
'Seychelles', 'Taiwan', 'Tanzania', 'Togo', 'Thailand',
'Trinidad and Tobago', 'Tunisia', 'Turkey', 'Ukraine',
'United Kingdom', 'United States',
'Vietnam', 'Congo (Democratic Republic of the)', 'Zambia',
'Zimbabwe']
mon_sat = ['Equatorial Guinea', 'Hong Kong', 'Mexico', 'Philippines',
'Uganda', 'India', 'Colombia']
sun_thu = ['Afghanistan', 'Algeria', 'Bahrain', 'Egypt', 'Iraq', 'Israel',
'Jordan', 'Kuwait', 'Libya', 'Maldives', 'Oman', 'Qatar',
'Saudi Arabia', 'Sudan', 'Syria', 'Yemen',
'United Arab Emirates', 'Bangladesh']
sat_thu = ['Djibouti', 'Palestine', 'Iran']
sun_fri = ['Nepal']
mon_thu_sat = ['Brunei Darussalam']
mixed = ['Malaysia']
countries = mpu.pd.countries
countries = countries.set_index('English short name (upper/lower case)')
country2dict = countries.to_dict('index')
legend = [(mon_fri, '#B8D8D8'),
(mon_sat, 'orange'),
(sun_thu, '#4F6367'),
(sat_thu, 'red'),
(sun_fri, 'tomato'),
(mon_thu_sat, '#ff00ff'),
(mixed, '#00ffff')]
colors = {}
for collection, color in legend:
for country in collection:
if country in country2dict:
code = country2dict[country]['Alpha-2 code'].lower()
colors[code] = color
else:
print('Could not find the Alpha-2 code for \'{}\' in mpu'
.format(country))
tree = read_svg(filename)
root = tree.getroot()
for country_id in colors.keys():
element = root.xpath('//*[@id="{}"]'.format(country_id))
if len(element) == 1:
element = element[0]
element.set("style", 'fill: {};'.format(colors[country_id]))
for el in element.getchildren():
el.set("style", 'fill: {};'.format(colors[country_id]))
else:
print("Wrong length for id={}".format(country_id))
write_svg(root)
def read_svg(filename):
"""
Read an SVG file.
Parameters
----------
filename : str
Returns
-------
tree : lxml.ElementTree
"""
with open(filename, 'r') as f:
tree = etree.parse(f)
return tree
def write_svg(root, filename='weekend-auto.svg'):
"""
Read an SVG file.
Parameters
----------
root : lxml.Element
filename : str
"""
etree.ElementTree(root).write(filename, pretty_print=True)
if __name__ == '__main__':
main()
许可协议
[编辑]我,本作品著作权人,特此采用以下许可协议发表本作品:
本作品采用知识共享CC0 1.0 通用公有领域贡献许可协议授权。 | |
采用本宣告发表本作品的人,已在法律允许的范围内,通过在全世界放弃其对本作品拥有的著作权法规定的所有权利(包括所有相关权利),将本作品贡献至公有领域。您可以复制、修改、传播和表演本作品,将其用于商业目的,无需要求授权。
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
文件历史
点击某个日期/时间查看对应时刻的文件。
日期/时间 | 缩略图 | 大小 | 用户 | 备注 | |
---|---|---|---|---|---|
当前 | 2023年9月29日 (五) 12:14 | 2,754 × 1,398(1.06 MB) | Vyvagaba(留言 | 贡献) | Changed the file to an svg file that is more easily editable, addressed some recent updates and missing data. | |
2023年9月29日 (五) 12:12 | 2,560 × 1,314(1.09 MB) | Vyvagaba(留言 | 贡献) | Reverted to version as of 19:41, 4 September 2018 (UTC) | ||
2023年9月29日 (五) 12:07 | 2,754 × 1,398(1.06 MB) | Vyvagaba(留言 | 贡献) | Changed the file to an svg file that is more easily editable, addressed some recent updates and missing data. | ||
2018年9月4日 (二) 19:41 | 2,560 × 1,314(1.09 MB) | MartinThoma(留言 | 贡献) | User created page with UploadWizard |
您不可以覆盖此文件。
文件用途
以下页面使用本文件:
- File:Workweeks-map v2.svg(文件重定向)
全域文件用途
以下其他wiki使用此文件:
- ar.wikipedia.org上的用途
- bn.wikipedia.org上的用途
- en.wikipedia.org上的用途
- fa.wikipedia.org上的用途
- id.wikipedia.org上的用途
- zh-yue.wikipedia.org上的用途
- zh.wikipedia.org上的用途
元数据
此文件含有额外信息,这些信息可能是创建或数字化该文件时使用的数码相机或扫描仪所添加的。如果文件已从其原始状态修改,某些详细信息可能无法完全反映修改后的文件。
简短标题 | World Map |
---|---|
宽度 | 2754 |
高度 | 1398 |