这是我的代码,我想让图更大,这样更容易阅读。在这里,我试图根据杂质的平均减少来获得特征重要性。我得到了一些输出,但由于我的条形图有 63 个 bin,我希望它更大。我尝试了所有评论的内容。有人可以建议我如何使这个条形图更具可读性吗?
import pandas as pd
from matplotlib.pyplot import figure
# fig.set_figheight(20)
# fig.set_figwidth(20)
#plt_1 = plt.figure(figsize=(20, 15), dpi = 100)
forest_importances = pd.Series(importances, index=feature_names)
fig, ax = plt.subplots()
forest_importances.plot.bar(yerr=std, ax=ax)
ax.set_title("Feature importances using MDI")
ax.set_ylabel("Mean decrease in impurity")
# fig = plt.figure()
fig.tight_layout()
plt.show()
Run Code Online (Sandbox Code Playgroud) python data-visualization matplotlib bar-chart feature-selection
我需要的是这样的(带有中线):
我尝试过的是这段代码:
exercise = sns.load_dataset("exercise")
g = sns.catplot(x="time", y="pulse", hue="kind", data=exercise, kind="box")
bars = g.axes[0][0].patches
hatches=['//','..','xx','//','..','xx','//','..','xx']
for pat,bar in zip(hatches,bars):
bar.set_hatch(pat)
Run Code Online (Sandbox Code Playgroud)
这只会生成第一个数字。第3-6行的想法来自这个问题。但进入第 3 行的想法axes[0][0]来自于这个问题。
因为 FacetGrid 没有补丁或容器等属性,所以很难将单个图中的影线答案适应分类图,所以我无法弄清楚。
我最近正在学习如何使用 Altair 创建图表,但在自定义标题和轴时遇到了一些问题。我的图表代码目前如下所示:
chart = Chart(data).mark_bar().encode(
column='Cell Type',
x='Truth/Pred',
y='03',
color='Truth/Pred',
).properties(
title='Truth vs Predictions for Cell Type Percentages'
).configure_axisBottom(
disable = True
).configure_axisTop(
# labelPadding = 100
orientation = "bottom"
).configure_axisY(
title = "Cell Type Percentages"
)
chart.display()
Run Code Online (Sandbox Code Playgroud)
我有几个问题。
有没有办法让标题居中?
其次,我试图将 Y 轴设置为“单元格类型百分比”,但似乎没有 Y 轴,我不确定为什么。
最后,我尝试将顶部轴移至底部,并将标签稍微隔开一点,或旋转它们,使它们不会彼此重叠。然而,配置 axisTop 参数似乎根本不影响 Cell Type 轴!我也不确定为什么会这样。
我尝试遵循此堆栈溢出问题的答案:链接到相关问题
但我总是收到错误说明"additional properties are not allowed",所以我不确定他们是否停止在构造函数中使用配置属性。
任何帮助表示赞赏。谢谢你!
我创建了一个名为“widgets_t.html”的 html 文件(几个情节图组合在一起)。使用本教程(https://beta.rstudioconnect.com/jjallaire/htmlwidgets-showcase-storyboard/htmlwidgets-showcase-storyboard.html)作为演示以及此处提供的答案(如何在 flexdashboard 中创建下拉菜单?),我尝试创建一个 Rmarkdown/Flexdashboard 文档。这是我正在使用的代码(在本例中,为了简洁起见,我只是使用了相同的 html 输入和相同的文本):
---
title: "maps"
output:
flexdashboard::flex_dashboard:
storyboard: true
social: menu
source: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
```
```{css}
.storyboard-nav .sbframelist ul li {
height: auto;
}
```
Page 1
=====================================
Column {.tabset}
-------------------------------------
### Title 1
<object type="text/html" width="1500" height="1500" data="widgets_t.html"></object>
https://rstudio.github.io/leaflet/
- Interactive panning/zooming
- Compose maps using arbitrary combinations of map tiles, markers, polygons, lines, popups, and GeoJSON.
- Create maps right from the R …Run Code Online (Sandbox Code Playgroud) 我非常希望使用纯ggplot2方法重新创建此图,因为我想使用该包解决所有绘图.

下面给出了生成这个特定图的代码.
library(PerformanceAnalytics)
library(quantmod)
getSymbols(c('SPY','LQD','GLD'))
Data <- cbind(Cl(SPY),Cl(LQD),Cl(GLD))
Year <- as.factor(format(index(Data),'%Y'))
chart.Correlation(Data,bg=seq(1:5)[Year],pch=21)
par(xpd=TRUE)
legend(0, 1, as.vector(unique(Year)), fill=seq(1:5))
Run Code Online (Sandbox Code Playgroud)
您可以在本网站上阅读更多相关信息.
我创建了一个小数据集来玩.以下代码定义了data.frame并将其融合为ggplot通常喜欢的格式.
library(ggplot2)
library(reshape2)
mydf<-structure(list(SPY = c(141.37, 141.67, 140.54, 141.19, 141.07,
141.54, 142.16, 143.24, 142.96, 143.02, 142.54, 142.82, 142.38,
142.8, 143.95, 142.26, 142.13, 142.05, 142.79, 143.75, 144.86,
141.31, 141.19, 138.91, 140.37, 141.29, 140.15, 141.28, 138.17,
136.98, 133.43, 132.06, 130.72, 133.86, 134.99, 133.04, 135.24,
135.91, 134.91, 137.37, 92.96, 92.85, 93.47, 90.67, 91.04, 89.09,
86.95, 87.11, 84.37, 84.4, 85.06, 80.57, 84.05, 82.75, 83.11, …Run Code Online (Sandbox Code Playgroud) 如何使用C#/ .NET创建报告(如格式良好的pdf文件)和分析图?
是否有用于此目的的本地库?
我使用finaquant的表函数库进行表操作.我需要集成一些额外的功能来生成报告,并通过电子邮件将它们发送到正确的地址.
问题是将测量轴(y - 成本)的数据值视为整数的凹坑js,它们是十进制值.有任何建议如何解决这个问题?这是jsfiddle:http://jsfiddle.net/Ra2xS/7/
var dim = {"width":590,"height":450}; //chart container width
var data = [{"date":"01-02-2010","cost":"9.7862"},{"date":"01-03-2010","cost":"9.915"},{"date":"01-04-2010","cost":"10.2634"}];
function barplot(id,dim,data)
{
keys = Object.keys(data[0]);
var xcord = keys[0];
var ycord = keys[1];
var svg = dimple.newSvg(id, dim.width, dim.height);
var myChart = new dimple.chart(svg,data);
myChart.setBounds(60, 30, 505, 305);
var x = myChart.addCategoryAxis("x", xcord);
x.addOrderRule(xcord);
x.showGridlines = true;
var y = myChart.addMeasureAxis("y", ycord);
y.showGridlines = true;
var s = myChart.addSeries(null, dimple.plot.bar);
var s1 = myChart.addSeries(null, dimple.plot.line);
s1.lineWeight = 3;
s1.lineMarkers = true;
myChart.draw(1500); …Run Code Online (Sandbox Code Playgroud) 我正在玩vis.js因为我喜欢它的网络可视化模块.我想知道,因为我无法在文档中找到它,如果可以选择多个节点.
干杯,
里卡多
javascript networking data-visualization graph chap-links-library
背景
我一直在使用neo4j来查询相当大(但最终不复杂)的数据集.我正在将cypher直接写入Web界面,并在文本文件(old-skool)中跟踪我的查询.
问题
我喜欢我回来的结果,所以我想采取另一个步骤并围绕它建立一个更严格的界面,以便我可以将它交给非技术人员来探索一些预先编程的参数中的数据.
我已经阅读了node4j API参考,我确信我可以从头开始构建一个接口,结合使用D3进行布局,并使用(例如)node.js中的seraph或neo4j rubygem构建后端中间件应用程序.
但是,标准的neo4j web界面非常好,我想知道我是否可以进一步利用它并将查询结果(包括强制导向图)嵌入我的应用程序中,而不是从头开始?
可能的方法
这种方法有优先权吗?我想旅程将是这样的:
对此有任何建议都是王牌.
在Tableau中,我习惯于制作如下图所示的图形.它具有每天(或其他一些离散变量),不同颜色,高度和宽度的堆叠条形图.
您可以将这些类别想象成我向人们展示的不同广告.高度对应于我向广告展示的人的百分比,宽度对应于接受率.
它让我可以很容易地看到我应该更频繁地展示哪些广告(短而宽的酒吧,如9月13日和14日的'C'类别),我应该更少地展示(高,窄条,像'' H'类别于9月16日).
关于如何在R或Python中创建这样的图形的任何想法?
graph ×3
python ×3
r ×3
ggplot2 ×2
javascript ×2
.net ×1
altair ×1
bar-chart ×1
boxplot ×1
c# ×1
catplot ×1
correlation ×1
d3.js ×1
dimple.js ×1
html ×1
jquery ×1
matplotlib ×1
neo4j ×1
networking ×1
r-markdown ×1
reporting ×1
seaborn ×1
text ×1