有没有一个类似于Callable但有参数的接口?(Is there an interface similar to Callable but with arguments?)
Java中有一个类似于
Callable
接口的接口,可以接受它的调用方法的参数?像这样:
public interface MyCallable<V> { V call(String s) throws Exception; }
我宁愿避免创建一个新的类型,如果已经存在我可以使用的东西。 还是有更好的策略来让多个客户端实现并插入可调用例程?
从这里复制http://www.programmingforums.org/thread27905.html
Is there an interface in Java similar to the
Callable
interface, that can accept an argument to its call method?Like so:
public interface MyCallable<V> { V call(String s) throws Exception; }
I would rather avoid creating a new type if there already exists something that I can use. Or is there a better strategy to having multiple clients implement and plug in a callable routine?
Copied from here http://www.programmingforums.org/thread27905.html
原文:https://stackoverflow.com/questions/11083868
最满意答案
打开图形设备后应调用
par
函数,在本例中使用png
完成。 所以你只需要移动那一行。The
par
function should be called after you open the graphics device, which in this case is done withpng
. So you simply need to move that line.
相关问答
更多-
您可以使用facet_grid或facet_wrap按照因素分割图形。 ggplot(mydata, aes(Var1, Var2)) + geom_point() + facet_grid(~ Variety) 或者在单独的图上,只需使用一个简单的循环 for (var in unique(mydata$Variety)) { dev.new() print( ggplot(mydata[mydata$Variety==var,], aes(Var1, Var2)) + geom_poi ...
-
我认为你对这个问题有类似的问题: 在matplotlib中栅格化多个元素 如在其中一个答案中 ,使用: ax = fig.add_subplot(111, rasterized=True) 或做: ax.set_rasterized(True) 然后,如果要稍微调整文件大小,可以设置图的分辨率: savefig(pdf, format='pdf', dpi=300) You have a similar problem to this question, I think: Rasterizing mu ...
-
打开图形设备后应调用par函数,在本例中使用png完成。 所以你只需要移动那一行。 The par function should be called after you open the graphics device, which in this case is done with png. So you simply need to move that line.
-
安排多个地块的一种方法是使用multipanelfigure封装。 创建示例图: library(ggplot2) plots <- list() for(i in 1:5) { plots[[i]] <- ggplot() + ggtitle(paste("My plot:", i)) } 为情节创建面板: library(multipanelfigure) figure <- multi_panel_figure(columns = 4, rows = 3, panel_label_type ...
-
我想你已经有了答案。 你的最后一行返回一个错误,但是一个小的编辑会产生一个组合图,其中列内的宽度是相同的: g3 = do.call(rbind, c(list(g1,g2), size="first")) #combine g1 and g2 into a list 审美/参考的一个旁注: 如果你的X轴是相同的,你可以从顶部的两个图中删除它。 library(ggplot2); library(gridExtra); library(grid) # Tweak the margins to use up ...
-
简单地把你的代码放到一个循环中,每次改变列名称和剧情名称都应该做到这一点(从快速测试它为我工作,我有3个PDF保存在我的工作目录中): import matplotlib.pyplot as plt import seaborn as sns for column in df.columns[1:]: # Loop over all columns except 'Location' sns.set() fig, ax = plt.subplots() sns.set(style ...
-
在Plots.jl文档的属性部分中,有一个名为Subplot的部分。 在那里,你会发现可能对你有帮助的关键字margin , top_margin , bottom_margin , left_margin和right_margin 。 最小的工作示例是: using Plots, Measures pyplot() data = [rand(100), rand(100)]; histogram(data, layout = 2, title = ["Dataset A" "Dat ...
-
R中的多个轮廓图(Multiple Contour Plots in R)[2021-06-13]
粘贴代码非常有用。 看起来fill.contour的方式发生了变化,因为该代码首次发布。 改变线 .Internal(filledcontour(as.double(x), as.double(y), z, as.double(levels), col = col)) 至 .filled.contour(as.double(x), as.double(y), z, as.double(levels), col = col) 这样做我得到了情节 Pasting the co ... -
问题出在你的布局矩阵m : # [,1] [,2] [,3] [,4] #[1,] 1 2 3 4 #[2,] 5 6 7 8 #[3,] 9 10 9 10 在最后一行中,您有9, 10, 9, 10而不是9, 9, 10, 10 。 使用 m <- cbind(c(1,5,9), c(2,6,9), c(3,7,10), c(4,8,10)) 代替。 我想让最后一行中的两个图在中心对齐,与其他图的长度和宽度相同。 通过保留相 ...
-
如评论中所述,您可以提供频率响应阵列作为MIMO系统的输入输出响应。 让我们伪造一些3x4x100的复数,伪造一系列频率,然后画出Bode A = rand(3,4,1000); A = A + (rand(3,4,1000)-0.5)*1i; w = logspace(-2,2,1000); G = frd(A,w); bode(G) 您可以从具有幅度和相位角的r*exp(i \theta)的极坐标表示的磁/相位阵列中再次获得复矢量。 编辑 f1=[1,10,100,1000]; amp1=[12,56 ...