带轴的一维直方图的2D填充轮廓图 [英] 2D filled.contour plot with 1D histograms by axes by R

查看:67
本文介绍了带轴的一维直方图的2D填充轮廓图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望这个问题超出了阅读手册"的范围.我的任务很简单,仅绘制以下内容,但中间的图应为fill.contour图: http://gallery.r-enthusiasts.com/graph/Scatterplot_with_marginal_histograms_78

I hope this question is beyond "read the manual". My task is simple, just to plot the following, but the plot in the middle should be a filled.contour plot: http://gallery.r-enthusiasts.com/graph/Scatterplot_with_marginal_histograms_78

背景:我更喜欢fill.contour而不是hist2d.因为,我可以使用平滑的内核,所以离散数据的绘制不会太难看.我也尝试过image()然后再试过轮廓(),但是轮廓上的数字不清楚,也没有颜色指示.

Background: I prefer filled.contour rather than hist2d. Because, I could use kernel smooth, so the plot for discrete data won't be too ugly. I also tried image() and then contour(), but the number on contour is not clear and no indication about the color.

我的问题:在filled.contour函数中,它对filledcontour()图和rect()图(颜色条)使用layout().但是,我在外部代码中使用layout()来组织2个直方图和一个fill.contour图.看起来,外面的布局被fill.contour()遮盖了.我不确定R如何处理这个问题.我应该以某种方式重写fill.contour()吗?

My problem: in filled.contour function, it uses layout() for filledcontour() plot and rect() plot (color bar). However, I use layout() in the outside code to organize 2 histogram and one filled.contour plot. Looks like, the layout outside is shadowed by filled.contour(). I am not sure how R deal with this problem. Should I rewrite filled.contour() somehow?

谢谢

推荐答案

如果您查看帮助页面?filled.contour,您会发现它也提到了另一个名为.filled.contour的功能(前面是.)它只是在不调用layout的情况下进行裸露的绘制,并且会引起您所看到的问题.您需要做更多的检查和前期工作,但是您应该能够使用.filled.contour作为主要图解并自行设置布局.

If you look at the help page ?filled.contour you will see that it also mentions another function called .filled.contour (extra . at the front) which does just the bare bones plotting without calling layout and causing the problems that you see. You need to do more of the checking and prelim work, but you should be able to do what you want using .filled.contour for the main plot and setting up the layout yourself.

这篇关于带轴的一维直方图的2D填充轮廓图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