我花了很长时间寻找一种能够将类似于matplotlib的功能带到.NET框架的产品.据我所知,没有什么能真正起作用.这是一个准确的评估吗?这是我发现的:
商业:
开源:
我认为拥有一个.NET项目非常有价值,它提供了交互式绘制F#和IronPython等语言数据的能力.有谁知道这样的项目?
我想使用ggplot2的stat_binhex()在同一个图表上同时绘制两个独立的变量,每个变量都有自己的颜色渐变使用scale_colour_gradientn().
如果我们忽略x轴单位不匹配的事实,可重复的例子是在同一图像中绘制下图,同时保持单独的填充梯度.
d <- ggplot(diamonds, aes(x=carat,y=price))+
stat_binhex(colour="white",na.rm=TRUE)+
scale_fill_gradientn(colours=c("white","blue"),name = "Frequency",na.value=NA)
try(ggsave(plot=d,filename=<some file>,height=6,width=8))
Run Code Online (Sandbox Code Playgroud)

d <- ggplot(diamonds, aes(x=depth,y=price))+
stat_binhex(colour="white",na.rm=TRUE)+
scale_fill_gradientn(colours=c("yellow","black"),name = "Frequency",na.value=NA)
try(ggsave(plot=d,filename=<some other file>,height=6,width=8))
Run Code Online (Sandbox Code Playgroud)

