小编Arc*_*ave的帖子

Julia 与 R 的等效 ggplot 代码是什么?

我想在 Julia 中绘制一个复杂的图表。下面的代码是使用 ggplot 的 Julia 版本。

using CairoMakie, DataFrames, Effects, GLM, StatsModels, StableRNGs, RCall
@rlibrary ggplot2

rng = StableRNG(42)
growthdata = DataFrame(; age=[13:20; 13:20],
                       sex=repeat(["male", "female"], inner=8),
                       weight=[range(100, 155; length=8); range(100, 125; length=8)] .+ randn(rng, 16))

mod_uncentered = lm(@formula(weight ~ 1 + sex * age), growthdata)

refgrid = copy(growthdata)
filter!(refgrid) do row
    return mod(row.age, 2) == (row.sex == "male")
end
effects!(refgrid, mod_uncentered)

refgrid[!, :lower] = @. refgrid.weight - 1.96 * refgrid.err
refgrid[!, :upper] = @. refgrid.weight + 1.96 * …
Run Code Online (Sandbox Code Playgroud)

ggplot2 julia

7
推荐指数
1
解决办法
1790
查看次数

带有复选框的kendo listView以及全选复选框选项

我是kendo UI实施的新手,正在寻找一种使用复选框创建列表视图的方法,第一个复选框是“全部选项”,如果选中该选项,则可以选择列表视图中的所有项目。我创建了一个模板,允许我向项目添加复选框,但是我需要在所有数据之上添加一个ALL复选框。这是我到目前为止所做的,下面(截屏)是我想要实现的目标。

这是我的模板:

<script type="text/x-kendo-tmpl" id="myTemplate">
    <div class="item click" data="${ProductID}">
        <input type="checkbox" class="click" />
        <span class="checkbox">#:ProductName#</span>
    </div>
</script>
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/Archie/w6jsZ/

带有复选框的LIstview

jquery jquery-plugins kendo-ui

3
推荐指数
1
解决办法
2万
查看次数

如何在动画后设置焦点

我想在使用div.focus和animate()滚动到页面顶部后,将焦点设置为id的文本框,让我们说txtName.

是否有一个功能指定在像document.ready之后的document.ready执行动画之后进行聚焦?

我用来滚动的代码如下.

$(".gototop").click(function(){ 
    var focusElement = $("#contents"); 
    $(focusElement).focus(); 
    ScrollToTop(focusElement); 
}); 

function ScrollToTop(el) { 
    $('html, body').animate({ scrollTop: $(el).offset().top - 50 }, 'slow');           
} 
Run Code Online (Sandbox Code Playgroud)

jquery jquery-ui

2
推荐指数
1
解决办法
6380
查看次数

适合地图内的边界

我使用 OSM 显示县的边界。它在大多数情况下都工作得很好,但在某些情况下,县更大并且不适合地图。

如何在开始渲染之前调整缩放级别?

var map = L.map("mapCnty").setView([31.2506372, -102.3385429], 5);
        
map.attributionControl.setPrefix();
        
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
     attribution: \'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors\'
}).addTo(map);

function drawCountyBoundary(county, state) {
    url = "https://nominatim.openstreetmap.org/search.php?county=" + county + "&state=" + state + "&polygon_geojson=1&format=jsonv2";
          fetch(url).then(function(response) {
              return response.json();
          })
          .then(function(json) {
          map.flyTo([json[0].lat, json[0].lon], 9);
          setTimeout(function(){
              geojsonFeature = json[0].geojson;
              L.geoJSON(geojsonFeature).addTo(map);
          }, 1900);
     });
 }
        
 drawCountyBoundary("Cibola", "NM");
Run Code Online (Sandbox Code Playgroud)

javascript openstreetmap

2
推荐指数
1
解决办法
216
查看次数