在PDF文件中,通过Javascript API与表单字段进行交互非常容易.
是否可以对页面上的任意元素执行此操作(特别是显示/隐藏)?比方说,不仅仅是表单字段,还有文本,图形元素,嵌入式图像......是否有API与这些进行交互?
如果是,我如何识别对象?
来自http://ant.apache.org/manual/Tasks/exec.html:
请注意,您无法与分叉程序交互,向其发送输入的唯一方法是通过input和inputstring属性.另请注意,自Ant 1.6以来,任何在分叉程序中读取输入的尝试都将收到EOF(-1).这是Ant 1.5的变化,这样的尝试会阻止.
如何从ant启动交互式控制台程序并与之交互?
我想要做的是类似于drush sqlc功能,即使用正确的数据库凭据启动mysql客户端解释器,但不限于此用例.
这是一个示例用例:
<project name="mysql">
<target name="mysql">
<exec executable="mysql">
<arg line="-uroot -p"/>
</exec>
</target>
</project>
Run Code Online (Sandbox Code Playgroud)
使用ant运行时:
$ ant -f mysql.xml mysql
Buildfile: /home/ceefour/tmp/mysql.xml
mysql:
Enter password:
BUILD SUCCESSFUL
Total time: 2 seconds
Run Code Online (Sandbox Code Playgroud)
输入密码后,立即退出.
将此与直接在shell上执行时发生的情况(预期行为)进行比较:
$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1122
Server version: 5.1.58-1ubuntu1 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights …Run Code Online (Sandbox Code Playgroud) 我目前正在使用persp-command 在R中生成3D图形.要更改视点,必须设置参数theta和phi.为了评估(一个好的观点)图,人们必须为这些参数尝试许多组合.
我想知道是否可以定义一个允许使用鼠标旋转图形的交互式输出设备.如果此设备为theta和提供当前值,那也很好phi.
有这样的设备/包吗?
我有一些数据,我想把它放在散点图中,当我翻转图表上的点时,我想要一个气泡弹出窗口并给出一些识别信息.
例如,如果我有一个学生姓名,身高和体重的数据框,我想分别在x和y轴上绘制身高和体重.然后,当我翻转绘图中的单个点时,会弹出一个带有学生姓名的气泡.
在一个plot()被调用的基本函数中使用了一个类似的函数identify()但是它需要点击该点并且在我离开该点之后不会消失.
这是一个示例df和图/识别代码:
> dput(df1)
structure(list(id = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), var1 = c(0.469521932071075,
0.077109789242968, 0.076340542640537, 0.461061101639643, 0.347079795086756,
0.425340321380645, 0.738443679409102, 0.00931701785884798, 0.267918228404596,
0.722170797875151), var2 = c(0.265150599181652, 0.557858553016558,
0.715832461370155, 0.186717337928712, 0.626156869810075, 0.1359783844091,
0.67408229294233, 0.528320853365585, 0.241800826275721, 0.80992470192723
), names = c("jim", "nancy", "suzy", "mark", "alex", "jen", "luz",
"jeff", "paula", "amir")), .Names = c("id", "var1", "var2", "names"
), row.names = c(NA, -10L), class = "data.frame")
plot(df1$var1, df1$var2);grid()
identify(df1$var1, df1$var2, labels = df1$names) …Run Code Online (Sandbox Code Playgroud) 在我注意到knitr的作者建议的方法获得更多帮助后,我在这里重新发布我的问题.
我对.Rmd文件有点困惑,我可以在交互式R会话中逐行进行,也可以使用R CMD BATCH,但在使用时失败knit("test.Rmd").我不确定问题出在哪里,我试图尽可能地缩小问题范围.以下是示例(in test.Rmd):
```{r Rinit, include = FALSE, cache = FALSE}
opts_knit$set(stop_on_error = 2L)
library(adehabitatLT)
```
The functions to be used later:
```{r functions}
ld <- function(ltraj) {
if (!inherits(ltraj, "ltraj"))
stop("ltraj should be of class ltraj")
inf <- infolocs(ltraj)
df <- data.frame(
x = unlist(lapply(ltraj, function(x) x$x)),
y = unlist(lapply(ltraj, function(x) x$y)),
date = unlist(lapply(ltraj, function(x) x$date)),
dx = unlist(lapply(ltraj, function(x) x$dx)),
dy = unlist(lapply(ltraj, function(x) x$dy)),
dist = unlist(lapply(ltraj, …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用MatPlotLib创建一个交互式GUI,用户最常注意的是,例如,更改滑块和GUI响应之间的延迟.
目前,我plt.draw()在每个事件结束时使用,它运行良好,除了它导致256ms函数259ms运行时的事实.
在研究替代方案时plt.draw(),我遇到了这个帖子:为什么Matplotlib的绘图速度如此之慢?,建议使用它fig.canvas.blit(ax1.bbox)作为重新加载图形的替代方案,而不是整个图形.
当我用这个,事件处理程序运行在3ms,但下面的事件在GUI的更新,而不是如同事件在缓冲区抓住了当前事件的结束:User input 1> pause> User input 2> GUI responds to input 1> pause> User input 3> GUI responds to input 2,使程序无法使用.
那么我有什么替代品?修复这些问题中的任何一个都可以让我运行一个非常快的GUI.如果需要,我会发布代码.
注1:使用时fig.canvas.blit(ax1.bbox),滑块,按钮等会立即更改,只有子图的行为如上所述.
注2:fig.canvas.draw_idle()在小部件示例中使用http://matplotlib.org/examples/widgets/slider_demo.html,并fig.canvas.draw()执行相同的操作plt.draw()
我正在玩自定义和交互式视图控制器转换UIPercentDrivenInteractiveTransition.我正在构建一个以模态方式呈现卡片(其他视图控制器)的应用程序.我已经进行了自定义转换,UIViewControllerAnimatedTransitioning这使得卡片视图控制器的动画效果与标准模型演示风格非常相似.
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
{...}
let fullScreenFrame = transitionContext.finalFrame(for: cardVC)
let offsetFrame = cardVC.view.frame.offsetBy(dx: 0, dy: cardVC.view.frame.height)
let finalFrame = presenting ? fullScreenFrame : offsetFrame
cardVC.view.frame = presenting ? offsetFrame : fullScreenFrame
containerView.addSubview(cardVC.view)
UIView.animateKeyframes(
withDuration: transitionDuration(using: transitionContext),
delay: 0,
options: UIViewKeyframeAnimationOptions.calculationModeLinear,
animations: {
UIView.addKeyframe(
withRelativeStartTime: 0,
relativeDuration: 1,
animations: { [weak self] in
guard let strongSelf = self else { return }
backgroundView.alpha = strongSelf.presenting ? 1 : 0
})
UIView.addKeyframe(
withRelativeStartTime: 0,
relativeDuration: …Run Code Online (Sandbox Code Playgroud) 我创建了一个shiny应用程序来显示大型数据集的相关热图.按下热图贴图后,将显示相应的散点图.
但是,我需要制作其中几个应用程序,这超出了我的发布限制shinyapps.io.我的公司不愿意升级到付费计划.我尝试使用其他方法发布应用程序,如RInno无效(我认为应用程序太复杂了?).
如果有人能告诉我如何plotly单独生产同样的东西而不是shiny,我会永远感激.我相信crosstalk可能是将热图贴图链接到散点图的路径?
谢谢
这里的例子.
library(plotly)
library(shiny)
# compute a correlation matrix
correlation <- round(cor(mtcars), 3)
nms <- names(mtcars)
ui <- fluidPage(
mainPanel(
plotlyOutput("heat"),
plotlyOutput("scatterplot")
),
verbatimTextOutput("selection")
)
server <- function(input, output, session) {
output$heat <- renderPlotly({
plot_ly(x = nms, y = nms, z = correlation,
key = correlation, type = "heatmap", source = "heatplot") %>%
layout(xaxis = list(title = ""),
yaxis = list(title = ""))
}) …Run Code Online (Sandbox Code Playgroud) 我正在创建某种图像编辑器(有点像 Canva)。对于放大、缩小和平移,我使用InteractiveViewer. 但问题是,一旦我开始使用InteractiveViewer,我注意到画布内元素的其他手势(例如,点击并拖动元素应该拖动元素)不起作用。点击和拖动现在变成了平移整个画布。
即使我关闭平移和缩放,情况仍然如此(panEnabled: false, scaleEnabled: false)。值得庆幸的是,单击仍然有效,因为 InteractiveViewer 不使用它,但当用户进行不适合InteractiveViewer. 例如,如果用户点击某个元素使其被选中,则所有手势输入都应转到被点击的元素而不是InteractiveViewer。
我曾经想过一个解决方案,就是InteractiveViewer在选择一个元素时不使用,但这会导致用户立即失去之前设置的缩放和平移。我需要解决方案,以便 InteractiveViewer 可以保留缩放和平移设置,同时让所有手势输入传递到内部元素。我怎样才能做到这一点?
有没有办法改进这个交互式 matplotlib/cartopy 脚本的渲染?
请先安装 ipympl https://github.com/matplotlib/ipympl
我还没有找到如何在不实例化新图形的情况下更改中心经度和纬度。
当单击鼠标左键并选择新的投影中心时,此脚本缺乏流动性。我正在寻找https://twojs.org/examples/misc_controls_trackball中的轨迹球行为。
欢迎任何帮助/建议。
%matplotlib widget
import numpy as np
import matplotlib.pyplot as plt
import cartopy
import cartopy.crs as ccrs
fig = plt.figure(figsize=(10,6), layout='constrained')
proj0 = ccrs.PlateCarree()
proj1 = ccrs.Orthographic(0, 80)
ax1 = fig.add_subplot(1, 1, 1, projection=proj1)
ax1.coastlines()
ax1.gridlines(xlocs=np.arange(-180,180,10), ylocs=np.arange(-80,90,10))
ax1.set_global()
def onpress(event):
global proj1
if event.button == 1:
lon, lat = proj0.transform_point(event.xdata, event.ydata, src_crs=proj1)
proj1 = ccrs.Orthographic(lon, lat)
ax1 = fig.add_subplot(1, 1, 1, projection=proj1)
ax1.coastlines()
ax1.gridlines(xlocs=np.arange(-180,180,10), ylocs=np.arange(-80,90,10))
ax1.set_global()
plt.draw()
fig.canvas.mpl_connect('button_press_event', onpress)
plt.show()
Run Code Online (Sandbox Code Playgroud)
interactive ×10
r ×4
matplotlib ×2
3d ×1
acrobat ×1
ant ×1
cartopy ×1
console ×1
exec ×1
flutter ×1
ggplot2 ×1
ggplotly ×1
ios ×1
javascript ×1
knitr ×1
pdf ×1
performance ×1
plot ×1
plotly ×1
projection ×1
python ×1
shiny ×1
swift ×1
task ×1
transitions ×1