ggplot:默认情况下将geom_ribbon隐藏到我的情节中

时间:2018-04-17 12:10:22

标签: r ggplot2 ggplotly r-plotly

我有这个情节:

applyUserFilters() {
    let filterCountries: Filter;
    let filterOrganisation: Filter
    this.paginator.pageIndex = 1
    let organisationField = this.filterForm.get('filterOrganisation');
    let countriesField = this.filterForm.get('filterCountries');
    console.log(countriesField.value == '');//Is false second time
    if (organisationField.value.trim() == '') {
      organisationField.setValue('')
    } else {
      filterOrganisation = {
        Value: this.filterForm.get('filterOrganisation').value,
        Operation: this.filterOperation,
        Property: 'Organisation'
      }
      this.filtersArray.push(filterOrganisation);
      console.log(this.filtersArray)
    }

    if (countriesField.value.trim() == '') {
      countriesField.setValue('')
    } else {
      filterCountries = {
        Value: this.filterForm.get('filterCountries').value,
        Operation: this.filterOperation,
        Property: 'Countries'
      }
      console.log(this.filtersArray)
      this.filtersArray.push(filterCountries);
    }


    this.loadUserPage();
    this.clearAllFilters();
    this.toggleDropDown('close');

}

有没有办法只隐藏geom_ribbon()并将geom_line()打印到我的图表中?我尝试使用“legendonly”,但这隐藏了所有线条......

DateTime utcDate = DateTime.UtcNow;

var result =
    entries // e.g. context.tableName
    .GroupBy(e => e.username)
    .Select(gr =>
        gr
        .Where(x => x.date < utcDate)
        .OrderByDescending(x => x.date)
        .FirstOrDefault()) // This will give us null for devices that
                           // don't have a status entry before the date
    .AsEnumerable()
    .ToList();

1 个答案:

答案 0 :(得分:0)

使用参数&#34; 跟踪&#34;隐藏geom_ribbon()在功能&#34; style() &#34;。例如:我的varC中有10个因子,所以我有10行(geom_line())和10个CI(geom_ribbon):20个项目。

隐藏geom_ribbon()表示&#34; 痕迹&#34; 11:20和可见=&#34; legendonly&#34;

style(ggplotly(g.mean, tooltip = c("varC","x","y")),
  visible="legendonly",
  hoverinfo = "value",
  traces = c((length(unique(df$varC))+1):(length(unique(df$varC))*2)))