我有一个客户需要将图表应用程序(很久以前在MFC中开发)转换为C#.该应用程序显示大型网络(大量图形元素),并允许用户通过图形UI编辑/操作数据.
我决定最好使用一个库而不是从scracth开发所有(所有图形对象/选择/工具/事件/等)
我正在寻找商业解决方案.
我发现有三个似乎非常成熟,我想知道是否有人使用它们并且可以写出他/她的意见:
谢谢Yaron
我在流动数据大圆映射教程中学到了一些我学到的东西,并将它们与评论中链接的代码结合起来,以防止在R绘制跨赤道大圆时发生奇怪的事情.这给了我这个:
airports <- read.csv("/home/geoff/Desktop/DissertationData/airports.csv", header=TRUE)
flights <- read.csv("/home/geoff/Desktop/DissertationData/ATL.csv", header=TRUE, as.is=TRUE)
library(maps)
library(geosphere)
checkDateLine <- function(l){
n<-0
k<-length(l)
k<-k-1
for (j in 1:k){
n[j] <- l[j+1] - l[j]
}
n <- abs(n)
m<-max(n, rm.na=TRUE)
ifelse(m > 30, TRUE, FALSE)
}
clean.Inter <- function(p1, p2, n, addStartEnd){
inter <- gcIntermediate(p1, p2, n=n, addStartEnd=addStartEnd)
if (checkDateLine(inter[,1])){
m1 <- midPoint(p1, p2)
m1[,1] <- (m1[,1]+180)%%360 - 180
a1 <- antipode(m1)
l1 <- gcIntermediate(p1, a1, n=n, addStartEnd=addStartEnd)
l2 <- gcIntermediate(a1, p2, n=n, addStartEnd=addStartEnd)
l3 …Run Code Online (Sandbox Code Playgroud) 我想geom_dotplot通过点的形状(而不是文档建议的颜色)来区分两个不同的变量.例如:
library(ggplot2)
set.seed(1)
x = rnorm(20)
y = rnorm(20)
df = data.frame(x,y)
ggplot(data = df) +
geom_dotplot(aes(x = x), fill = "red") +
geom_dotplot(aes(x=y), fill = "blue")
Run Code Online (Sandbox Code Playgroud)
即在下面的例子中区分x和y
我想将所有x设置为点,将y设置为三角形.
这可能吗?谢谢!
我正在尝试用两个面板设置一个闪亮的 vis。
我还想在每个面板中使用fluidPage 布局,在那里我可以有列。
我继续尝试这个。但是我的代码工作得不太正确。
我最终得到了一页,其中有 2 个标签,但它们都不起作用。此外,这两个选项卡都没有人们期望出现的文本。
这是我闪亮的应用程序的屏幕截图。请注意顶部的选项卡,它们没有任何用处:

如何让标签正确交互?有什么办法可以有 2 个选项卡,并在每个选项卡中使用fluidPage 函数创建自定义行和列?
用户界面
shinyUI(fluidPage(
titlePanel("Shiny Viz!"),
mainPanel(
tabsetPanel(
fluidRow(
column(4,
tabPanel("Controls", checkboxGroupInput("select", label="", choices = list("Age" = "Age", "Weight" = "Weight", "Circumference" = "Circumference"), inline=TRUE))),
column(4,
plotOutput("select"))
))),
tabsetPanel(
fluidRow(
column(4,
tabPanel("output_at_some_point"))))
))
Run Code Online (Sandbox Code Playgroud)
服务器
library(shiny)
library(ggplot2)
DF <- as.data.frame(matrix(c(1:9),ncol=3,nrow=3))
DF <- data.frame(replicate(3,1:3))
names(DF) <- c("Age", "Weight", "Circumference")
shinyServer(function(input, output) {
output$select <- renderPlot({
# modify DF
DF_with_tests_selected <- subset(DF, select = input$select)
#ggplot
p <- ggplot(DF)
p <- p …Run Code Online (Sandbox Code Playgroud) 我正在研究华丽而强大的 Plotly Python API,其目标是生成静态 html 仪表板。
这提出了两个问题:
为了生成 html,我看到以下示例。图表似乎是通过 URL 嵌入的。自从plotly 开源以来,这个 URL 嵌入实现仍然适用吗?现在有其他方法可以将绘图发送到静态 html 吗?
如何控制绘图/仪表板元素的布局?例如,在 Bokeh 中,我们可以执行以下操作:
bar = Bar(<define bar plot>)
line = Line(<define line plot>)
donut = Donut(<define donut chart>)
bar_line_panel = hplot(bar, line)
final_layout = vplot(bar_line_panel, donut)
output_file('foo.html')
show(final_layout)
渲染的 html 文件将包含圆环图上方彼此相邻的折线图和条形图。plotly 中是否有类似的功能,或者是否需要模板和 html/css 争论来指定绘图元素的布局,如本例所示?
感谢您抽出时间,非常期待在 Plotly 中创建一些交互式可视化!
据我了解,这与 2D 绘图不同,并且可能无法通过plotly API 实现。
我正在绘制空间数据,并且我的数据看起来有偏差,因为 X 轴上的 1 米不等于 Y 轴上的 1 米,等等。
例子:
默认情况下,当 z 的差异在空间上非常小时,它们看起来会被夸大;无论数据规模如何,plotly 都使用立方体来可视化整个范围。如果我将每个轴的范围设置为 [0, 120],我可视化的数据将是平方/相同比例,但在图底部非常小,使其难以查看和交互。
我有一张桌子,用来存储有关我祖先的信息。作为一个例子,我受《教父》的启发创建了一张类似的桌子。
|--------+---+-------------+-----------+------+------+--------+--------+----------------+----------------|
| ID | S | First name | Last name | DoB | DoD | FID | MID | Place of birth | Job |
|--------+---+-------------+-----------+------+------+--------+--------+----------------+----------------|
| AnAn | M | Antonio | Andolini | | 1901 | | | Corleone | |
| SiAn | F | Signora | Andolini | | 1901 | | | Corleone | housewife |
| PaAn87 | M | Paolo | Andolini | 1887 | 1901 | AnAn | SiAn | …Run Code Online (Sandbox Code Playgroud) data-visualization graphviz directed-acyclic-graphs python-3.x pandas
即使在模板中传递之后,图表仍然显示图例标题,而它应该将默认设置更改为无图例标题'title':None。layout.legend
如果我用 手动传递它fig.update_layout(),它就会删除标题。
为什么会发生这种情况?如何将默认设置更改为无图例标题?
这是重新创建图形的代码(手动传入的内容update.layout()已被注释掉)-
import plotly.graph_objects as go
import plotly.io as pio
import plotly.express as px
import pandas as pd
pio.templates['my_theme'] = go.layout.Template({
'layout': {'annotationdefaults': {'arrowcolor': '#2a3f5f', 'arrowhead': 0, 'arrowwidth': 1},
'autotypenumbers': 'strict',
'coloraxis': {'colorbar': {'outlinewidth': 0, 'ticks': ''}},
'colorscale': {'diverging': [[0, '#8e0152'], [0.1, '#c51b7d'],
[0.2, '#de77ae'], [0.3, '#f1b6da'],
[0.4, '#fde0ef'], [0.5, '#f7f7f7'],
[0.6, '#e6f5d0'], [0.7, '#b8e186'],
[0.8, '#7fbc41'], [0.9, '#4d9221'], [1,
'#276419']],
'sequential': [[0.0, '#0d0887'],
[0.1111111111111111, '#46039f'],
[0.2222222222222222, '#7201a8'],
[0.3333333333333333, '#9c179e'], …Run Code Online (Sandbox Code Playgroud) 我已经多次运行此代码,但现在失败了。Matplotlib 不适用于任何示例,即使是最微不足道的示例。这是我遇到的错误,但我不知道该怎么办。我知道这是模糊的,我无法真正提供重现它的方法。我已经卸载了最近安装的每个软件包并尝试重新安装 matplotlib。
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
plt.plot(self.I_hist)
plt.show()
Run Code Online (Sandbox Code Playgroud)
File "/Users/username/Documents/Newsvendor/venv/lib/python3.10/site-packages/matplotlib/backends/backend_macosx.py", line 41, in _draw
self.figure.draw(renderer)
File "/Users/username/Documents/Newsvendor/venv/lib/python3.10/site-packages/matplotlib/artist.py", line 73, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
File "/Users/username/Documents/Newsvendor/venv/lib/python3.10/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer)
File "/Users/username/Documents/Newsvendor/venv/lib/python3.10/site-packages/matplotlib/figure.py", line 2810, in draw
mimage._draw_list_compositing_images(
File "/Users/username/Documents/Newsvendor/venv/lib/python3.10/site-packages/matplotlib/image.py", line 132, in _draw_list_compositing_images
a.draw(renderer)
File "/Users/username/Documents/Newsvendor/venv/lib/python3.10/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer)
File "/Users/username/Documents/Newsvendor/venv/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 3020, in draw
self._unstale_viewLim()
File "/Users/username/Documents/Newsvendor/venv/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 776, in _unstale_viewLim
self.autoscale_view(**{f"scale{name}": scale
File …Run Code Online (Sandbox Code Playgroud)