Search code examples
javaswingawt2djava-2d

Draw 2d graph with y-axis, x-axis


enter image description here How to draw 2d graph with y-axis, x-axis which begin with 0,0 coordinates and all values in positive direction?

It must be started at left bottom of canvas. y-axis and x-axis also need to draw in the canvas.


Solution

  • Use an AffineTransform (or combination of them) to flip the y value, and shift 0,0 to the bottom left of the component.