Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upstat_contour fill - 2 issues #1066
Comments
|
I am also hoping that stat_contour(geom="polygon") can act as filled.contour too. Hopefully this problem will be considered. |
|
Fixing this is complicated because ggplot2 uses |
|
Yeah it demands some serious coding to make it work without flaws. For the time being I did some easy changes in the filled.contour and I am using that. But as I said ggplot2 is more powerful. I think it would be good to have this tread in case someone in the future wants to work on that update. Thanks for the feedback, Cheers! |
|
raidsteel, I'd be very interested in your altered filled.contour code. I'm having similar issues with blank polygons in stat_contour and the current functionality for filled.contour doesn't provide the necessary functionality for me. |
|
@LukeDetwiler not sure if this is what you are looking for but you may find this hack useful. https://stackoverflow.com/questions/28469829/how-to-fill-in-the-contour-fully-using-stat-contour |
Hello everyone,
I have been using ggplot2 for quite sometime now it's a great library! But I am stuck on some (known from what I have searched) issues of stat_contour.
Straight to a simple example to show you what I mean:
Creating the data
Ploting contour
Ploting filled contour by setting geom="polygon"
In order to see what is filled correctly and what is not
And if we reverse the values of R$z we can display the inner/hidden levels (multiply *-1)
The first problem is somehow fixed (not completely) by expanding my grid with the same values that has in each side. Something like this:
To sum up, (1) every level that is higher than 1 is not filled correctly since the level line is not closed on the edges. So whenever the level is not closed, ggplot is forcing a closure by connecting the two edges of the semi-circles. Maybe the only way to correct the above problem is to handle and plot the levels in stat_contour as polygons with certain coordination. Can I somehow obtain the exact point position that belong to each contour line? If I could then I would be able to plot them as polygons and set a certain box around the region I want to plot and "close" the "un-closed" levels in order to be filled correctly.
And (2) since ggplot (to my understanding) is plotting lower to higher levels, the lower levels are obscured. I have no idea how this could be fixed, since some datasets contain regions of lower values around higher levels.
I don't know how hard is to tackle and correct these problems since I have no experience on the ggplot code. It would be really useful if stat_contour acted as filled.contour, since ggplot2 has some many possibilities. So I would like to hear your thoughts and your suggestions.
Thank you in advance,
Thanos