Change the colour of the background of a plot according to a function

1 visualización (últimos 30 días)
Hello!
1 - I want to reproduce zones of a plot darker or lighter according to a function, like
a*x^2+b*x+c %you can set a,b,c to place the zero
2 - The next step is to mix zones in both axis so that I get something like this
a*x^2+b*x+c + d*y^2+e*y+f %you can set the constants to place the zero
Ignore the red rectangles. My question is how to 'paint' the grey background.
Thank you for your time, Pedro

Respuestas (1)

Walter Roberson
Walter Roberson el 9 de Jun. de 2017
The easiest way to "paint" a background is to put up an image and use uistack to ensure that it is moved to the bottom after you add everything else.
Slightly more robust is to parent the image into an hggroup and use an hgtransform to move it to a z coordinate that is less than 0.
However, if you need 3D then you need to texture map the image onto a surface or patch.
If you have your colors defined in terms of data coordinates instead of in terms of pixels, then it would be more appropriate to create a patch or surface in which the colors are associated with vertices and you set up face color interpolation and possibly shading as well.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by