我有一个函数,假设f(theta, phi) = sqrt(1 - (sin(theta)*sin(phi))**2) + 5 * sqrt(1 - (sin(theta)*cos(phi))**2)
我想在球体表面绘制颜色图。但是,我不知道如何splot
在不首先生成表中包含适当值的文件的情况下将这个函数输入到其中以实现此目的。
我怎样才能gnuplot
做到这一点?
我有一个使用 folium 库创建的 HeatMapWithTime。热图随时间变化。我想将此地图导出为动态格式的 HTML。我想使用这张地图进行演示,而无需运行代码。如果有人可以告诉我如何在不丢失时间步长的情况下导出地图,我将不胜感激。
我的地图代码:
map_Oslo = folium.Map(location=[Latitude, Longitude], zoom_start=5)
plugins.HeatMapWithTime(heat_data,
radius=10,
gradient={0.1: 'blue', 0.2: 'blue', 0.4: 'lime', 0.6: 'orange', 0.8: 'red', 0.99: 'purple'},
min_opacity=0.5, max_opacity=0.8, use_local_extrema=False).add_to(map_Oslo)
map_Oslo
Run Code Online (Sandbox Code Playgroud)
我尝试了一些建议,但收到错误WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
,并且无法判断代码是否有效。:
import os
import time
from selenium import webdriver
delay=5
fn='testmap.html'
tmpurl='file://{path}/{mapfile}'.format(path=os.getcwd(),mapfile=fn)
map_Oslo.save(fn)
browser = webdriver.Firefox()
browser.get(tmpurl)
#Give the map tiles some time to load
time.sleep(delay)
browser.save_screenshot('map.png')
browser.quit()
Run Code Online (Sandbox Code Playgroud) 我有一个热图,我想删除颜色条上的标签和刻度线。如何使用迄今为止制作的热图(下面的代码)来做到这一点?
import seaborn as sns
import matplotlib.pyplot as plt
sns.heatmap(my_heatmap, cmap='RdYlGn', vmin=0, vmax=1)
plt.rcParams["figure.figsize"] = (8, 6)
plt.title('10 mm Precipitation Probabilities\nTopeka, Kansas', fontsize = 16)
plt.xlabel('X', fontsize = 14)
plt.ylabel('Y', fontsize = 14)
plt.text(6.7,.18, 'High Probability')
plt.show()
Run Code Online (Sandbox Code Playgroud)
(我宁愿它只是在栏顶部显示高概率,如我制作的标签所示)。
我有以下数据:
\nlibrary(data.table)\nDT <- data.table(\n Pays = c("Austria", "Belgium", "Brazil", "Bulgaria", \n "Canada", "China", "Croatia", "Cyprus", "Czechia", "Denmark"), \n `Nouveaux cas` = c("212.2", "136.0", "143.5", "258.7", "122.8", \n "0.0", "615.0", "299.0", "327.7", "314.5"), \n `Nouveaux d\xc3\xa9c\xc3\xa8s` = c("53.8", "35.4", "14.9", "89.7", "14.2", "0.0", "79.0", "14.4", "47.3", "6.9"), \n `\xc3\x89volution du nombre de cas` = c("-21.5%", "2.8%", "5.6%", "-5.2%", "4.1%", "-0.9%", "5.5%", "34.3%", "36.7%", "73.8%"), \n `\xc3\x89volution du nombre de d\xc3\xa9c\xc3\xa8s` = c("-20.1%", "-20.4%", "10.5%", "-8.5%", "24.1%", "NaN%", "2.9%", "63.6%", "-5.4%", …
Run Code Online (Sandbox Code Playgroud) 该热图有一个内置网格,我无法找到自定义的方法。
我想保留网格中的水平线,如果可能的话增加厚度,并禁用垂直线。每行应该看起来像一个连续的时间序列,其中存在数据,而不存在数据则为空白。
在顶部添加垂直/水平线可能会覆盖一些数据,因为网格线或小矩形之间的受控间隙是更好的选择。
或者,geom_raster
根本不显示任何网格。我需要添加网格的水平线。
我尝试更改线型,即 geom_tile 参数,它似乎确实更改了类型或允许使用 linetype=0 完全禁用它,完全禁用网格,但它不允许保留水平网格线。通过修改大小参数,我没有看到任何变化。
这是生成上述绘图的代码:
ggplot( DF, aes( x=rows, y=name, fill = value) ) +
#geom_raster( ) +
geom_tile( colour = 'white' ) +
scale_fill_gradient(low="steelblue", high="black",
na.value = "white")+
theme_minimal() +
theme(
legend.position = "none",
plot.margin=margin(grid::unit(0, "cm")),
#line = element_blank(),
#panel.grid = element_blank(),
panel.border = element_blank(),
panel.grid = element_blank(),
panel.spacing = element_blank(),
#panel.grid = element_line(color="black"),
#panel.grid.minor = element_blank(),
plot.caption = element_text(hjust=0, size=8, face = "italic"),
plot.subtitle = element_text(hjust=0, size=8),
plot.title = element_text(hjust=0, size=12, …
Run Code Online (Sandbox Code Playgroud) heatmap ×6
r ×3
python ×2
datatable ×1
export ×1
folium ×1
ggplot2 ×1
gnuplot ×1
grid ×1
html ×1
matplotlib ×1
plot ×1
python-3.x ×1
seaborn ×1
time-series ×1