向ggplot2中的现有线条/散点图添加图例

时间:2019-07-08 23:52:24

标签: r ggplot2 legend

图例中不显示图例。我尝试了几种技巧,但传说不会出现。有人可以帮忙吗?

const textCustomSetter = (newValue, newComponent) => {
    newComponent.properties.Text = newValue;
    //split on one or more slashes before an n, keep the delimiter
    var arr = newValue.split(/(\\{1,}n)/g);
    for (var i = 0; i < arr.length; i++) {
      if (arr[i] == "\\n") {
      //address the newline
        arr[i] = "\n";
      }
      //everything else, gets one slash reduced 
      if (arr[i].match(/\\{2,}n/g)){
        arr[i] = arr[i].substr(1);
      }
    }
    newComponent.properties.children = arr;
};

0 个答案:

没有答案