I want to show the effect of threshold on FAR and FRR( basically the region under a curve with when the x-range is bounded ). To do that I need to do something like this!

If the threshold moves so does the corresponding areas bounded by the ends and the threshold. I also want to have the two corresponding areas in different colours. Is there a way to do it in octave/python/any other tool. What is the simplest way to do so?
Also how to textbook authors draw these kind of graphs. These are not standard functions for sure.
This is actually very easy in Octave. Using the same code for the other example (converted for Octave):
## create same fake data as other example
x = 0:0.1:20;
y1 = exp(-(x-6).**2 / 5);
y2 = 2 * exp(-(x-12).**2 / 8);
area (x, y1, "FaceColor", "blue");
hold on;
area (x, y2, "FaceColor", "red");
area (x, min ([y1; y2]), "FaceColor", "green");
hold off
I get the following figure
It should be possible to change the transparency of the areas with the FaceAlpha but apparently that hasn't been implemented in Octave yet (one day though). In the mean time, you can pass RGB values as a workaround
area (x, y1, "FaceColor", [0.0 0.0 0.8]);
hold on;
area (x, y2, "FaceColor", [0.0 0.8 0.0]);
area (x, min ([y1; y2]), "FaceColor", [0.0 0.8 0.8]);
hold off
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With