删除对角线corrplot上变量的文本标签

时间:2017-01-13 12:13:38

标签: r r-corrplot

如何从private static String oAuthConsumerKey = "YOUR-CONSUMER-KEY-GOES-HERE"; private static String oAuthConsumerSecret = "YOUR-CONSUMER-SECRET-GOES-HERE"; private static String oAuthAccessToken = "YOUR-ACCESS-TOKEN-GOES-HERE"; private static String oAuthAccessTokenSecret = "YOUR-ACCESS-TOKEN-SECRET-GOES-HERE"; private static TwitterStream config() { ConfigurationBuilder configBuilder = new ConfigurationBuilder(); configBuilder.setDebugEnabled(true) .setOAuthConsumerKey(oAuthConsumerKey) .setOAuthConsumerSecret(oAuthConsumerSecret) .setOAuthAccessToken(oAuthAccessToken) .setOAuthAccessTokenSecret(oAuthAccessTokenSecret); return new TwitterStreamFactory(configBuilder.build()).getInstance(); } private static void getTweets(){ TwitterStream twitterStream = config(); StatusListener listener = new StatusListener(){ @Override public void onException(Exception ex) { ex.printStackTrace(); } @Override public void onStatus(Status status) { //System.out.println(status.getId() + " " + status.getText()); try { writeTweetsToFile(status); } catch (InterruptedException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) { System.out.println("Status deletion notice " + statusDeletionNotice.getStatusId()); } @Override public void onTrackLimitationNotice(int numberOfLimitedStatuses) { System.out.println("Got track limitation notice " + numberOfLimitedStatuses); } @Override public void onScrubGeo(long userId, long upToStatusId) { System.out.println("Got scrub_geo event userId: " + userId + "upToStatusId:" + upToStatusId); } @Override public void onStallWarning(StallWarning warning) { System.out.println("Got stall warning " + warning); } }; //TwitterStream twitterStream = config(); twitterStream.addListener(listener); twitterStream.sample(); } } 上的对角线 中删除文字标签?

corrplot

由于我使用corrplot(my_correlation_matrix1, method = "color", type = "lower", tl.col = "black", tl.cex = 0.6, tl.srt = 45) corrplot(my_correlation_matrix2, method = "color", type = "lower", tl.col = "black", tl.cex = 0.6, tl.srt = 45, add = T) ,因此2个add = T合并在一个图中。但因为它们在对角线上有值,所以它们是重叠的。如何解决这个问题?

我尝试做的是合并2-corrplots-in-1。针对同一组值的两种不同研究。 corrplotUpper triangularmeasurement Alower

1 个答案:

答案 0 :(得分:1)

这里有一些问题。由于您未提供相关矩阵,因此我们无法运行您的代码以查看您所看到的内容。请使用dput(my_correlation_matrix1)dput(my_correlation_matrix2)将相关矩阵添加到问题中。此外,在您的示例代码中,两个矩阵都使用type = "lower"打印。我想你希望他们中的一个成为"鞋帮"。

corrplot的tl.xxx系列参数控制所有文本标签。我不认为你可以分别控制对角线上的那些。但是,我认为你可以在没有太多工作的情况下得到你想要的东西。只需创建并绘制具有所需值的完整矩阵即可。

merged_corr_matrix = my_correlation_matrix1
LT = lower.tri(merged_corr_matrix)
merged_corr_matrix[LT] = my_correlation_matrix2[LT]

corrplot(merged_corr_matrix,
     method = "color",                                    
     tl.col = "black",                                    
     tl.cex = 0.6,                                        
     tl.srt = 45)