我发现在谷歌GGPLOT2组相关问题的一些谈话这里.
目前我有一个日期时间轴,其中日期与点一致,无论如何都要让这个日期出现在中心,例如条形图上.
<Style x:Key="DateTimeAxisLabelStyle2" TargetType="chartingToolkit:DateTimeAxisLabel">
<Setter Property="DaysIntervalStringFormat" Value="{}{0:dd-MMM}" />
<Setter Property="HoursIntervalStringFormat" Value="{}{0:hh:mm tt}" />
<!--<Setter Property="RenderTransformOrigin" Value="1,0.5" />
<Setter Property="RenderTransform">
<Setter.Value>
<RotateTransform Angle="-45" />
</Setter.Value>
</Setter>-->
<!--<Setter Property="Margin" Value="30,0,-10,0" />-->
</Style>
<chartingToolkit:DateTimeAxis IntervalType="Days"
Interval="1"
Minimum="{Binding StartDate}"
Maximum="{Binding EndDate}"
Orientation="X"
VerticalContentAlignment="Center"
Title="Day"
AxisLabelStyle="{StaticResource DateTimeAxisLabelStyle2}" />
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
寻找一种有效的方法在rstudio,H2O的Flow或h2o的RF和GBM模型的本地html页面中绘制树,类似于下面链接中的图像.具体来说,如何通过解析h2o.download_pojo(rf1)或h2o.download_pojo(gbm1)来为下面的代码生成的对象(拟合模型)rf1和gbm2绘制树?
# # The following two commands remove any previously installed H2O packages for R.
# if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) }
# if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") }
# # Next, we download packages that H2O depends on.
# pkgs <- c("methods","statmod","stats","graphics","RCurl","jsonlite","tools","utils")
# for (pkg in pkgs) {
# if (! (pkg %in% rownames(installed.packages()))) { install.packages(pkg) }
# }
#
# # Now we download, install h2o package
# install.packages("h2o", type="source", repos=(c("http://h2o-release.s3.amazonaws.com/h2o/rel-turchin/3/R")))
library(h2o)
h2o.init(nthreads = …Run Code Online (Sandbox Code Playgroud) 我试图在今年发表在Nature上的一篇文章中对图2d-f进行类似的绘图.它基本上是一个半箱图,另一半有点.
任何人都可以给我一些提示吗?非常感谢你!
这些是我的数据和代码,它们生成带有内部点的完整框
require(magrittr)
require(tidyverse)
dat <- structure(list(p1 = c(0.0854261831077604, 0.408418657218253,
0.577793646477315, 0.578028229977424, 0.48933166218204, 0.53117814324334,
0.526653494462464, 0.00687616283435221, 0.444300425796509, 0.00287319455358522,
0.949821402532831, 0.96832469523368, 0.953281969982759, 0.360125244759434,
0.407921095422844, 0.885776732104954, 0.159882184516691, 0.911094990767761,
0.0444367172734037, 0.144888951725151, 0.508858686640707, 0.694913731085945,
0.117270366119258, 0.78227546070467, 0.980457304886186, 0.711464034564424,
0.753944466390685, 0.0474210438747038, 0.00344183466223558, 0.0290017465534545,
0.75092385236303, 0.868873921257987, 0.744396990487425, 0.0140007244233847,
0.0332266395043963, 0.482897084793009, 0.0535516646483004, 0.452926358923891,
0.0144057727301603, 0.171918034525543), p2 = c(0.101262675229211,
0.196913109208586, 0.37814311161382, 0.0677625689405156, 0.12517090579686,
0.409083554335168, 0.158886941347288, 0.847394861862651, 0.180560031076741,
0.967122694294885, 0.000901627067665116, 0.00039495110143705,
9.70707318411806e-05, 0.546200038486894, 0.435475454787648, 5.95555269800323e-06,
0.0178837768834925, 8.42690065415846e-06, 0.00777059697751842,
0.0020397073541544, 0.486699073016371, 0.283679673247571, 0.857183359146641,
0.200712003853458, 0.0164911141652784, …Run Code Online (Sandbox Code Playgroud) 如何向现有图表添加点?直接的解决方案是绘制新的散点图,添加新数据。
ax.scatter(data[:,0], data[:,1], cmap = cmap, c = color_data)
ax.scatter(new_points_x, new_points_y, color='blue')
Run Code Online (Sandbox Code Playgroud)
但是如果我们想用新的颜色添加更多的点,就有一个问题:我们必须考虑所有以前添加的点。
如果我可以使用像这样的特殊功能,那就太好了
AddPoint(ax, new_point, color)
Run Code Online (Sandbox Code Playgroud)
我只想添加新颜色的新点。我不需要任何动画
使用seaborn时,有没有办法可以为hue参数包含多个变量(列)?提出这个问题的另一种方法是,在将数据绘制在单个 x,y 轴图上之前,如何按多个变量对数据进行分组?
我想做如下的事情。但是目前我无法为色调参数指定两个变量:
sns.relplot(x='#', y='Attack', hue=['Legendary', 'Stage'], data=df)
Run Code Online (Sandbox Code Playgroud)
例如,假设我有一个如下所示的 pandas DataFrame,其中包含通过本教程获得的Pokemon 数据库。
我想在 x 轴上绘制pokedex #,在 y 轴上绘制Attack。但是,我希望数据按Stage和Legendary进行分组。使用matplotlib ,我编写了一个自定义函数,该函数按['Legendary','Stage']对数据帧进行分组,然后迭代每个组进行绘图(请参阅下面的结果)。虽然我的自定义函数按预期工作,但我希望这可以简单地通过 seaborn 来实现。我猜一定还有其他人尝试使用seaborn在单个图中可视化超过3个变量?
fig, ax = plt.subplots()
grouping_variables = ['Stage','Legendary']
group_1 = df.groupby(grouping_variables)
for group_1_label, group_1_df in group_1:
ax.scatter(group_1_df['#'], group_1_df['Attack'], label=group_1_label)
ax_legend = ax.legend(title=grouping_variables)
Run Code Online (Sandbox Code Playgroud)
编辑1:
注意:在我提供的示例中,我按两个变量(例如:Legendary 和 Stage)对数据进行分组。然而,其他情况可能需要任意数量的变量(例如:5 个变量)。
import pandas as pd
import seaborn as sns
ser_test = pd.Series([1,0,1,4,6,0,6,5,1,3,2,5,1])
sns.kdeplot(ser_test, cumulative=True)
Run Code Online (Sandbox Code Playgroud)
上面的代码生成以下 CDF 图:
但是当系列的元素被修改为:
ser_test = pd.Series([1,0,1,1,6,0,6,1,1,0,2,1,1])
sns.kdeplot(ser_test, cumulative=True)
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
ValueError: 无法将字符串转换为浮点数:'scott'
运行时错误:选定的 KDE 带宽为 0。无法估计密度。
这个错误是什么意思,我如何解决它以生成 CDF(即使它非常倾斜)。
编辑:我使用的是 seaborn 版本 0.9.0
完整的跟踪如下:
ValueError: could not convert string to float: 'scott'
During handling of the above exception, another exception occurred:
RuntimeError Traceback (most recent call last)
<ipython-input-93-7cee594b4526> in <module>
1 ser_test = pd.Series([1,0,1,1,6,0,6,1,1,0,2,1,1])
----> 2 sns.kdeplot(ser_test, cumulative=True)
~/.local/lib/python3.5/site-packages/seaborn/distributions.py in kdeplot(data, data2, shade, vertical, kernel, bw, gridsize, …Run Code Online (Sandbox Code Playgroud) 我试图用Seaborn的JointGrid绘制我的非对称数据.我可以使用相同的宽高比,但后来我有不需要的空格:
大小:数字,可选
图的大小(它将是正方形).
我也尝试过将extentkwarg喂给关节图和JointGrid,以及ylim没有运气.
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
x = np.random.normal(0.0, 10.0, 1000)
y = np.random.normal(0.0, 1.0, 1000)
joint = sns.jointplot(x, y)
joint.plot_marginals(sns.distplot, kde=False)
joint.ax_joint.set_aspect('equal') # equal aspect ratio
plt.show()
Run Code Online (Sandbox Code Playgroud) 此代码取自此页面:
library(leaflet)
leaflet(data = quakes[1:20,]) %>% addTiles() %>%
addMarkers(~long, ~lat, popup = ~as.character(mag))
Run Code Online (Sandbox Code Playgroud)
而不是标记,有没有办法mag作为文本标签绘图?