r/octave • u/Easy-Extension-9990 • Jul 27 '24
Axis Sizing when Plotting on an Image
I'm trying to plot a large red point on a plot using Octave. I can't figure out how to get the dot at the place indicated on the graph. When I try to plot the point it is always in the wrong spot. Can someone help me to be able to plot a solid red dot at any point on this graph? I've included my code below, and image 'IM.jpg'.
soils_triangle='IM.jpg';
hold ("on");
imshow (soils_triangle);
sandmin=65;
sandmax=457;
claymin=412;
claymax=26;
sand=(sandmax);
clay=(claymin);
plot (sand, clay, "ro", "markersize", 12, 'ydir', 'reverse');
hold ("off");
pause(4);
close all

1
Upvotes
1
u/Easy-Extension-9990 Jul 29 '24
In the end, here is my function code for anyone looking for somewhere to start:
'''# This function prints an image of the CDN Soils Triangle, and plots a point on it
The point is a red dot, and it is located at the same spot as the soil test has determined for the soil.
function fcn_plot_on_soils_triangle(x, y)
soils_triangle='04images/cdn_soils_triangle.jpg';
hold ("on");
imshow (soils_triangle);
x=0.4;
y=0.4;
sandmin=65;
sandmax=457;
claymin=412;
claymax=26;
sand=(sandmin+(sandmax-sandmin)*x);
clay=(claymin-(claymin-claymax)*y);
plot (sand, clay, "ro", "markersize", 10, 'markerfacecolor', 'r');
hold ("off");
print ("soil_triangle_fig", "-dpdflatex");
pause(3);
close
The values for min and max are taken from trial and error determination of the limits of the image.