You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve API for applying fills to regions of scatter plots #13
The current implementation for applying fills to regions of scatter plots is limited: You can apply two separate fills, for two different base values. This allows you to have a fill above, and a fill below a scatter plot, for example. But if you want to have a different fill for when the plot goes below an axis, for example, you can't do that. You end up having to split the scatter plot into two separate plots.
It would be good if there was a system for filling regions of scatter plots that was flexible, and could handle all cases. Here is one suggestion:
Drawing the regions would not be quite as easy as now. Some means of only drawing fill on the appropriate side of the scatter plot would be needed. In effect the intersection of two areas would need to be found. One masks the other. It may be possible to do this with Quartz 2D calls.
I think a CGPath could be defined by the 2 border plots (and some vertical limits) and then filled, also making sure all sub-areas (see even-odd and winding-number rules) are filled correctly if the two plots cross each other at some point
I came across this issue looking to do something similar as described above. Some of my data sets have NaN values, and to indicate this on the plot I was thinking of drawing a light grey vertical band that covers the plot area.
This is a slight complication (maybe?) of what is described above. In this case, if the data set has 10 NaN values, 30 finite values, then another 5 NaNs, one would not want to plot 15 regions, but rather to coalesce them into two regions. In this case, they'd be drawn from inf to +inf.
Any suggestions on how this might be accomplished? I could try to poke some code to see what would be needed.
For bands that extend from -inf to +inf, you can use background limit bands. You'll have to analyze the plot data yourself to determine where to put them and how big to make them.
See the "Axis Demo" in the Plot Gallery example app for sample code to create the bands.
Activity
victor commentedon Nov 18, 2015
I think a CGPath could be defined by the 2 border plots (and some vertical limits) and then filled, also making sure all sub-areas (see even-odd and winding-number rules) are filled correctly if the two plots cross each other at some point
demitri commentedon Apr 25, 2019
I came across this issue looking to do something similar as described above. Some of my data sets have
NaNvalues, and to indicate this on the plot I was thinking of drawing a light grey vertical band that covers the plot area.This is a slight complication (maybe?) of what is described above. In this case, if the data set has 10
NaNvalues, 30 finite values, then another 5NaNs, one would not want to plot 15 regions, but rather to coalesce them into two regions. In this case, they'd be drawn from inf to +inf.Any suggestions on how this might be accomplished? I could try to poke some code to see what would be needed.
eskroch commentedon Apr 25, 2019
For bands that extend from
-infto+inf, you can use background limit bands. You'll have to analyze the plot data yourself to determine where to put them and how big to make them.See the "Axis Demo" in the Plot Gallery example app for sample code to create the bands.